Record LUT query

Hey, I am going to use Aerospike in order to store and get data on my app endUsers. By time, the client (browser) sends data related to endUser and it stored in Aerospike by the server.

EveryTime the client “wakes up” it call to the server to get the data on the current endUser.

I want to know if there is an option to read only the delta of the stored data? Or in short, can I query the LUT of a Record?

You can do a read with a predicate expression to only fetch the record if the LUT is beyond a certain value. Unfortunately, the LUT isn’t available on the client-server wire protocol.

So you may either need to:

  1. Record the time you sent the last request and send that time as the LUT to beat. Typical clock skew concerns apply here.
  2. Use a UDF, which has access to the LUT which would allow you to send it back as a bin. You may still want to use the predicate filter to prevent unnecessary disk access. The downside here is a UDF runtime performance hit.

Which client language are you using?

Thanks for the response. I’m using Java client.

Another approach that I think about is to add lastUpdateTime for each Record and query by this field.

Yes, that will work too, especially if performance isn’t much of a concern or if you are using a data-in-memory/“memory only” configuration. Also you will need a bit more storage since you are storing more data.

Using the records last-update-time is always in the index memory. So if you used it within a predexp, the device wouldn’t need to be accessed when the record doesn’t need to be fetched. Using a bin means the device will always need to be accessed.

In java, the predexp you need should be similar to this (unless you go the UDF or bin route):

Policy p = new Policy();

p.setPredExp(
    predexp.integerValue(timeOfLastReadSent),
    predexp.recLastUpdate(),
    predexp.integerGreater());