-
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(ebean): upgrade ebean library #11379
fix(ebean): upgrade ebean library #11379
Conversation
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 (
|
5f2f77e
to
3695406
Compare
3695406
to
a05de80
Compare
I have thought about the issue with the NPE: The update solves the NPE, but after the update the forUpdate statement will not work anymore for MySQL - as the query is copied when the findIds method is used, the forUpdate field will not be copied after the update, this will not cause any exception, the forUpdate will simply do nothing because the copy of the query is used. To have the forUpdate in the getNextVersions method the findIds method should probably not be used...I am not sure but using the following should be somehow equivalent to findIds: List<EbeanAspectV2.PrimaryKey> dbResults = exp.endOr().select("urn, aspect, version").forUpdate().findSingleAttributeList(); The findIds will call buildFetchIdsQuery in CQueryBuilder which overwrite the select in line 800 with the key of the table, which is the urn, aspect and version column...i.e. the select in line 800 is already obsolete (we cannot simply use the existing select in line 800 because the forUpdate does not work with the resulting group by query... public Map<String, Map<String, Long>> getNextVersions(
@Nonnull Map<String, Set<String>> urnAspects) {
validateConnection();
Junction<EbeanAspectV2> queryJunction =
_server
.find(EbeanAspectV2.class)
.select("urn, aspect, version")
.where()
.in("urn", urnAspects.keySet())
.or();
ExpressionList<EbeanAspectV2> exp = null;
for (Map.Entry<String, Set<String>> entry : urnAspects.entrySet()) {
if (exp == null) {
exp = queryJunction.and().eq("urn", entry.getKey()).in("aspect", entry.getValue()).endAnd();
} else {
exp = exp.and().eq("urn", entry.getKey()).in("aspect", entry.getValue()).endAnd();
}
}
Map<String, Map<String, Long>> result = new HashMap<>();
// Default next version 0
urnAspects.forEach(
(key, value) -> {
Map<String, Long> defaultNextVersion = new HashMap<>();
value.forEach(aspectName -> defaultNextVersion.put(aspectName, 0L));
result.put(key, defaultNextVersion);
});
if (exp == null) {
return result;
}
// forUpdate is required to avoid duplicate key violations
List<EbeanAspectV2.PrimaryKey> dbResults = exp.endOr().forUpdate().findSingleAttributeList();
for (EbeanAspectV2.PrimaryKey key : dbResults) {
if (result.get(key.getUrn()).get(key.getAspect()) <= key.getVersion()) {
result.get(key.getUrn()).put(key.getAspect(), key.getVersion() + 1L);
}
}
return result;
} |
@Masterchen09 - Excellent feedback! I will have this addressed and I will implement some tests to ensure the expected behavior. |
a05de80
to
1001717
Compare
fixes read lock for postgres
1001717
to
1cbbe45
Compare
Upgrade ebean library from 12.x to 15.x
Fixes read lock NPE for postgres
Update gradle configuration for ebean
Checklist