alievmirza commented on code in PR #5012: URL: https://github.com/apache/ignite-3/pull/5012#discussion_r1910195241
########## modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java: ########## @@ -1161,13 +1165,21 @@ private CompletableFuture<Void> startLocalPartitionsAndClients( boolean shouldStartPartition; if (isRecovery) { - // The condition to start the replica is - // `pending.contains(node) || (stable.contains(node) && !pending.isForce())`. - // However we check only the right part of this condition here - // since after `startTables` we have a call to `processAssignmentsOnRecovery`, - // which executes pending assignments update and will start required partitions there. - shouldStartPartition = localMemberAssignmentInStable != null - && (pendingAssignments == null || !pendingAssignments.force()); + AssignmentsChain assignmentsChain = assignmentsChains.get(i); + + if (assignmentsChain == null || assignmentsChain.chain().size() == 1) { Review Comment: Let's add comment describing why `assignmentsChain.chain().size() == 1` is a special case and why we have different behaviour instead ########## modules/distribution-zones/src/main/java/org/apache/ignite/internal/distributionzones/rebalance/RebalanceUtil.java: ########## @@ -620,6 +621,24 @@ public static CompletableFuture<Set<Assignment>> partitionAssignments( .thenApply(e -> (e.value() == null) ? null : Assignments.fromBytes(e.value()).nodes()); } + /** + * Returns partition assignments from meta storage locally. + * + * @param metaStorageManager Meta storage manager. + * @param tablePartitionId Table partition id. + * @param revision Revision. + * @return Returns partition assignments from meta storage locally or {@code null} if assignments is absent. + */ + public static @Nullable Assignments stableAssignments( Review Comment: Let's name it with "Locally" suffix, or rename `tableAssignmentsChainGetLocally`. Let's have common naming pattern for "get locally" methods ########## modules/distribution-zones/src/main/java/org/apache/ignite/internal/distributionzones/rebalance/RebalanceUtil.java: ########## @@ -718,4 +737,42 @@ public static List<Assignments> tablePendingAssignmentsGetLocally( }) .collect(toList()); } + + /** + * Returns assignments chains for all table partitions from meta storage locally. + * + * @param metaStorageManager Meta storage manager. + * @param tableId Table id. + * @param numberOfPartitions Number of partitions. + * @param revision Revision. + * @return Future with table assignments as a value. + */ + public static List<AssignmentsChain> tableAssignmentsChainGetLocally( Review Comment: Or let's remove locally suffix from here ########## modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java: ########## @@ -1161,13 +1165,21 @@ private CompletableFuture<Void> startLocalPartitionsAndClients( boolean shouldStartPartition; if (isRecovery) { - // The condition to start the replica is - // `pending.contains(node) || (stable.contains(node) && !pending.isForce())`. - // However we check only the right part of this condition here - // since after `startTables` we have a call to `processAssignmentsOnRecovery`, - // which executes pending assignments update and will start required partitions there. - shouldStartPartition = localMemberAssignmentInStable != null - && (pendingAssignments == null || !pendingAssignments.force()); + AssignmentsChain assignmentsChain = assignmentsChains.get(i); + + if (assignmentsChain == null || assignmentsChain.chain().size() == 1) { Review Comment: I would refactor this check to a separate method so we could reuse this method in the second place -- 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