tkalkirill commented on code in PR #2415:
URL: https://github.com/apache/ignite-3/pull/2415#discussion_r1306357874
##########
modules/distribution-zones/src/main/java/org/apache/ignite/internal/distributionzones/DistributionZoneManager.java:
##########
@@ -1945,29 +1365,84 @@ public Set<NodeWithAttributes> logicalTopology() {
return logicalTopology;
}
- /**
- * Returns the distribution zone name from the configuration, {@code null}
if the zone is absent.
- *
- * @param configZoneId Distribution zone id from configuration.
- */
- // TODO: IGNITE-20114 Get rid of
- @Deprecated(forRemoval = true)
- public @Nullable String getZoneName(int configZoneId) {
- DistributionZonesView zonesView = zonesConfiguration.value();
-
- return Stream.concat(Stream.of(zonesView.defaultDistributionZone()),
zonesView.distributionZones().stream())
- .filter(zoneView -> zoneView.zoneId() == configZoneId)
- .map(DistributionZoneView::name)
- .findFirst()
- .orElse(null);
+ private void registerCatalogEventListenersOnStartManagerBusy() {
+ catalogManager.listen(ZONE_CREATE, (parameters, exception) ->
inBusyLock(busyLock, () -> {
+ assert exception == null : parameters;
+
+ CreateZoneEventParameters params = (CreateZoneEventParameters)
parameters;
+
+ createOrRestoreZoneStateBusy(params.zoneDescriptor(),
params.causalityToken());
+
+ return completedFuture(false);
+ }));
+
+ catalogManager.listen(ZONE_DROP, (parameters, exception) ->
inBusyLock(busyLock, () -> {
+ assert exception == null : parameters;
+
+ onDropZoneBusy((DropZoneEventParameters) parameters);
+
+ return completedFuture(false);
+ }));
+
+ catalogManager.listen(ZONE_ALTER, new
ManagerCatalogAlterZoneEventListener());
+ }
+
+ private void startZonesOnStartManagerBusy() {
+ CompletableFuture<Long> recoveryFinishedFuture =
metaStorageManager.recoveryFinishedFuture();
+
+ assert recoveryFinishedFuture.isDone();
+
+ int catalogVersion = catalogManager.latestCatalogVersion();
Review Comment:
Like manager `VaultManager`, `CatalogManager` starts before manager
`TableManager`/`IndexManager`/`DistributionZoneManager` and can be changed (not
immutable).
To avoid manager changes, you can do the following:
1. Slightly rework `IgniteComponent`, for managers that depend on the
catalog it will add the version of the catalog on which we made the recovery;
2. Add a `CatalogService#catalogVersionAfterRecovery` that will throw an
exception before recovery, and after that it will return an immutable value;
3. Make the `CatalogManager` immutable at the start phase of all other
components, and then make it mutable.
I like point 2 and 3.
It might be worth discussing this with @AMashenkov as well.
--
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]