Open albe opened 7 years ago
Alternatives:
[monotonic timestamp, partitionId]
(only consistent with distributed writers with a synchronized clock)Depending on the goals, following solutions are viable:
partial global order gives best results vs. implementation cost, but no strong guarantees. The partial global order could be "upgraded" to TrueTime though, by storing two timestamps. As long as a single writer is still used (no replication in place), this would still provide a strong consistency with a monotonic clock in the system and write-timestamp given by the writer.
With #80 a global order can be established via the monotonic clock stamp and/or the sequence number in the document header.
This is a very expensive operation, as it involves a full database scan, but it can help when indexes get broken and would technically allow for rewriting storage partitions.
Edit: This is not easily possible without completely losing original global document order, since the global version number needs either to be stored in the document record itself (which means writing the index before the document), OR assume that the documents haven't changed in amount and order, so going through the existing index and keeping that order.
An midway alternative would be to just guarantee a chronological order and reindex on commit timestamp (which could still be unrelated to actuall document creation/event occurence order).