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


##########
modules/partition-replicator/src/main/java/org/apache/ignite/internal/partition/replicator/schema/CatalogValidationSchemasSource.java:
##########
@@ -84,52 +86,80 @@ public List<FullTableSchema> tableSchemaVersionsBetween(int 
tableId, HybridTimes
 
     private List<FullTableSchema> 
tableSchemaVersionsBetweenCatalogVersions(int tableId, int fromCatalogVersion, 
int toCatalogVersion) {
         return tableVersionsBetween(tableId, fromCatalogVersion, 
toCatalogVersion)
-                
.map(CatalogValidationSchemasSource::fullSchemaFromTableDescriptor)
-                .collect(toList());
-    }
-
-    // It's ok to use Stream as the results of the methods that call this are 
cached.
-    private Stream<CatalogTableDescriptor> tableVersionsBetween(
-            int tableId,
-            int fromCatalogVersionIncluding,
-            int toCatalogVersionIncluding
-    ) {
-        return IntStream.rangeClosed(fromCatalogVersionIncluding, 
toCatalogVersionIncluding)
-                .mapToObj(catalogVersion -> 
catalogService.catalog(catalogVersion).table(tableId))
-                .takeWhile(Objects::nonNull)
+                .map(entry -> fullSchemaFromCatalog(entry.getKey(), 
entry.getValue()))
                 .filter(new Predicate<>() {
-                    int prevVersion = Integer.MIN_VALUE;
+                    FullTableSchema prevSchema = null;
 
                     @Override
-                    public boolean test(CatalogTableDescriptor 
tableDescriptor) {
-                        if (tableDescriptor.latestSchemaVersion() == 
prevVersion) {
+                    public boolean test(FullTableSchema tableSchema) {
+                        if (prevSchema != null && 
!tableSchema.hasValidatableChangeFrom(prevSchema)) {
                             return false;
                         }
 
-                        assert prevVersion == Integer.MIN_VALUE || 
tableDescriptor.latestSchemaVersion() == prevVersion + 1
-                                : String.format("Table version is expected to 
be prevVersion+1, but version is %d and prevVersion is %d",
-                                        tableDescriptor.latestSchemaVersion(), 
prevVersion);
-
-                        prevVersion = tableDescriptor.latestSchemaVersion();
+                        prevSchema = tableSchema;
 
                         return true;
                     }
-                });
+                })
+                .collect(toList());
     }
 
     private List<FullTableSchema> 
tableSchemaVersionsBetweenCatalogAndTableVersions(
             int tableId,
             int fromCatalogVersion,
             int toTableVersion
     ) {
+        Predicate<CatalogTableDescriptor> tableDescriptorFilter = new 
Predicate<>() {

Review Comment:
   It is to filter out descriptors that 'do not differ sufficiently' from the 
previous ones



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