Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bit-reversed sequences cannot be used with the emulator #983

Closed
olavloite opened this issue Mar 28, 2024 · 0 comments · Fixed by #984
Closed

Bit-reversed sequences cannot be used with the emulator #983

olavloite opened this issue Mar 28, 2024 · 0 comments · Fixed by #984

Comments

@olavloite
Copy link
Contributor

Using bit-reversed sequences with the emulator results in a Internal transaction retry aborted and max number of retry attempts has been exceeded error. This happens because Hibernate starts a new read/write transaction when it fetches new identifier values from the sequence.

olavloite added a commit that referenced this issue Mar 28, 2024
Bit-reversed sequences require the use of a read/write transaction.
Hibernate starts a second read/write transaction when it needs to
fetch new identifiers, and this transaction is aborted when it is
running on the emulator. The PooledBitReversedSequenceGenerator
now solves this by rolling back that transaction after getting the
sequence values. This is semantically equivalent to committing the
transaction, as the state of the sequence is durably changed
regardless whether the transaction is committed or rolled back.

Fixes #983
olavloite added a commit that referenced this issue Mar 28, 2024
* fix: JSON column DDL was generated as STRING

* feat: support bit-reversed sequences on the emulator

Bit-reversed sequences require the use of a read/write transaction.
Hibernate starts a second read/write transaction when it needs to
fetch new identifiers, and this transaction is aborted when it is
running on the emulator. The PooledBitReversedSequenceGenerator
now solves this by rolling back that transaction after getting the
sequence values. This is semantically equivalent to committing the
transaction, as the state of the sequence is durably changed
regardless whether the transaction is committed or rolled back.

Fixes #983

* test: use JSON null values as well
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant