kgusakov commented on code in PR #2070:
URL: https://github.com/apache/ignite-3/pull/2070#discussion_r1211488537


##########
modules/distribution-zones/src/main/java/org/apache/ignite/internal/distributionzones/rebalance/DistributionZoneRebalanceEngine.java:
##########
@@ -187,39 +187,47 @@ public CompletableFuture<Void> onUpdate(WatchEvent evt) {
                         if (zoneId == tableZoneId) {
                             TableConfiguration tableCfg = 
tables.get(tableView.name());
 
-                            byte[] assignmentsBytes = 
((ExtendedTableConfiguration) tableCfg).assignments().value();
+                            int tableId = tableCfg.id().value();
 
-                            List<Set<Assignment>> tableAssignments = 
assignmentsBytes == null
-                                    ? Collections.emptyList()
-                                    : ByteUtils.fromBytes(assignmentsBytes);
+                            CompletableFuture<List<Set<Assignment>>> 
tableAssignmentsFut = tableAssignments(
+                                    metaStorageManager,
+                                    tableId, 
distributionZoneConfiguration.partitions().value());
 
-                            for (int part = 0; part < 
distributionZoneConfiguration.partitions().value(); part++) {
-                                int tableId = tableCfg.id().value();
+                            tableAssignmentsFut.thenAccept(tbls -> {
 
-                                TablePartitionId replicaGrpId = new 
TablePartitionId(tableId, part);
+                                for (int part = 0; part < 
distributionZoneConfiguration.partitions().value(); part++) {
 
-                                int replicas = 
distributionZoneConfiguration.replicas().value();
+                                    TablePartitionId replicaGrpId = new 
TablePartitionId(tableId, part);
 
-                                int partId = part;
+                                    int replicas = 
distributionZoneConfiguration.replicas().value();
 
-                                updatePendingAssignmentsKeys(
-                                        tableView.name(),
-                                        replicaGrpId,
-                                        filteredDataNodes,
-                                        replicas,
-                                        evt.entryEvent().newEntry().revision(),
-                                        metaStorageManager,
-                                        part,
-                                        tableAssignments.isEmpty() ? 
Collections.emptySet() : tableAssignments.get(part)
-                                ).exceptionally(e -> {
-                                    LOG.error(
-                                            "Exception on updating assignments 
for [table={}, partition={}]", e, tableView.name(),
-                                            partId
-                                    );
-
-                                    return null;
-                                });
-                            }
+                                    int partId = part;
+
+                                    updatePendingAssignmentsKeys(
+                                            tableView.name(),
+                                            replicaGrpId,
+                                            filteredDataNodes,
+                                            replicas,
+                                            
evt.entryEvent().newEntry().revision(),
+                                            metaStorageManager,
+                                            partId,
+                                            tbls.isEmpty() ? 
Collections.emptySet() : tbls.get(partId)

Review Comment:
   Just a note - this code was here before my PR.
   But anyway, at the moment, we have no places where we can drop 1 partition 
assignment:
   - we have an atomic invoke, which will write all assignments or nothing
   - rebalance logic can change the stable partition for 1 partition, but not 
removing it
   



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to