Skip to content

feat(counter): Implement global atomic counter for sequential ID generation#33

Merged
behinddwalls merged 1 commit into
mainfrom
sergeyb3
Feb 20, 2026
Merged

feat(counter): Implement global atomic counter for sequential ID generation#33
behinddwalls merged 1 commit into
mainfrom
sergeyb3

Conversation

@sbalabanov
Copy link
Copy Markdown
Contributor

Global atomic counter generates and stores the maximum value across dynamic categories. Used to generate sequential identifiers for entities. Backed by MySQL storage with atomic increment operations.
Switched Request entity implementation to use counter-based approach, eliminated the use of a (queue,seq) pair as a primary key.
It might happen that the counter value is globally incremented but the returned value is not used - for example, the server crashed straight after value retrieval. This might leave gaps in entity id sequence and is considered normal, as long as numbers are sequential.
This approach simplifies entity handling a lot, especially within the need to reference another entity.
Could be used to generate IDs for other entities as well, such as Batch or SpeculationPath.

@sbalabanov sbalabanov requested review from a team and behinddwalls as code owners February 20, 2026 07:46
Base automatically changed from sergeyb2 to main February 20, 2026 18:08
@behinddwalls behinddwalls merged commit 1176753 into main Feb 20, 2026
1 check passed
@behinddwalls behinddwalls deleted the sergeyb3 branch February 20, 2026 21:58
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.

3 participants