HHH-18818 Fix ID conflicts between CTE batch inserts and optimizer strategies#9232
HHH-18818 Fix ID conflicts between CTE batch inserts and optimizer strategies#9232stringintech wants to merge 1 commit intohibernate:mainfrom
Conversation
27b4751 to
7d7ac39
Compare
|
Thanks a lot for the test and fix. I just now realized that other optimizer strategies might also run into this problem. Would you be willing to implement that and also add tests for the other optimizers? Expression createLowValueExpression(Expression databaseValue, SessionFactoryImplementor sessionFactory); |
|
@beikov Thanks for the feedback. I'd be happy to do it. I'll go over the different optimizer strategies, and I'll reach out if I have any questions during implementation. |
7d7ac39 to
7c7114f
Compare
|
@beikov I've implemented the requested |
7c7114f to
8623656
Compare
|
Hey @beikov, it seems this is waiting for your feedback? |
|
Thanks a lot for the work @stringintech and sorry it took so long for me to work on this. I created #10650 now which is a rebased version of your PR with some small cosmetic fixes. Going to close this PR in favor of the other and push that through the finish line. |
|
You're welcome @beikov. |
This PR resolves an ID conflict in Hibernate's
CteInsertHandlerbatch insert implementation when using sequence-based ID generation with thePooledOptimizer. The issue arises from a misalignment between the batch insert ID generation strategy and thePooledOptimizerstrategy, which can lead to ID conflicts.The fix ensures that
CteInsertHandlercorrectly integrates with thePooledOptimizer's ID allocation strategy by properly handling the next database-generated sequence value as the "hi" value, thereby maintaining consistent ID allocation across all insert operations.A unit test (
CteInsertStrategyWithPooledOptimizerTest) is included to validate the fix.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.
https://hibernate.atlassian.net/browse/HHH-18818