FAQ How to get LUT (last update time) of a record
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.
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();
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.
If there is a clock skew between master and replica (for replication factor 2 and above) nodes within a cluster, the last update time of a record will be identical for both copies and will be as per the master node’s time.
LUT METADATA UDF PREDICATE FILTERING