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


##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/schemasync/ItSchemaSyncConfigTest.java:
##########
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.schemasync;
+
+import static 
org.apache.ignite.internal.testframework.asserts.CompletableFutureAssert.assertWillThrowFast;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.containsString;
+import static org.hamcrest.Matchers.instanceOf;
+import static org.hamcrest.Matchers.is;
+
+import org.apache.ignite.configuration.ConfigurationChangeException;
+import 
org.apache.ignite.configuration.validation.ConfigurationValidationException;
+import org.apache.ignite.internal.ClusterPerClassIntegrationTest;
+import org.apache.ignite.internal.app.IgniteImpl;
+import 
org.apache.ignite.internal.catalog.configuration.SchemaSynchronizationConfiguration;
+import org.junit.jupiter.api.Test;
+
+@SuppressWarnings("resource")
+class ItSchemaSyncConfigTest extends ClusterPerClassIntegrationTest {

Review Comment:
   I think the test class is redundant, the configuration framework should test 
this behavior and there is no need to double-check it in other modules.



##########
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:
   As a suggestion, we could add a constructor that would accept an error 
message pattern and varags, inside use 
`org.apache.ignite.internal.lang.IgniteStringFormatter#format`.



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