You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Although fault tolerance requires that each microservice writes to its own database tables, in practice this requirement is often violated.
The implementation of UUIDv7 for PostgreSQL had to switch from Method 1 to Method 3 (Increased Clock Precision with 12 bits sub-millisecond timestamp fraction) to synchronize the UUIDv7s generated by different microservices for the same database table. This turned out to be simpler than the autoincrement-like analogue. See the C implementation v27-0001-Implement-UUID-v7.patch of Method 3 at the page as a reference. The entire timestamp acts as a counter in rare case when more than about 4 identifiers per microsecond are generated.
This implementation also added the ability to offset the timestamp by a specified interval to hide the record creation time for information security. If offset would cause the timestamp to be outside the allowed range, it should not be applied.
It would be nice to add such a special UUIDv7 function for microservices.
The text was updated successfully, but these errors were encountered:
Thanks for the note @sergeyprokhorenko! When we did the last round of improvements to the V7 generation I tried to make sure our APIs would be able to support these alternative methods.
This library uses a pluggable interface to calculate the precision and counter for the timestamp that’s input at nanosecond precision. Implementations of that interface also have the opportunity to adjust the timestamp arbitrarily. I think these are the pieces we need to offer an alternative implementation that uses sub-millisecond precision in the counter and can offset the timestamp by some interval.
Hi @KodrAus
Although fault tolerance requires that each microservice writes to its own database tables, in practice this requirement is often violated.
The implementation of UUIDv7 for PostgreSQL had to switch from Method 1 to Method 3 (Increased Clock Precision with 12 bits sub-millisecond timestamp fraction) to synchronize the UUIDv7s generated by different microservices for the same database table. This turned out to be simpler than the autoincrement-like analogue. See the C implementation v27-0001-Implement-UUID-v7.patch of Method 3 at the page as a reference. The entire timestamp acts as a counter in rare case when more than about 4 identifiers per microsecond are generated.
This implementation also added the ability to offset the timestamp by a specified interval to hide the record creation time for information security. If offset would cause the timestamp to be outside the allowed range, it should not be applied.
It would be nice to add such a special UUIDv7 function for microservices.
The text was updated successfully, but these errors were encountered: