laforge49 / aatree

Immutable AA Tree

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unique timestamps for transaction ids

laforge49 opened this issue · comments

I've always used a modified long timestamp (+ unique (<< timestamp 10)) as a transaction id, but was seduced by datomic's simple counter and a separate timestamp. But now I am implementing a pipeline so that transactions can be logged and sync'd before being applied. And I want the transaction id in the log. This is difficult unless I make the timestamp generator durable. Yuck!

So it is back to the tried and tested modified timestamp for a transaction id. As long as you do not have multiple restarts in the same millisecond, we are assured that the transaction ids will be unique. (Use an atom to generate that unique, resetting the count every time the millisecond changes.)