HHH-18377 Fixed bug with sequence resetting

This commit is contained in:
Čedomir Igaly 2024-09-26 14:03:16 +02:00 committed by Christian Beikov
parent 69f8b9af2d
commit d8dd5e7c0d

View File

@ -98,9 +98,9 @@ public UUID generateUuid(SharedSessionContractImplementor session) {
private long getSequence(final long currentTimestamp) { private long getSequence(final long currentTimestamp) {
lock.lock(); lock.lock();
try { try {
if ( this.currentTimestamp > currentTimestamp ) { if ( this.currentTimestamp < currentTimestamp ) {
this.currentTimestamp = currentTimestamp; this.currentTimestamp = currentTimestamp;
clockSequence.set( 0 ); clockSequence.updateAndGet( l -> l & 0x1FFFL );
} }
} }
finally { finally {