sergeyuttsel commented on code in PR #2873:
URL: https://github.com/apache/ignite-3/pull/2873#discussion_r1407569586


##########
modules/distribution-zones/src/main/java/org/apache/ignite/internal/distributionzones/causalitydatanodes/CausalityDataNodesEngine.java:
##########
@@ -98,39 +93,45 @@ public class CausalityDataNodesEngine {
      *
      * @param busyLock Busy lock to stop synchronously.
      * @param msManager Meta Storage manager.
-     * @param vaultMgr Vault manager.
      * @param zonesState Map with states for distribution zones.
      * @param distributionZoneManager Distribution zones manager.
      */
     public CausalityDataNodesEngine(
             IgniteSpinBusyLock busyLock,
             Consumer<LongFunction<CompletableFuture<?>>> registry,
             MetaStorageManager msManager,
-            VaultManager vaultMgr,
             Map<Integer, ZoneState> zonesState,
-            DistributionZoneManager distributionZoneManager
+            DistributionZoneManager distributionZoneManager,
+            CatalogManager catalogManager
     ) {
         this.busyLock = busyLock;
         this.msManager = msManager;
-        this.vaultMgr = vaultMgr;
         this.zonesState = zonesState;
         this.distributionZoneManager = distributionZoneManager;
+        this.catalogManager = catalogManager;
 
         zonesVv = new IncrementalVersionedValue<>(registry);
     }
 
     /**
-     * Gets data nodes of the zone using causality token.
+     * Gets data nodes of the zone using causality token and catalog version. 
{@code causalityToken} must be agreed
+     * with the {@code catalogVersion}, meaning that for the provided {@code 
causalityToken} actual {@code catalogVersion} must be provided.
+     * For example, if you are in the meta storage watch thread and {@code 
causalityToken} is the revision of the watch event, it is
+     * safe to take {@link CatalogManager#latestCatalogVersion()} as a {@code 
catalogVersion},
+     * because {@link CatalogManager#latestCatalogVersion()} won't be updated 
in a watch thread.
+     * The same is applied for {@link CatalogEventParameters}, it is safe to 
take {@link CatalogEventParameters#causalityToken()}
+     * as a {@code causalityToken} and {@link 
CatalogEventParameters#catalogVersion()} as a {@code catalogVersion}.
      *
      * <p>Return data nodes or throw the exception:
      * {@link IllegalArgumentException} if causalityToken or zoneId is not 
valid.
      * {@link DistributionZoneNotFoundException} if the zone with the provided 
zoneId does not exist.
      *
      * @param causalityToken Causality token.
+     * @param catalogVersion Catalog version.
      * @param zoneId Zone id.
      * @return The future with data nodes for the zoneId.
      */
-    public CompletableFuture<Set<String>> dataNodes(long causalityToken, int 
zoneId) {
+    public CompletableFuture<Set<String>> dataNodes(long causalityToken, int 
catalogVersion, int zoneId) {
         if (causalityToken < 1) {

Review Comment:
   I think we need to add similar validation for catalogVersion.



##########
modules/distribution-zones/src/main/java/org/apache/ignite/internal/distributionzones/causalitydatanodes/CausalityDataNodesEngine.java:
##########
@@ -310,32 +305,28 @@ private long getLastScaleDownConfigRevision(
      */
     private long getLastConfigRevision(
             long causalityToken,

Review Comment:
   causalityToken is unused in this and other methods.



-- 
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