rpuch commented on code in PR #5584: URL: https://github.com/apache/ignite-3/pull/5584#discussion_r2046987614
########## modules/table/src/main/java/org/apache/ignite/internal/table/distributed/disaster/GroupUpdateRequest.java: ########## @@ -143,363 +102,48 @@ public boolean manualUpdate() { return manualUpdate; } - @Override - public CompletableFuture<Void> handle(DisasterRecoveryManager disasterRecoveryManager, long msRevision, HybridTimestamp msTimestamp) { - int catalogVersion = disasterRecoveryManager.catalogManager.activeCatalogVersion(msTimestamp.longValue()); - - if (this.catalogVersion != catalogVersion) { - return failedFuture( - new DisasterRecoveryException(CLUSTER_NOT_IDLE_ERR, "Cluster is not idle, concurrent DDL update detected.") - ); - } - - Catalog catalog = disasterRecoveryManager.catalogManager.catalog(catalogVersion); - - CatalogZoneDescriptor zoneDescriptor = catalog.zone(zoneId); - - Set<Integer> allZonePartitionsToReset = new HashSet<>(); - partitionIds.values().forEach(allZonePartitionsToReset::addAll); - - CompletableFuture<Map<TablePartitionId, LocalPartitionStateMessageByNode>> localStates = disasterRecoveryManager - .localPartitionStatesInternal( - Set.of(zoneDescriptor.name()), - emptySet(), - allZonePartitionsToReset, - catalog, - tableState() - ); - - CompletableFuture<Set<String>> dataNodesFuture = disasterRecoveryManager.dzManager.dataNodes(msTimestamp, catalogVersion, zoneId); - - return dataNodesFuture.thenCombine(localStates, (dataNodes, localStatesMap) -> { - Set<String> nodeConsistentIds = disasterRecoveryManager.dzManager.logicalTopology(msRevision) - .stream() - .map(NodeWithAttributes::nodeName) - .collect(toSet()); - - List<CompletableFuture<Void>> tableFuts = new ArrayList<>(partitionIds.size()); - - for (Entry<Integer, Set<Integer>> tablePartitionEntry : partitionIds.entrySet()) { - - int[] partitionIdsArray = AssignmentUtil.partitionIds(tablePartitionEntry.getValue(), zoneDescriptor.partitions()); - - tableFuts.add(forceAssignmentsUpdate( - tablePartitionEntry.getKey(), - zoneDescriptor, - dataNodes, - nodeConsistentIds, - msRevision, - msTimestamp, - disasterRecoveryManager.metaStorageManager, - localStatesMap, - catalog.time(), - partitionIdsArray, - manualUpdate - )); - } - - return allOf(tableFuts.toArray(new CompletableFuture[]{})); - }) - .thenCompose(Function.identity()) - .whenComplete((unused, throwable) -> { - // TODO: IGNITE-23635 Add fail handling for failed resetPeers - if (throwable != null) { - LOG.error("Failed to reset partition", throwable); - } - }); - } - /** - * Sets force assignments for the zone/table if it's required. The condition for force reassignment is the absence of stable - * assignments' majority within the set of currently alive nodes. In this case we calculate new assignments that include all alive - * stable nodes, and try to save ot with a {@link Assignments#force()} flag enabled. - * - * @param tableId Table id. - * @param zoneDescriptor Zone descriptor. - * @param dataNodes Current DZ data nodes. - * @param aliveNodesConsistentIds Set of alive nodes according to logical topology. - * @param revision Meta-storage revision to be associated with reassignment. - * @param timestamp Meta-storage timestamp to be associated with reassignment. - * @param metaStorageManager Meta-storage manager. - * @param localStatesMap Local partition states retrieved by - * {@link DisasterRecoveryManager#localTablePartitionStates(Set, Set, Set)}. - * @return A future that will be completed when reassignments data is written into a meta-storage, if that's required. + * Returns {@code true} if this request is a zone request with enabled colocation and {@code false} if this is a table request with + * colocation disabled. */ - private static CompletableFuture<Void> forceAssignmentsUpdate( - int tableId, - CatalogZoneDescriptor zoneDescriptor, - Set<String> dataNodes, - Set<String> aliveNodesConsistentIds, - long revision, - HybridTimestamp timestamp, - MetaStorageManager metaStorageManager, - Map<TablePartitionId, LocalPartitionStateMessageByNode> localStatesMap, - long assignmentsTimestamp, - int[] partitionIds, - boolean manualUpdate - ) { - return tableStableAssignments(metaStorageManager, tableId, partitionIds) - .thenCompose(tableAssignments -> { - if (tableAssignments.isEmpty()) { - return nullCompletedFuture(); - } - - return updateAssignments( - tableId, - zoneDescriptor, - dataNodes, - aliveNodesConsistentIds, - revision, - timestamp, - metaStorageManager, - localStatesMap, - assignmentsTimestamp, - partitionIds, - tableAssignments, - manualUpdate - ); - }); + boolean colocationEnabled() { Review Comment: This looks like a breaking change from AI 3.0. How are we going to fix this to make sure 3.1 is backwards compatible? Maybe we should make the colocation flag explicit and add new serialization format version. This is some additional code, but the flag will be explicit and no backwards compatibility will be immediately broken -- 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