3

FoundationDB has versionstamps, ten-byte, unique, monotonically (but not sequentially) increasing values for each committed transaction.

Can I get a timestamp (when the transaction was committed) from that?

Thilo
  • 257,207
  • 101
  • 511
  • 656

1 Answers1

4

Under "normal" (non-failure) conditions, FoundationDB database versions advance at a rate of approximately one million per second. However the rate is not guaranteed to be uniform, so versions cannot be effectively used as a clock.

willwilson
  • 422
  • 3
  • 8
  • Is there a way to reverse-lookup (at least some approximation) of this if the database that produced the versionstamp is still available for queries? A precision of an hour or even a day would be good enough for me here. – Thilo Apr 29 '18 at 01:57
  • 1
    FoundationDB won't do this for you because FoundationDB doesn't trust system clocks at all, and needs to continue to work if those clocks are completely wrong. However, if you trust the clock on your client to a granularity of an hour/day, you could just atomically write a timestamp in the same transaction as your commit. Does that solve the problem? – willwilson Apr 30 '18 at 02:27
  • Yes, I will be adding timestamps to my values (or maybe keys). I just wanted to check first if I can get this for free already. – Thilo Apr 30 '18 at 08:37