rpuch commented on code in PR #3740:
URL: https://github.com/apache/ignite-3/pull/3740#discussion_r1598356603


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/replicator/PartitionReplicaListener.java:
##########
@@ -1013,22 +1013,27 @@ private CompletableFuture<List<BinaryRow>> 
retrieveExactEntriesUntilCursorEmpty(
             for (int i = 0; i < rows.size(); i++) {
                 BinaryRow row = rows.get(i);
 
-                futs[i] = 
schemaCompatValidator.validateBackwards(row.schemaVersion(), tableId(), txId)
-                        .thenCompose(validationResult -> {
-                            if (validationResult.isSuccessful()) {
-                                return completedFuture(row);
-                            } else {
-                                throw new 
IncompatibleSchemaException("Operation failed because schema "
-                                        + validationResult.fromSchemaVersion() 
+ " is not backward-compatible with "
-                                        + validationResult.toSchemaVersion() + 
" for table " + validationResult.failedTableId());
-                            }
-                        });
+                futs[i] = validateBackwardCompatibility(row, txId)
+                        .thenApply(unused -> row);
             }
 
             return allOf(futs).thenApply((unused) -> rows);
         });
     }
 
+    private CompletableFuture<Void> validateBackwardCompatibility(BinaryRow 
row, UUID txId) {
+        return schemaCompatValidator.validateBackwards(row.schemaVersion(), 
tableId(), txId)
+                .thenAccept(validationResult -> {
+                    if (!validationResult.isSuccessful()) {
+                        throw new IncompatibleSchemaException(String.format(

Review Comment:
   I'm not sure such a change makes the situation so much better. The code at 
the exception creation site becomes just a bit shorter, but the constructor 
becomes more complex and now has an additional responsability. I would prefer 
to leave it in its current state.



-- 
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]

Reply via email to