sashapolo commented on code in PR #5432:
URL: https://github.com/apache/ignite-3/pull/5432#discussion_r2002744045


##########
modules/partition-replicator/src/main/java/org/apache/ignite/internal/partition/replicator/raft/snapshot/PartitionSnapshotStorageFactory.java:
##########
@@ -120,30 +115,66 @@ public void removeMvPartition(int tableId) {
     private @Nullable SnapshotMeta createStartupSnapshotMeta() {
         // We must choose the minimum applied index for local recovery so that 
we don't skip the raft commands for the storage with the
         // lowest applied index and thus no data loss occurs.
-        return partitionsByTableId.values().stream()
-                .min(comparingLong(PartitionMvStorageAccess::lastAppliedIndex))
-                .map(storageWithMinLastAppliedIndex -> {
-                    long minLastAppliedIndex = 
min(storageWithMinLastAppliedIndex.lastAppliedIndex(), 
txStateStorage.lastAppliedIndex());
-
-                    if (minLastAppliedIndex == 0) {
-                        return null;
-                    }
-
-                    int lastCatalogVersionAtStart = 
catalogService.latestCatalogVersion();
-
-                    return snapshotMetaAt(
-                            minLastAppliedIndex,
-                            
min(storageWithMinLastAppliedIndex.lastAppliedTerm(), 
txStateStorage.lastAppliedTerm()),
-                            
Objects.requireNonNull(storageWithMinLastAppliedIndex.committedGroupConfiguration()),
-                            lastCatalogVersionAtStart,
-                            
collectNextRowIdToBuildIndexesAtStart(lastCatalogVersionAtStart),
-                            storageWithMinLastAppliedIndex.leaseInfo()
-                    );
-                })
-                .orElse(null);
+        PartitionMvStorageAccess storageWithMinLastAppliedIndex = null;
+
+        long minLastAppliedIndex = Long.MAX_VALUE;
+
+        for (PartitionMvStorageAccess partitionStorage : 
partitionsByTableId.values()) {
+            long lastAppliedIndex = partitionStorage.lastAppliedIndex();
+
+            assert lastAppliedIndex >= 0 : lastAppliedIndex;

Review Comment:
   It already has a relevant message, how can it be improved? I can add 
something like "unexpected applied index", but what's the point?



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to