This is an automated email from the ASF dual-hosted git repository.
sk0x50 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git
The following commit(s) were added to refs/heads/main by this push:
new 53e8bfafc7 IGNITE-22679 Explain the workflow at the start of catalog
manager. (#4300)
53e8bfafc7 is described below
commit 53e8bfafc71b11f3d8a55ea97d17fe4df1c0471f
Author: Cyrill <[email protected]>
AuthorDate: Tue Sep 3 16:33:29 2024 +0300
IGNITE-22679 Explain the workflow at the start of catalog manager. (#4300)
---
.../internal/distributionzones/DistributionZoneManager.java | 7 ++++++-
.../partition/replicator/PartitionReplicaLifecycleManager.java | 9 ++++++++-
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git
a/modules/distribution-zones/src/main/java/org/apache/ignite/internal/distributionzones/DistributionZoneManager.java
b/modules/distribution-zones/src/main/java/org/apache/ignite/internal/distributionzones/DistributionZoneManager.java
index 603c7f99fd..795cb2f190 100644
---
a/modules/distribution-zones/src/main/java/org/apache/ignite/internal/distributionzones/DistributionZoneManager.java
+++
b/modules/distribution-zones/src/main/java/org/apache/ignite/internal/distributionzones/DistributionZoneManager.java
@@ -268,7 +268,12 @@ public class DistributionZoneManager implements
IgniteComponent {
restoreGlobalStateFromLocalMetastorage(recoveryRevision);
- // TODO: IGNITE-22679 CatalogManagerImpl initializes versions in a
separate thread, not safe to make this call directly.
+ // If Catalog manager is empty, it gets initialized asynchronously
and at this moment the initialization might not complete,
+ // nevertheless everything works correctly.
+ // All components execute the synchronous part of startAsync
sequentially and only when they all complete,
+ // we enable metastorage listeners (see
IgniteImpl.joinClusterAsync: metaStorageMgr.deployWatches()).
+ // Once the metstorage watches are deployed, all components start
to receive callbacks, this chain of callbacks eventually
+ // fires CatalogManager's ZONE_CREATE event, and the state of
DistributionZoneManager becomes consistent.
int catalogVersion = catalogManager.latestCatalogVersion();
return allOf(
diff --git
a/modules/partition-replicator/src/main/java/org/apache/ignite/internal/partition/replicator/PartitionReplicaLifecycleManager.java
b/modules/partition-replicator/src/main/java/org/apache/ignite/internal/partition/replicator/PartitionReplicaLifecycleManager.java
index 6faae35159..bb3dfca2d3 100644
---
a/modules/partition-replicator/src/main/java/org/apache/ignite/internal/partition/replicator/PartitionReplicaLifecycleManager.java
+++
b/modules/partition-replicator/src/main/java/org/apache/ignite/internal/partition/replicator/PartitionReplicaLifecycleManager.java
@@ -269,8 +269,15 @@ public class PartitionReplicaLifecycleManager implements
IgniteComponent {
}
private CompletableFuture<Void> processZonesOnStart(long recoveryRevision,
@Nullable HybridTimestamp lwm) {
+ // If Catalog manager is empty, it gets initialized asynchronously and
at this moment the initialization might not complete,
+ // nevertheless everything works correctly.
+ // All components execute the synchronous part of startAsync
sequentially and only when they all complete,
+ // we enable metastorage listeners (see IgniteImpl.joinClusterAsync:
metaStorageMgr.deployWatches()).
+ // Once the metstorage watches are deployed, all components start to
receive callbacks, this chain of callbacks eventually
+ // fires CatalogManager's ZONE_CREATE event, and the state of
PartitionReplicaLifecycleManager becomes consistent
+ // (calculateZoneAssignmentsAndCreateReplicationNodes() will be
called).
int earliestCatalogVersion =
catalogMgr.activeCatalogVersion(hybridTimestampToLong(lwm));
- // TODO https://issues.apache.org/jira/browse/IGNITE-22679
+
int latestCatalogVersion = catalogMgr.latestCatalogVersion();
var startedZones = new IntOpenHashSet();