-
Notifications
You must be signed in to change notification settings - Fork 3k
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
fix(version): forUpdate needed for versioning #11328
fix(version): forUpdate needed for versioning #11328
Conversation
* forUpdate is required for a read lock whenever calculating a version
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Hi @david-leifker, I just noticed that when you are using a PostgreSQL database the changes in EbeanAspectDao.java regarding the forUpdate are causing a NullPointerException when starting the GMS now:
I have reproduced this on a local build on https://github.com/datahub-project/datahub/tree/837d00d391a9f3c6d79cbed9969fe4003e36f580. I am not sure whether this is caused by a bug in the Ebean ORM library or if there must be changed something else regarding the forUpdate in EbeanAspectDao...what I was able to find out is that the PostgresPlatform seems to be using the lockType (which is null) in withForUpdate resp. lock, while the BaseMySqlPlatform (parent of MySqlPlatform) is ignoring the parameter (therefore it does not matter that the lockType is null): Maybe you could check this? 😊 |
Hi @david-leifker, after digging a bit deeper I found this comment in the copy method in DefaultOrmQuery of the Ebean ORM library: https://github.com/ebean-orm/ebean/blob/edbd13c0754ed23fc8e4958a1f43dbc76c09026a/ebean-core/src/main/java/io/ebeaninternal/server/querydefn/DefaultOrmQuery.java#L746 The copy method of DefaultOrmQuery is called when findIds resp. findIdsWithCopy is called in DefaultServer - see also here:
Although I do not fully understand the backgrounds, the mentioned issue sounds like forUpdate is incorrectly used in context of getNextVersions resp. in relation to findIds? Is it possible that forUpdate is also incorrectly used in getLatestAspects and in relation to findList (although it seems in relation to findList no copy of the query is created...)? Maybe this helps you a bit? |
@Masterchen09 - I will find a resolution here and get a PR up to fix it. This has proven effective in solving a production issue with mysql for us. Hopefully we can find a solution that will for both. |
The exception seems to be resolved by updating the ebean library see -> #11379 |
Checklist