Cyrill commented on code in PR #4847: URL: https://github.com/apache/ignite-3/pull/4847#discussion_r1883483906
########## modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java: ########## @@ -1065,53 +1067,71 @@ private CompletableFuture<?> onTableRename(RenameTableEventParameters parameters /** * Updates or creates partition raft groups and storages. * - * @param assignmentsFuture Table assignments. + * @param stableAssignmentsFuture Table assignments. * @param table Initialized table entity. - * @param zoneId Zone id. * @param isRecovery {@code true} if the node is being started up. * @param assignmentsTimestamp Assignments timestamp. * @return future, which will be completed when the partitions creations done. */ private CompletableFuture<Void> startLocalPartitionsAndClients( - CompletableFuture<List<Assignments>> assignmentsFuture, + CompletableFuture<List<Assignments>> stableAssignmentsFuture, + List<@Nullable Assignments> pendingAssignmentsForPartitions, TableImpl table, - int zoneId, boolean isRecovery, long assignmentsTimestamp ) { int tableId = table.tableId(); // Create new raft nodes according to new assignments. - return assignmentsFuture.thenCompose(tableAssignments -> { + return stableAssignmentsFuture.thenCompose(stableAssignmentsForPartitions -> { // Empty assignments might be a valid case if tables are created from within cluster init HOCON // configuration, which is not supported now. - assert tableAssignments != null : IgniteStringFormatter.format("Table [id={}] has empty assignments.", tableId); + assert stableAssignmentsForPartitions != null + : IgniteStringFormatter.format("Table [id={}] has empty assignments.", tableId); - int partitions = tableAssignments.size(); + int partitions = stableAssignmentsForPartitions.size(); var futures = new CompletableFuture<?>[partitions]; for (int i = 0; i < partitions; i++) { int partId = i; - Assignments assignments = tableAssignments.get(i); + Assignments stableAssignments = stableAssignmentsForPartitions.get(i); - CompletableFuture<?> future = startPartitionAndStartClient( - table, - partId, - localMemberAssignment(assignments), - assignments, - zoneId, - isRecovery, - assignmentsTimestamp - ) - .whenComplete((res, ex) -> { - if (ex != null) { - LOG.warn("Unable to update raft groups on the node [tableId={}, partitionId={}]", ex, tableId, partId); - } - }); + Assignments pendingAssignments = pendingAssignmentsForPartitions.get(i); + + Assignment localMemberAssignmentInStable = localMemberAssignment(stableAssignments); - futures[i] = future; + 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`, Review Comment: Correct -- 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