Hi,

I’m trying to do an atomic read-modify-write where a cell is read and then 
rewritten with an updated value (updated in a complicated way, more than just 
incrementing), but only if there’s been no writes since it was read, otherwise 
try again from the read.

My plan is to use something like

    table.checkAndMutate(row, family).qualifier(qualifier).timeRange(new 
TimeRange(ts + 1)).ifNotExists().put(put)

to insert if the cell row/family/qualifier doesn't exist in the range `[ts + 1, 
infinity)`, which I think means no writes after time `ts`. However, that 
TimeRange constructor is @Deprecated and @Private, and the only remaining ways 
to publicly construct a TimeRange is  `TimeRange.allTime()` ([0, infinity)) and 
`TimeRange.at(long ts)` ([ts, ts + 1)), neither of which are right.

Is there a way to create this time range, or another way to achieve this RMW 
operation?

An alternative is to do a value comparison with `.ifEquals(...)` but my values 
could be quite large (kilobytes), so I was thinking this range comparison would 
be better.

---
Huon Wilson
CSIRO | Data61
https://www.data61.csiro.au
 
 


Reply via email to