How to get LUT of a record


#1

FAQ How to get LUT of a record

Context

The LUT (last update time) of a record is part of a record’s meta data but is currently not returned to the clients through any direct API. The feature to add such capability is internally tracked under jira AER-5566.

As a workaround, one could use a UDF to get the LUT of a record.

Method

Using UDF, one can get the LUT of a record expressed in milliseconds since the Citrusleaf epoch (00:00:00 UTC on 1 Jan 2010).

e.g. You could define a LUA function as such (under record_example.lua for this example):

-- Return LUT of record
function getLUT(r)
    return record.last_update_time(r)
end

From the Java client, you can get the LUT like this after registering the above UDF:

                // Get record last update time.
                long lut = (Long)client.execute(params.writePolicy, key, "record_example", "getLUT");

You can use aql to register the LUA module or simply register it inside the Java application:

                RegisterTask task = client.register(params.policy, "udf/record_example.lua", "record_example.lua", Language.LUA);
                task.waitTillComplete();

Notes

  • One can use predicate filters to get records that have been last updated between two timestamps or before/after a certain timestamp.

  • If the goal is to delete specific records based on their last updated time, you could also use the truncate command.

References

Keywords

LUT METADATA UDF PREDICATE FILTERING

Timestamp

01/08/2018