[ https://issues.apache.org/jira/browse/IGNITE-20199?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mirza Aliev updated IGNITE-20199: --------------------------------- Description: Seems that the current logic in {{DistributionZoneRebalanceEngine#onUpdateReplicas}} is not correct in terms of futures chaining. Currently we block configuration notification thread until all partitions would updates theirs rebalance assignments keys in metastorage. {code:java} private CompletableFuture<?> onUpdateReplicas(ConfigurationNotificationEvent<Integer> replicasCtx) { ... ... return distributionZoneManager.dataNodes(replicasCtx.storageRevision(), zoneCfg.zoneId()) .thenCompose(dataNodes -> { ... for (TableView tableCfg : tableViews) { ... CompletableFuture<?>[] partitionFutures = RebalanceUtil.triggerAllTablePartitionsRebalance(...); tableFutures.add(allOf(partitionFutures)); } return allOf(tableFutures.toArray(CompletableFuture[]::new)); }); ... } {code} As a solution, we could just return completed future in the {{DistributionZoneRebalanceEngine#onUpdateReplicas}} after we started asynchronous logic of updating rebalance assignmnets. was: After IGNITE-19506 was merged, it added the regression. Previously we haven't returned future, that updates rebalance pending keys, in {{{}DistributionZoneRebalanceEngine#onUpdateReplicas{}}}. It was done because otherwise we would block configuration notification thread until all partitions would updates theirs rebalance assignments keys in metastorage. Unfortunately, IGNITE-19506 has brought this blockage {code:java} private CompletableFuture<?> onUpdateReplicas(ConfigurationNotificationEvent<Integer> replicasCtx) { ... ... return distributionZoneManager.dataNodes(replicasCtx.storageRevision(), zoneCfg.zoneId()) .thenCompose(dataNodes -> { ... for (TableView tableCfg : tableViews) { ... CompletableFuture<?>[] partitionFutures = RebalanceUtil.triggerAllTablePartitionsRebalance(...); tableFutures.add(allOf(partitionFutures)); } return allOf(tableFutures.toArray(CompletableFuture[]::new)); }); ... } {code} > Do not chain updating rebalance assignments future in > DistributionZoneRebalanceEngine#onUpdateReplicas > ------------------------------------------------------------------------------------------------------- > > Key: IGNITE-20199 > URL: https://issues.apache.org/jira/browse/IGNITE-20199 > Project: Ignite > Issue Type: Bug > Reporter: Mirza Aliev > Priority: Major > Labels: ignite-3 > > Seems that the current logic in > {{DistributionZoneRebalanceEngine#onUpdateReplicas}} is not correct in terms > of futures chaining. Currently we block configuration notification thread > until all partitions would updates theirs rebalance assignments keys in > metastorage. > > {code:java} > private CompletableFuture<?> > onUpdateReplicas(ConfigurationNotificationEvent<Integer> replicasCtx) { > ... > ... > return > distributionZoneManager.dataNodes(replicasCtx.storageRevision(), > zoneCfg.zoneId()) > .thenCompose(dataNodes -> { > ... > for (TableView tableCfg : tableViews) { > ... > CompletableFuture<?>[] partitionFutures = > RebalanceUtil.triggerAllTablePartitionsRebalance(...); > tableFutures.add(allOf(partitionFutures)); > } > return > allOf(tableFutures.toArray(CompletableFuture[]::new)); > }); > ... > } {code} > As a solution, we could just return completed future in the > {{DistributionZoneRebalanceEngine#onUpdateReplicas}} after we started > asynchronous logic of updating rebalance assignmnets. -- This message was sent by Atlassian Jira (v8.20.10#820010)