dimas-b commented on code in PR #3352:
URL: https://github.com/apache/polaris/pull/3352#discussion_r2663070012
##########
persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/JdbcBasePersistenceImpl.java:
##########
@@ -137,6 +139,14 @@ public void writeEntities(
@Nonnull PolarisCallContext callCtx,
@Nonnull List<PolarisBaseEntity> entities,
List<PolarisBaseEntity> originalEntities) {
+ Set<Long> seenEntityIds = new HashSet<>();
+ for (PolarisBaseEntity entity : entities) {
+ if (!seenEntityIds.add(entity.getId())) {
+ throw new RetryOnConcurrencyException(
+ "Multiple updates to entity id '%s' in the same transaction",
entity.getId());
+ }
+ }
Review Comment:
TBH, that looks like a bug in the `commitTransaction()` impl. :sweat_smile:
+1 to grouping changes by table (ID) and writing in one batch.... However,
it might be best to make that fix before introducing CockroachDB... just for
the sake of clarity.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]