sanpwc commented on code in PR #1436:
URL: https://github.com/apache/ignite-3/pull/1436#discussion_r1050732738
##########
modules/distribution-zones/src/main/java/org/apache/ignite/internal/distributionzones/DistributionZoneManager.java:
##########
@@ -294,11 +330,9 @@ private void updateMetaStorageOnZoneCreate(int zoneId,
long revision) {
// so we do not react on a stale events
CompoundCondition triggerKeyCondition =
triggerKeyCondition(revision);
- Set<String> nodesConsistentIds =
clusterNodes.stream().map(ClusterNode::name).collect(Collectors.toSet());
-
- byte[] logicalTopologyBytes =
ByteUtils.toBytes(nodesConsistentIds);
+ Set<String> nodesConsistentIds =
logicalTopology.stream().map(ClusterNode::name).collect(Collectors.toSet());
Review Comment:
Let's either add an assert that we don't expect empty logicalToplogy or add
the corresponding check.
##########
modules/distribution-zones/src/main/java/org/apache/ignite/internal/distributionzones/DistributionZoneManager.java:
##########
@@ -74,21 +82,45 @@ public class DistributionZoneManager implements
IgniteComponent {
/** Busy lock to stop synchronously. */
private final IgniteSpinBusyLock busyLock = new IgniteSpinBusyLock();
+ /** Logical topology service to track topology changes. */
+ private final LogicalTopologyService logicalTopologyService;
+
+ /** Listener for a topology events. */
+ private final LogicalTopologyEventListener topologyEventListener = new
LogicalTopologyEventListener() {
+ @Override
+ public void onAppeared(ClusterNode appearedNode,
LogicalTopologySnapshot newTopology) {
+ updateMetaStorageKeys(newTopology, false);
Review Comment:
Confusing naming, I'd rather use updateLogicalTopologyInMetaStorage.
##########
modules/distribution-zones/src/main/java/org/apache/ignite/internal/distributionzones/DistributionZoneManager.java:
##########
@@ -235,12 +267,16 @@ public CompletableFuture<Void> dropZone(String name) {
@Override
public void start() {
zonesConfiguration.distributionZones().listenElements(new
ZonesConfigurationListener());
+
+ logicalTopologyService.addEventListener(topologyEventListener);
+
+ initMetaStorageKeysOnStart();
}
/** {@inheritDoc} */
@Override
public void stop() throws Exception {
-
+ logicalTopologyService.removeEventListener(topologyEventListener);
Review Comment:
Busy locks are missing here and there.
--
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]