Skip to content

Lock-free TransactionIdCounter implementation and overflow fix#51

Open
khresth wants to merge 1 commit intoesa:masterfrom
khresth:master
Open

Lock-free TransactionIdCounter implementation and overflow fix#51
khresth wants to merge 1 commit intoesa:masterfrom
khresth:master

Conversation

@khresth
Copy link

@khresth khresth commented Feb 3, 2026

Replaced synchronized lock with lock-free CAS implementation in TransactionIdCounter to reduce contention. Fixed overflow bug.

Changes

  • Lock-free implementation using CAS loop with single AtomicLong
  • Fixed overflow bug: now returns recalculatePartAB() + 1 instead of partAB + 0
  • Added comprehensive unit tests (4 tests, all passing)

Testing

All new unit tests pass, including concurrent access test (16 threads × 500 IDs).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant