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


##########
modules/distribution-zones/src/main/java/org/apache/ignite/internal/distributionzones/rebalance/RebalanceRaftGroupEventsListener.java:
##########
@@ -276,31 +265,53 @@ private void 
scheduleChangePeersAndLearners(PeersAndLearners peersAndLearners, l
     private void doStableKeySwitch(
             Set<Assignment> stableFromRaft,
             TablePartitionId tablePartitionId,
-            MetaStorageManager metaStorageMgr,
             long configurationTerm,
             long configurationIndex,
             BiFunction<TablePartitionId, Long, 
CompletableFuture<Set<Assignment>>> calculateAssignmentsFn
     ) {
-        try {
-            ByteArray pendingPartAssignmentsKey = 
pendingPartAssignmentsQueueKey(tablePartitionId);
-            ByteArray stablePartAssignmentsKey = 
stablePartAssignmentsKey(tablePartitionId);
-            ByteArray plannedPartAssignmentsKey = 
plannedPartAssignmentsKey(tablePartitionId);
-            ByteArray switchReduceKey = switchReduceKey(tablePartitionId);
-            ByteArray switchAppendKey = switchAppendKey(tablePartitionId);
-            ByteArray assignmentsChainKey = 
assignmentsChainKey(tablePartitionId);
-
-            // TODO: https://issues.apache.org/jira/browse/IGNITE-17592 Remove 
synchronous wait
-            Map<ByteArray, Entry> values = metaStorageMgr.getAll(
-                    Set.of(
-                            plannedPartAssignmentsKey,
-                            pendingPartAssignmentsKey,
-                            stablePartAssignmentsKey,
-                            switchReduceKey,
-                            switchAppendKey,
-                            assignmentsChainKey
-                    )
-            ).get();
+        doStableKeySwitchImpl(
+                stableFromRaft,
+                tablePartitionId,
+                configurationTerm,
+                configurationIndex,
+                calculateAssignmentsFn
+        ).whenComplete((res, ex) -> {
+            // TODO: IGNITE-14693
+            if (ex != null && !hasCause(ex, NodeStoppingException.class)) {
+                if (hasCause(ex, TimeoutException.class)) {
+                    // TODO: 
https://issues.apache.org/jira/browse/IGNITE-25276 - handle this timeout 
properly.
+                    LOG.error("Unable to commit partition configuration to 
metastore: {}", ex, tablePartitionId);
+                } else {
+                    String errorMessage = String.format("Unable to commit 
partition configuration to metastore: %s", tablePartitionId);
+                    failureProcessor.process(new FailureContext(ex, 
errorMessage));
+                }
+            }
+        });
+    }
 
+    private CompletableFuture<Void> doStableKeySwitchImpl(
+            Set<Assignment> stableFromRaft,
+            TablePartitionId tablePartitionId,
+            long configurationTerm,
+            long configurationIndex,
+            BiFunction<TablePartitionId, Long, 
CompletableFuture<Set<Assignment>>> calculateAssignmentsFn
+    ) {
+        ByteArray pendingPartAssignmentsKey = 
pendingPartAssignmentsQueueKey(tablePartitionId);

Review Comment:
   Oh, I also extracted 2 methods: one for logging about a failed switch, 
another for logging about a successful switch



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