in tso-server/src/main/java/org/apache/omid/tso/TimestampOracleImpl.java [139:162]
public long next() {
lastTimestamp += CommitTable.MAX_CHECKPOINTS_PER_TXN;
if (lastTimestamp >= nextAllocationThreshold) {
// set the nextAllocationThread to max value of long in order to
// make sure only one call to this function will execute a thread to extend the timestamp batch.
nextAllocationThreshold = Long.MAX_VALUE;
executor.execute(allocateTimestampsBatchTask);
}
if (lastTimestamp >= maxTimestamp) {
assert (maxTimestamp <= maxAllocatedTimestamp);
while (maxAllocatedTimestamp == maxTimestamp) {
// spin
}
assert (maxAllocatedTimestamp > maxTimestamp);
maxTimestamp = maxAllocatedTimestamp;
nextAllocationThreshold = maxTimestamp - TIMESTAMP_REMAINING_THRESHOLD;
assert (nextAllocationThreshold > lastTimestamp && nextAllocationThreshold < maxTimestamp);
assert (lastTimestamp < maxTimestamp);
}
return lastTimestamp;
}