alievmirza commented on code in PR #1391:
URL: https://github.com/apache/ignite-3/pull/1391#discussion_r1043157578
##########
modules/distribution-zones/src/main/java/org/apache/ignite/internal/distributionzones/DistributionZoneManager.java:
##########
@@ -197,12 +235,114 @@ public CompletableFuture<Void> dropZone(String name) {
/** {@inheritDoc} */
@Override
public void start() {
-
+ zonesConfiguration.distributionZones().listenElements(new
ZonesConfigurationListener());
}
/** {@inheritDoc} */
@Override
public void stop() throws Exception {
}
+
+ private class ZonesConfigurationListener implements
ConfigurationNamedListListener<DistributionZoneView> {
+ @Override
+ public CompletableFuture<?>
onCreate(ConfigurationNotificationEvent<DistributionZoneView> ctx) {
+ updateMetaStorageOnZoneCreateOrUpdate(ctx.newValue().zoneId(),
ctx.storageRevision());
+
+ return completedFuture(null);
+ }
+
+ @Override
+ public CompletableFuture<?>
onDelete(ConfigurationNotificationEvent<DistributionZoneView> ctx) {
+ updateMetaStorageOnZoneDelete(ctx.oldValue().zoneId(),
ctx.storageRevision());
+
+ return completedFuture(null);
+ }
+
+ @Override
+ public CompletableFuture<?>
onUpdate(ConfigurationNotificationEvent<DistributionZoneView> ctx) {
+ updateMetaStorageOnZoneCreateOrUpdate(ctx.newValue().zoneId(),
ctx.storageRevision());
Review Comment:
As far as I can understand, if we get here, that means that any of
`dataNodesAutoAdjust()`, `dataNodesAutoAdjustScaleUp()`,
`dataNodesAutoAdjustScaleDown()` has been changed, so there is no "other
cases". Case with renaming will be handled by separate handler `onRename`
##########
modules/distribution-zones/src/main/java/org/apache/ignite/internal/distributionzones/DistributionZoneManager.java:
##########
@@ -197,12 +235,114 @@ public CompletableFuture<Void> dropZone(String name) {
/** {@inheritDoc} */
@Override
public void start() {
-
+ zonesConfiguration.distributionZones().listenElements(new
ZonesConfigurationListener());
}
/** {@inheritDoc} */
@Override
public void stop() throws Exception {
}
+
+ private class ZonesConfigurationListener implements
ConfigurationNamedListListener<DistributionZoneView> {
+ @Override
+ public CompletableFuture<?>
onCreate(ConfigurationNotificationEvent<DistributionZoneView> ctx) {
+ updateMetaStorageOnZoneCreateOrUpdate(ctx.newValue().zoneId(),
ctx.storageRevision());
+
+ return completedFuture(null);
+ }
+
+ @Override
+ public CompletableFuture<?>
onDelete(ConfigurationNotificationEvent<DistributionZoneView> ctx) {
+ updateMetaStorageOnZoneDelete(ctx.oldValue().zoneId(),
ctx.storageRevision());
+
+ return completedFuture(null);
+ }
+
+ @Override
+ public CompletableFuture<?>
onUpdate(ConfigurationNotificationEvent<DistributionZoneView> ctx) {
+ updateMetaStorageOnZoneCreateOrUpdate(ctx.newValue().zoneId(),
ctx.storageRevision());
Review Comment:
As far as I can understand, if we get here, that means that any of
`dataNodesAutoAdjust()`, `dataNodesAutoAdjustScaleUp()`,
`dataNodesAutoAdjustScaleDown()` has been changed, so there is no "other
cases". Case with the renaming will be handled by separate handler `onRename`
--
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]