You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2021/10/26 11:25:08 UTC

[GitHub] [ignite] zstan opened a new pull request #9527: IGNITE-15733 Eventually failure of baseline registration

zstan opened a new pull request #9527:
URL: https://github.com/apache/ignite/pull/9527


   Thank you for submitting the pull request to the Apache Ignite.
   
   In order to streamline the review of the contribution 
   we ask you to ensure the following steps have been taken:
   
   ### The Contribution Checklist
   - [ ] There is a single JIRA ticket related to the pull request. 
   - [ ] The web-link to the pull request is attached to the JIRA ticket.
   - [ ] The JIRA ticket has the _Patch Available_ state.
   - [ ] The pull request body describes changes that have been made. 
   The description explains _WHAT_ and _WHY_ was made instead of _HOW_.
   - [ ] The pull request title is treated as the final commit message. 
   The following pattern must be used: `IGNITE-XXXX Change summary` where `XXXX` - number of JIRA issue.
   - [ ] A reviewer has been mentioned through the JIRA comments 
   (see [the Maintainers list](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute#HowtoContribute-ReviewProcessandMaintainers)) 
   - [ ] The pull request has been checked by the Teamcity Bot and 
   the `green visa` attached to the JIRA ticket (see [TC.Bot: Check PR](https://mtcga.gridgain.com/prs.html))
   
   ### Notes
   - [How to Contribute](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute)
   - [Coding abbreviation rules](https://cwiki.apache.org/confluence/display/IGNITE/Abbreviation+Rules)
   - [Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Coding+Guidelines)
   - [Apache Ignite Teamcity Bot](https://cwiki.apache.org/confluence/display/IGNITE/Apache+Ignite+Teamcity+Bot)
   
   If you need any help, please email dev@ignite.apache.org or ask anу advice on http://asf.slack.com _#ignite_ channel.
   


-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] ibessonov commented on a change in pull request #9527: IGNITE-15733 Eventually failure of baseline registration

Posted by GitBox <gi...@apache.org>.
ibessonov commented on a change in pull request #9527:
URL: https://github.com/apache/ignite/pull/9527#discussion_r755086914



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
##########
@@ -283,10 +290,15 @@ public boolean diagnosticEnabled() {
                 try {
                     ClusterIdAndTag idAndTag = new ClusterIdAndTag(cluster.id(), cluster.tag());
 
-                    if (log.isInfoEnabled())
-                        log.info("Writing cluster ID and tag to metastorage on ready for write " + idAndTag);
+                    if (idAndTag.id() != null) {
+                        metastorage.writeAsync(CLUSTER_ID_TAG_KEY, idAndTag);
 
-                    metastorage.writeAsync(CLUSTER_ID_TAG_KEY, idAndTag);
+                        if (log.isInfoEnabled())
+                            log.info("Writing cluster ID and tag to metastorage on ready for write " + idAndTag);
+                    }
+                    else

Review comment:
       Please add braces

##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/metastorage/persistence/DmsDataWriterWorker.java
##########
@@ -201,6 +213,9 @@ public void cancel(boolean halt) throws InterruptedException {
             try {
                 RunnableFuture<?> curTask = updateQueue.take();
 
+                if (writeCondition != null && writeCondition.test(""))

Review comment:
       You forgot to remove this part I think. Or, if it is correct, then please document it.

##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
##########
@@ -329,10 +339,51 @@ public void updateTag(String newTag) throws IgniteCheckedException {
      * </ul>
      */
     public void onLocalJoin() {
-        cluster.setId(locClusterId != null ? locClusterId : UUID.randomUUID());
+        Collection<ClusterNode> rmtNodes = cluster.forServers().nodes();
+        List<ClusterNode> rmtNodes0 = new ArrayList<>(rmtNodes);
+
+        rmtNodes0.sort(Comparator.comparing(ClusterNode::id));
+
+        @Nullable Collection<BaselineNode> bltNodes = cluster.currentBaselineTopology();
+
+        if (F.isEmpty(bltNodes)) {
+            log.info("Baseline node collection is empty.");
+
+            return;
+        }
+
+        @Nullable UUID first = null;
+
+        Collection<Object> srvIds = F.nodeConsistentIds(bltNodes);
+
+        for (ClusterNode node : rmtNodes0) {
+            if (F.contains(srvIds, node.consistentId())) {
+                first = node.id();
+
+                break;
+            }
+        }
+
+        ClusterNode locNode = ctx.config().getDiscoverySpi().getLocalNode();
+
+        if (first == locNode.id() || locClusterId != null) {
+            cluster.setId(locClusterId != null ? locClusterId : UUID.randomUUID());
+
+            cluster.setTag(locClusterTag != null ? locClusterTag :
+                ClusterTagGenerator.generateTag());
 
-        cluster.setTag(locClusterTag != null ? locClusterTag :
-            ClusterTagGenerator.generateTag());
+            ClusterIdAndTag idAndTag = new ClusterIdAndTag(cluster.id(), cluster.tag());
+
+            if (log.isInfoEnabled())
+                log.info("Writing cluster ID and tag to metastorage on ready for write " + idAndTag);
+
+            try {
+                metastorage.writeAsync(CLUSTER_ID_TAG_KEY, idAndTag);
+            }
+            catch (IgniteCheckedException e) {
+                ctx.failure().process(new FailureContext(FailureType.CRITICAL_ERROR, e));

Review comment:
       > What if this node actually fails?
   
   I'm still waiting for the reply btw.

##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
##########
@@ -329,10 +339,51 @@ public void updateTag(String newTag) throws IgniteCheckedException {
      * </ul>
      */
     public void onLocalJoin() {
-        cluster.setId(locClusterId != null ? locClusterId : UUID.randomUUID());
+        Collection<ClusterNode> rmtNodes = cluster.forServers().nodes();
+        List<ClusterNode> rmtNodes0 = new ArrayList<>(rmtNodes);
+
+        rmtNodes0.sort(Comparator.comparing(ClusterNode::id));
+
+        @Nullable Collection<BaselineNode> bltNodes = cluster.currentBaselineTopology();
+
+        if (F.isEmpty(bltNodes)) {
+            log.info("Baseline node collection is empty.");
+
+            return;
+        }
+
+        @Nullable UUID first = null;
+
+        Collection<Object> srvIds = F.nodeConsistentIds(bltNodes);
+
+        for (ClusterNode node : rmtNodes0) {
+            if (F.contains(srvIds, node.consistentId())) {
+                first = node.id();
+
+                break;
+            }
+        }
+
+        ClusterNode locNode = ctx.config().getDiscoverySpi().getLocalNode();
+
+        if (first == locNode.id() || locClusterId != null) {
+            cluster.setId(locClusterId != null ? locClusterId : UUID.randomUUID());
+
+            cluster.setTag(locClusterTag != null ? locClusterTag :
+                ClusterTagGenerator.generateTag());
 
-        cluster.setTag(locClusterTag != null ? locClusterTag :
-            ClusterTagGenerator.generateTag());
+            ClusterIdAndTag idAndTag = new ClusterIdAndTag(cluster.id(), cluster.tag());
+
+            if (log.isInfoEnabled())
+                log.info("Writing cluster ID and tag to metastorage on ready for write " + idAndTag);
+
+            try {
+                metastorage.writeAsync(CLUSTER_ID_TAG_KEY, idAndTag);
+            }
+            catch (IgniteCheckedException e) {
+                ctx.failure().process(new FailureContext(FailureType.CRITICAL_ERROR, e));

Review comment:
       I don't get it, CAS is not that different from regular write. What do you mean?

##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
##########
@@ -328,11 +340,67 @@ public void updateTag(String newTag) throws IgniteCheckedException {
      *     when it becomes ready for read.</li>
      * </ul>
      */
+    public void onChangeState() {
+        Collection<ClusterNode> rmtNodes = cluster.forServers().nodes();
+        List<ClusterNode> rmtNodes0 = new ArrayList<>(rmtNodes);
+
+        rmtNodes0.sort(Comparator.comparing(ClusterNode::id));
+
+        @Nullable Collection<BaselineNode> bltNodes = cluster.currentBaselineTopology();
+
+        if (F.isEmpty(bltNodes)) {
+            log.info("Baseline node collection is empty.");
+
+            return;
+        }
+
+        @Nullable UUID first = null;
+
+        Collection<Object> srvIds = F.nodeConsistentIds(bltNodes);
+
+        for (ClusterNode node : rmtNodes0) {
+            if (F.contains(srvIds, node.consistentId())) {
+                first = node.id();
+
+                break;
+            }
+        }
+
+        ClusterNode locNode = ctx.config().getDiscoverySpi().getLocalNode();
+
+        if (first == locNode.id() || locClusterTag != null) {
+            final UUID id = locClusterId != null ? locClusterId : UUID.randomUUID();
+
+            final String tag = locClusterTag != null ? locClusterTag : ClusterTagGenerator.generateTag();
+
+            ClusterIdAndTag idAndTag = new ClusterIdAndTag(id, tag);
+
+            if (log.isInfoEnabled() && locClusterTag == null)
+                log.info("Writing cluster ID and tag to metastorage on ready for write " + idAndTag);
+
+            try {
+                GridFutureAdapter<?> f = metastorage.writeAsync(CLUSTER_ID_TAG_KEY, idAndTag);
+
+                f.listen(o -> {
+                        cluster.setId(id);
+                        cluster.setTag(tag);
+                    });
+            }
+            catch (IgniteCheckedException e) {
+                ctx.failure().process(new FailureContext(FailureType.CRITICAL_ERROR, e));
+            }
+        }
+    }
+
+    /** For pure in mem cluster we still need to generate tag and id on first registred cluster node. */

Review comment:
       ```suggestion
       /** For pure in mem cluster we still need to generate tag and id on first registered cluster node. */
   ```

##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
##########
@@ -283,10 +290,15 @@ public boolean diagnosticEnabled() {
                 try {
                     ClusterIdAndTag idAndTag = new ClusterIdAndTag(cluster.id(), cluster.tag());
 
-                    if (log.isInfoEnabled())
-                        log.info("Writing cluster ID and tag to metastorage on ready for write " + idAndTag);
+                    if (idAndTag.id() != null) {
+                        metastorage.writeAsync(CLUSTER_ID_TAG_KEY, idAndTag);

Review comment:
       I think that this code deserves a comment. Why are we sure that tag&id don't exist in cluster and we can "write" instead of "cas"?

##########
File path: modules/core/src/test/java/org/apache/ignite/internal/processors/metastorage/DistributedMetaStoragePersistentTest.java
##########
@@ -73,19 +96,174 @@
     public void testRestart() throws Exception {
         IgniteEx ignite = startGrid(0);
 
-        ignite.cluster().active(true);
+        ignite.cluster().state(ClusterState.ACTIVE);
 
         ignite.context().distributedMetastorage().write("key", "value");
 
         stopGrid(0);
 
         ignite = startGrid(0);
 
-        ignite.cluster().active(true);
+        ignite.cluster().state(ClusterState.ACTIVE);
 
         assertEquals("value", ignite.context().distributedMetastorage().read("key"));
     }
 
+    /**
+     * @throws Exception If failed.
+     */
+    @Test
+    public void testStoreLagOnOneNode() throws Exception {
+        IgniteEx ignite = startGrid(0);
+
+        IgniteEx ignite2 = startGrid(1);
+
+        DistributedMetaStorageImpl distrMetaStore = (DistributedMetaStorageImpl)ignite.context().distributedMetastorage();
+
+        DmsDataWriterWorker worker = GridTestUtils.getFieldValue(distrMetaStore, "worker");
+
+        assertNotNull(worker);
+
+        // check we still have no cluster tag key.
+        assertNull(distrMetaStore.read(CLUSTER_ID_TAG_KEY));
+
+        GridTestUtils.setFieldValue(worker, "writeCondition", new Predicate<String>() {
+            private volatile boolean skip;
+
+            @Override public boolean test(String s) {
+                if (s.equals(CLUSTER_ID_TAG_KEY) || skip) {
+                    skip = true;
+
+                    return true;
+                }
+                return false;
+            }
+        });
+
+        ignite.cluster().state(ClusterState.ACTIVE);
+
+        String clusterTag = "griffon";
+
+        assertTrue(GridTestUtils.waitForCondition(() -> {
+            boolean fail = false;

Review comment:
       This can be replaces with `return true;` in `try` and `return false;` in `catch`.

##########
File path: modules/core/src/test/java/org/apache/ignite/internal/processors/metastorage/DistributedMetaStoragePersistentTest.java
##########
@@ -73,19 +96,174 @@
     public void testRestart() throws Exception {
         IgniteEx ignite = startGrid(0);
 
-        ignite.cluster().active(true);
+        ignite.cluster().state(ClusterState.ACTIVE);
 
         ignite.context().distributedMetastorage().write("key", "value");
 
         stopGrid(0);
 
         ignite = startGrid(0);
 
-        ignite.cluster().active(true);
+        ignite.cluster().state(ClusterState.ACTIVE);
 
         assertEquals("value", ignite.context().distributedMetastorage().read("key"));
     }
 
+    /**
+     * @throws Exception If failed.
+     */
+    @Test
+    public void testStoreLagOnOneNode() throws Exception {
+        IgniteEx ignite = startGrid(0);
+
+        IgniteEx ignite2 = startGrid(1);
+
+        DistributedMetaStorageImpl distrMetaStore = (DistributedMetaStorageImpl)ignite.context().distributedMetastorage();
+
+        DmsDataWriterWorker worker = GridTestUtils.getFieldValue(distrMetaStore, "worker");
+
+        assertNotNull(worker);
+
+        // check we still have no cluster tag key.
+        assertNull(distrMetaStore.read(CLUSTER_ID_TAG_KEY));
+
+        GridTestUtils.setFieldValue(worker, "writeCondition", new Predicate<String>() {
+            private volatile boolean skip;
+
+            @Override public boolean test(String s) {
+                if (s.equals(CLUSTER_ID_TAG_KEY) || skip) {
+                    skip = true;
+
+                    return true;
+                }
+                return false;
+            }
+        });
+
+        ignite.cluster().state(ClusterState.ACTIVE);
+
+        String clusterTag = "griffon";
+
+        assertTrue(GridTestUtils.waitForCondition(() -> {
+            boolean fail = false;
+
+            try {
+                ignite2.cluster().tag(clusterTag);
+            }
+            catch (IgniteCheckedException e) {
+                assertTrue(e.getMessage().contains("Cannot change tag as default"));
+
+                fail = true;
+            }
+
+            return !fail;
+        }, 10_000));
+
+        String tag0 = ignite2.cluster().tag();
+
+        String key = "some_kind_of_uniq_key_" + ThreadLocalRandom.current().nextInt();
+
+        checkStoredWithPers(metastorage(0), ignite2, key, "value");
+
+        stopAllGrids();
+
+        ignite = startGrid(0);
+
+        startGrid(1);
+
+        ignite.cluster().state(ClusterState.ACTIVE);
+
+        assertEquals("value", ignite.context().distributedMetastorage().read(key));
+
+        assertEquals(tag0, ignite.cluster().tag());
+    }
+
+    /** Check cluster tag behaviour while one node fails. */
+    @Test
+    public void changeTagWithNodeCrash() throws Exception {
+        String clusterTag = "seamonkey";
+
+        IgniteEx ignite = startGrid(0);
+
+        IgniteEx ignite2 = startGrid(1);
+
+        Collection<ClusterNode> rmtNodes = ignite.cluster().forServers().nodes();
+
+        List<ClusterNode> rmtNodes0 = new ArrayList<>(rmtNodes);
+
+        rmtNodes0.sort(Comparator.comparing(ClusterNode::id));
+
+        // Choose a node the same as in ClusterProcessor.onChangeState.
+        @Nullable UUID first = F.first(rmtNodes0).id();
+
+        assertNotNull(first);
+
+        IgniteEx activeNode = ignite.cluster().localNode().id() == first ? ignite : ignite2;
+
+        System.err.println("node to skip: " + activeNode.name());
+
+        assertEquals(activeNode.cluster().localNode().id(), first);
+
+        DistributedMetaStorageImpl distrMetaStore =
+            (DistributedMetaStorageImpl)activeNode.context().distributedMetastorage();
+
+        ClusterProcessor proc = activeNode.context().cluster();
+
+        AtomicBoolean fail = new AtomicBoolean();
+
+        DistributedMetaStorageDelegate delegate = new DistributedMetaStorageDelegate(distrMetaStore, fail);
+
+        DmsDataWriterWorker worker = GridTestUtils.getFieldValue(distrMetaStore, "worker");
+
+        GridTestUtils.setFieldValue(proc, "metastorage", delegate);
+
+        GridTestUtils.setFieldValue(worker, "writeCondition", new Predicate<String>() {
+            @Override public boolean test(String s) {
+                if (s.equals(CLUSTER_ID_TAG_KEY) || fail.get()) {
+                    fail.set(true);
+
+                    return true;
+                }
+                return false;
+            }
+        });
+
+        IgniteEx alive = activeNode.name().equals(ignite.name()) ? ignite2 : ignite;
+
+        alive.cluster().state(ClusterState.ACTIVE);
+
+        assertTrue(GridTestUtils.waitForCondition(() -> {
+            boolean failed = false;

Review comment:
       Same here, `return !failed;` just looks complicated

##########
File path: modules/core/src/test/java/org/apache/ignite/internal/cluster/IgniteClusterIdTagTest.java
##########
@@ -424,4 +444,63 @@ public void testTagChangedEventMultinodeWithRemoteFilter() throws Exception {
         assertEquals(generatedTag, oldTagFromEvent.get());
         assertEquals(CUSTOM_TAG_0, newTagFromEvent.get());
     }
+
+    /**
+     * @return {@link DistributedMetaStorage} instance for i'th node.
+     */
+    protected DistributedMetaStorage metastorage(int i) {
+        return grid(i).context().distributedMetastorage();
+    }
+
+    /** Checks that appropriate key, value are stored into local metastore. */
+    protected void checkStoredWithPers(
+        DistributedMetaStorage msToStore,
+        IgniteEx instanceToCheck,
+        String key,
+        String value
+    ) throws IgniteCheckedException {
+        assertTrue(isPersistenceEnabled);
+
+        final CountDownLatch latch = new CountDownLatch(1);
+
+        final DistributedMetaStorageImpl distrMetaStore =
+            (DistributedMetaStorageImpl)instanceToCheck.context().distributedMetastorage();
+
+        DmsDataWriterWorker worker = GridTestUtils.getFieldValue(distrMetaStore, "worker");
+
+        ReadWriteMetastorage metastorage = GridTestUtils.getFieldValue(worker, "metastorage");
+
+        assertNotNull(metastorage);
+
+        IgniteInternalFuture f = GridTestUtils.runAsync(() -> {
+            try {
+                latch.await();
+
+                assertTrue(waitForCondition(() -> {
+                    try {
+                        AtomicReference<String> contains = new AtomicReference<>();
+
+                        metastorage.iterate("", (k, v) -> {
+                            if (k.contains(key))
+                                contains.set(k);
+                        }, false);
+
+                        return contains.get() != null && metastorage.readRaw(contains.get()) != null;
+                    }
+                    catch (IgniteCheckedException e) {
+                        throw new IgniteException(e);
+                    }
+                }, 15_000));
+            }
+            catch (IgniteInterruptedCheckedException | InterruptedException e) {
+                throw new IgniteException(e);
+            }
+        });
+
+        latch.countDown();
+
+        msToStore.write(key, value);
+
+        f.get();

Review comment:
       Please add timeout

##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
##########
@@ -328,11 +340,67 @@ public void updateTag(String newTag) throws IgniteCheckedException {
      *     when it becomes ready for read.</li>
      * </ul>
      */
+    public void onChangeState() {
+        Collection<ClusterNode> rmtNodes = cluster.forServers().nodes();
+        List<ClusterNode> rmtNodes0 = new ArrayList<>(rmtNodes);
+
+        rmtNodes0.sort(Comparator.comparing(ClusterNode::id));
+
+        @Nullable Collection<BaselineNode> bltNodes = cluster.currentBaselineTopology();
+
+        if (F.isEmpty(bltNodes)) {
+            log.info("Baseline node collection is empty.");
+
+            return;
+        }
+
+        @Nullable UUID first = null;
+
+        Collection<Object> srvIds = F.nodeConsistentIds(bltNodes);
+
+        for (ClusterNode node : rmtNodes0) {
+            if (F.contains(srvIds, node.consistentId())) {
+                first = node.id();

Review comment:
       A perfect opportunity to use Stream API, don't you think so? Take a look at `java.util.stream.Stream#min`, for example




-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] zstan commented on a change in pull request #9527: IGNITE-15733 Eventually failure of baseline registration

Posted by GitBox <gi...@apache.org>.
zstan commented on a change in pull request #9527:
URL: https://github.com/apache/ignite/pull/9527#discussion_r738274997



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
##########
@@ -329,10 +339,51 @@ public void updateTag(String newTag) throws IgniteCheckedException {
      * </ul>
      */
     public void onLocalJoin() {
-        cluster.setId(locClusterId != null ? locClusterId : UUID.randomUUID());
+        Collection<ClusterNode> rmtNodes = cluster.forServers().nodes();
+        List<ClusterNode> rmtNodes0 = new ArrayList<>(rmtNodes);
+
+        rmtNodes0.sort(Comparator.comparing(ClusterNode::id));
+
+        @Nullable Collection<BaselineNode> bltNodes = cluster.currentBaselineTopology();
+
+        if (F.isEmpty(bltNodes)) {
+            log.info("Baseline node collection is empty.");
+
+            return;
+        }
+
+        @Nullable UUID first = null;
+
+        Collection<Object> srvIds = F.nodeConsistentIds(bltNodes);
+
+        for (ClusterNode node : rmtNodes0) {
+            if (F.contains(srvIds, node.consistentId())) {
+                first = node.id();
+
+                break;
+            }
+        }
+
+        ClusterNode locNode = ctx.config().getDiscoverySpi().getLocalNode();
+
+        if (first == locNode.id() || locClusterId != null) {
+            cluster.setId(locClusterId != null ? locClusterId : UUID.randomUUID());
+
+            cluster.setTag(locClusterTag != null ? locClusterTag :
+                ClusterTagGenerator.generateTag());
 
-        cluster.setTag(locClusterTag != null ? locClusterTag :
-            ClusterTagGenerator.generateTag());
+            ClusterIdAndTag idAndTag = new ClusterIdAndTag(cluster.id(), cluster.tag());
+
+            if (log.isInfoEnabled())
+                log.info("Writing cluster ID and tag to metastorage on ready for write " + idAndTag);
+
+            try {
+                metastorage.writeAsync(CLUSTER_ID_TAG_KEY, idAndTag);
+            }
+            catch (IgniteCheckedException e) {
+                ctx.failure().process(new FailureContext(FailureType.CRITICAL_ERROR, e));

Review comment:
       seems we can`t call CAS when cluster is in transition state, like this case. I see that cas have no progress in this place.




-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] zstan commented on a change in pull request #9527: IGNITE-15733 Eventually failure of baseline registration

Posted by GitBox <gi...@apache.org>.
zstan commented on a change in pull request #9527:
URL: https://github.com/apache/ignite/pull/9527#discussion_r737358783



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
##########
@@ -329,10 +339,51 @@ public void updateTag(String newTag) throws IgniteCheckedException {
      * </ul>
      */
     public void onLocalJoin() {
-        cluster.setId(locClusterId != null ? locClusterId : UUID.randomUUID());
+        Collection<ClusterNode> rmtNodes = cluster.forServers().nodes();
+        List<ClusterNode> rmtNodes0 = new ArrayList<>(rmtNodes);
+
+        rmtNodes0.sort(Comparator.comparing(ClusterNode::id));
+
+        @Nullable Collection<BaselineNode> bltNodes = cluster.currentBaselineTopology();
+
+        if (F.isEmpty(bltNodes)) {
+            log.info("Baseline node collection is empty.");
+
+            return;
+        }
+
+        @Nullable UUID first = null;
+
+        Collection<Object> srvIds = F.nodeConsistentIds(bltNodes);
+
+        for (ClusterNode node : rmtNodes0) {
+            if (F.contains(srvIds, node.consistentId())) {
+                first = node.id();
+
+                break;
+            }
+        }
+
+        ClusterNode locNode = ctx.config().getDiscoverySpi().getLocalNode();
+
+        if (first == locNode.id() || locClusterId != null) {
+            cluster.setId(locClusterId != null ? locClusterId : UUID.randomUUID());
+
+            cluster.setTag(locClusterTag != null ? locClusterTag :
+                ClusterTagGenerator.generateTag());
 
-        cluster.setTag(locClusterTag != null ? locClusterTag :
-            ClusterTagGenerator.generateTag());
+            ClusterIdAndTag idAndTag = new ClusterIdAndTag(cluster.id(), cluster.tag());
+
+            if (log.isInfoEnabled())
+                log.info("Writing cluster ID and tag to metastorage on ready for write " + idAndTag);
+
+            try {
+                metastorage.writeAsync(CLUSTER_ID_TAG_KEY, idAndTag);

Review comment:
       1. yes, that`s right
   2. I think that TC tests all we have for such checks, i have no ideas how additionally test external instruments... 




-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] zstan commented on a change in pull request #9527: IGNITE-15733 Eventually failure of baseline registration

Posted by GitBox <gi...@apache.org>.
zstan commented on a change in pull request #9527:
URL: https://github.com/apache/ignite/pull/9527#discussion_r754110562



##########
File path: modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalHistoryReservationsTest.java
##########
@@ -403,28 +403,20 @@ public void testWalHistoryPartiallyRemoved() throws Exception {
 
         int entryCnt = 10_000;
 
-        IgniteEx ig0 = (IgniteEx)startGrids(2);
+        IgniteEx ig0 = startGrids(2);
 
-        ig0.cluster().active(true);
+        ig0.cluster().state(ClusterState.ACTIVE);
 
         IgniteCache<Integer, Integer> cache = ig0.cache("cache1");
 
         for (int k = 0; k < entryCnt; k++)
             cache.put(k, k);
 
-        GridTestUtils.runAsync(new Callable<Object>() {

Review comment:
       this test seems flaky at all and it already fixed in ggce and still erroneous in ai master.




-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] zstan commented on a change in pull request #9527: IGNITE-15733 Eventually failure of baseline registration

Posted by GitBox <gi...@apache.org>.
zstan commented on a change in pull request #9527:
URL: https://github.com/apache/ignite/pull/9527#discussion_r737336622



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
##########
@@ -669,6 +669,8 @@ private void onDiscovery0(DiscoveryNotification notification) {
                     else if (customMsg instanceof ChangeGlobalStateFinishMessage) {
                         ctx.state().onStateFinishMessage((ChangeGlobalStateFinishMessage)customMsg);
 
+                        ctx.cluster().onLocalJoin();

Review comment:
       i rename it like: "onChangeState", hope it`s ok now.




-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] zstan commented on a change in pull request #9527: IGNITE-15733 Eventually failure of baseline registration

Posted by GitBox <gi...@apache.org>.
zstan commented on a change in pull request #9527:
URL: https://github.com/apache/ignite/pull/9527#discussion_r761908970



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
##########
@@ -328,11 +340,67 @@ public void updateTag(String newTag) throws IgniteCheckedException {
      *     when it becomes ready for read.</li>
      * </ul>
      */
+    public void onChangeState() {
+        Collection<ClusterNode> rmtNodes = cluster.forServers().nodes();
+        List<ClusterNode> rmtNodes0 = new ArrayList<>(rmtNodes);
+
+        rmtNodes0.sort(Comparator.comparing(ClusterNode::id));
+
+        @Nullable Collection<BaselineNode> bltNodes = cluster.currentBaselineTopology();
+
+        if (F.isEmpty(bltNodes)) {
+            log.info("Baseline node collection is empty.");
+
+            return;
+        }
+
+        @Nullable UUID first = null;
+
+        Collection<Object> srvIds = F.nodeConsistentIds(bltNodes);
+
+        for (ClusterNode node : rmtNodes0) {
+            if (F.contains(srvIds, node.consistentId())) {
+                first = node.id();

Review comment:
       hmm, we have two independent sets here, 1. nodes in topology 2. nodes in baseline i suppose the can be different at all, thus no min mechanics are suitable here, isn`t it ?




-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] zstan commented on a change in pull request #9527: IGNITE-15733 Eventually failure of baseline registration

Posted by GitBox <gi...@apache.org>.
zstan commented on a change in pull request #9527:
URL: https://github.com/apache/ignite/pull/9527#discussion_r736428395



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreManager.java
##########
@@ -489,21 +490,32 @@ public FilePageStoreManager(GridKernalContext ctx) {
 
         int grpId = MetaStorage.METASTORAGE_CACHE_ID;
 
-        if (!idxCacheStores.containsKey(grpId)) {
-            DataRegion dataRegion = cctx.database().dataRegion(GridCacheDatabaseSharedManager.METASTORE_DATA_REGION_NAME);
-            PageMetrics pageMetrics = dataRegion.metrics().cacheGrpPageMetrics(grpId);
+        DataRegion dataRegion = cctx.database().dataRegion(GridCacheDatabaseSharedManager.METASTORE_DATA_REGION_NAME);
 
-            CacheStoreHolder holder = initDir(
-                new File(storeWorkDir, MetaStorage.METASTORAGE_DIR_NAME),
-                grpId,
-                MetaStorage.METASTORAGE_PARTITIONS.size(),
-                pageMetrics,
-                false);
+        AtomicReference<IgniteCheckedException> initException = new AtomicReference<>();

Review comment:
       This part of fix has no common with issue, just further potential bugs reduction.




-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] zstan commented on a change in pull request #9527: IGNITE-15733 Eventually failure of baseline registration

Posted by GitBox <gi...@apache.org>.
zstan commented on a change in pull request #9527:
URL: https://github.com/apache/ignite/pull/9527#discussion_r738274997



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
##########
@@ -329,10 +339,51 @@ public void updateTag(String newTag) throws IgniteCheckedException {
      * </ul>
      */
     public void onLocalJoin() {
-        cluster.setId(locClusterId != null ? locClusterId : UUID.randomUUID());
+        Collection<ClusterNode> rmtNodes = cluster.forServers().nodes();
+        List<ClusterNode> rmtNodes0 = new ArrayList<>(rmtNodes);
+
+        rmtNodes0.sort(Comparator.comparing(ClusterNode::id));
+
+        @Nullable Collection<BaselineNode> bltNodes = cluster.currentBaselineTopology();
+
+        if (F.isEmpty(bltNodes)) {
+            log.info("Baseline node collection is empty.");
+
+            return;
+        }
+
+        @Nullable UUID first = null;
+
+        Collection<Object> srvIds = F.nodeConsistentIds(bltNodes);
+
+        for (ClusterNode node : rmtNodes0) {
+            if (F.contains(srvIds, node.consistentId())) {
+                first = node.id();
+
+                break;
+            }
+        }
+
+        ClusterNode locNode = ctx.config().getDiscoverySpi().getLocalNode();
+
+        if (first == locNode.id() || locClusterId != null) {
+            cluster.setId(locClusterId != null ? locClusterId : UUID.randomUUID());
+
+            cluster.setTag(locClusterTag != null ? locClusterTag :
+                ClusterTagGenerator.generateTag());
 
-        cluster.setTag(locClusterTag != null ? locClusterTag :
-            ClusterTagGenerator.generateTag());
+            ClusterIdAndTag idAndTag = new ClusterIdAndTag(cluster.id(), cluster.tag());
+
+            if (log.isInfoEnabled())
+                log.info("Writing cluster ID and tag to metastorage on ready for write " + idAndTag);
+
+            try {
+                metastorage.writeAsync(CLUSTER_ID_TAG_KEY, idAndTag);
+            }
+            catch (IgniteCheckedException e) {
+                ctx.failure().process(new FailureContext(FailureType.CRITICAL_ERROR, e));

Review comment:
       seems we can`t cal CAS when cluster is in transition state, like this case. I see that cas have no progress in this place.




-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] zstan commented on a change in pull request #9527: IGNITE-15733 Eventually failure of baseline registration

Posted by GitBox <gi...@apache.org>.
zstan commented on a change in pull request #9527:
URL: https://github.com/apache/ignite/pull/9527#discussion_r790441534



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
##########
@@ -329,10 +339,51 @@ public void updateTag(String newTag) throws IgniteCheckedException {
      * </ul>
      */
     public void onLocalJoin() {
-        cluster.setId(locClusterId != null ? locClusterId : UUID.randomUUID());
+        Collection<ClusterNode> rmtNodes = cluster.forServers().nodes();
+        List<ClusterNode> rmtNodes0 = new ArrayList<>(rmtNodes);
+
+        rmtNodes0.sort(Comparator.comparing(ClusterNode::id));
+
+        @Nullable Collection<BaselineNode> bltNodes = cluster.currentBaselineTopology();
+
+        if (F.isEmpty(bltNodes)) {
+            log.info("Baseline node collection is empty.");
+
+            return;
+        }
+
+        @Nullable UUID first = null;
+
+        Collection<Object> srvIds = F.nodeConsistentIds(bltNodes);
+
+        for (ClusterNode node : rmtNodes0) {
+            if (F.contains(srvIds, node.consistentId())) {
+                first = node.id();
+
+                break;
+            }
+        }
+
+        ClusterNode locNode = ctx.config().getDiscoverySpi().getLocalNode();
+
+        if (first == locNode.id() || locClusterId != null) {
+            cluster.setId(locClusterId != null ? locClusterId : UUID.randomUUID());
+
+            cluster.setTag(locClusterTag != null ? locClusterTag :
+                ClusterTagGenerator.generateTag());
 
-        cluster.setTag(locClusterTag != null ? locClusterTag :
-            ClusterTagGenerator.generateTag());
+            ClusterIdAndTag idAndTag = new ClusterIdAndTag(cluster.id(), cluster.tag());
+
+            if (log.isInfoEnabled())
+                log.info("Writing cluster ID and tag to metastorage on ready for write " + idAndTag);
+
+            try {
+                metastorage.writeAsync(CLUSTER_ID_TAG_KEY, idAndTag);
+            }
+            catch (IgniteCheckedException e) {
+                ctx.failure().process(new FailureContext(FailureType.CRITICAL_ERROR, e));

Review comment:
       Ok i append one more test : _changeTagWithNodeCrash2_ (possibly we need to remove it after all experiments)) I see: "Node with set up BaselineTopology is not allowed to join cluster without one: metastorage.DistributedMetaStoragePersistentTest1" after some of test runs, have you assume such a problem ? I don`t think this is the problem..




-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] zstan commented on a change in pull request #9527: IGNITE-15733 Eventually failure of baseline registration

Posted by GitBox <gi...@apache.org>.
zstan commented on a change in pull request #9527:
URL: https://github.com/apache/ignite/pull/9527#discussion_r761958819



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
##########
@@ -329,10 +339,51 @@ public void updateTag(String newTag) throws IgniteCheckedException {
      * </ul>
      */
     public void onLocalJoin() {
-        cluster.setId(locClusterId != null ? locClusterId : UUID.randomUUID());
+        Collection<ClusterNode> rmtNodes = cluster.forServers().nodes();
+        List<ClusterNode> rmtNodes0 = new ArrayList<>(rmtNodes);
+
+        rmtNodes0.sort(Comparator.comparing(ClusterNode::id));
+
+        @Nullable Collection<BaselineNode> bltNodes = cluster.currentBaselineTopology();
+
+        if (F.isEmpty(bltNodes)) {
+            log.info("Baseline node collection is empty.");
+
+            return;
+        }
+
+        @Nullable UUID first = null;
+
+        Collection<Object> srvIds = F.nodeConsistentIds(bltNodes);
+
+        for (ClusterNode node : rmtNodes0) {
+            if (F.contains(srvIds, node.consistentId())) {
+                first = node.id();
+
+                break;
+            }
+        }
+
+        ClusterNode locNode = ctx.config().getDiscoverySpi().getLocalNode();
+
+        if (first == locNode.id() || locClusterId != null) {
+            cluster.setId(locClusterId != null ? locClusterId : UUID.randomUUID());
+
+            cluster.setTag(locClusterTag != null ? locClusterTag :
+                ClusterTagGenerator.generateTag());
 
-        cluster.setTag(locClusterTag != null ? locClusterTag :
-            ClusterTagGenerator.generateTag());
+            ClusterIdAndTag idAndTag = new ClusterIdAndTag(cluster.id(), cluster.tag());
+
+            if (log.isInfoEnabled())
+                log.info("Writing cluster ID and tag to metastorage on ready for write " + idAndTag);
+
+            try {
+                metastorage.writeAsync(CLUSTER_ID_TAG_KEY, idAndTag);
+            }
+            catch (IgniteCheckedException e) {
+                ctx.failure().process(new FailureContext(FailureType.CRITICAL_ERROR, e));

Review comment:
       Sorry i append changeTagWithNodeCrash test, hope it answers all questions here ? I tries to emulate all possible situations 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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] ibessonov commented on a change in pull request #9527: IGNITE-15733 Eventually failure of baseline registration

Posted by GitBox <gi...@apache.org>.
ibessonov commented on a change in pull request #9527:
URL: https://github.com/apache/ignite/pull/9527#discussion_r782031754



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
##########
@@ -328,11 +340,67 @@ public void updateTag(String newTag) throws IgniteCheckedException {
      *     when it becomes ready for read.</li>
      * </ul>
      */
+    public void onChangeState() {
+        Collection<ClusterNode> rmtNodes = cluster.forServers().nodes();
+        List<ClusterNode> rmtNodes0 = new ArrayList<>(rmtNodes);
+
+        rmtNodes0.sort(Comparator.comparing(ClusterNode::id));
+
+        @Nullable Collection<BaselineNode> bltNodes = cluster.currentBaselineTopology();
+
+        if (F.isEmpty(bltNodes)) {
+            log.info("Baseline node collection is empty.");
+
+            return;
+        }
+
+        @Nullable UUID first = null;
+
+        Collection<Object> srvIds = F.nodeConsistentIds(bltNodes);
+
+        for (ClusterNode node : rmtNodes0) {
+            if (F.contains(srvIds, node.consistentId())) {
+                first = node.id();

Review comment:
       Let me explain than. You could write it like
   ```
   Optional<UUID> first = cluster.forServers().nodes().stream()
       .filter(node -> srvIds.contains(node.consistentId())
       .min(comparing(ClusterNode::id))
   ```
   Fewer explicit actions, cleaner code, I think

##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
##########
@@ -328,11 +340,67 @@ public void updateTag(String newTag) throws IgniteCheckedException {
      *     when it becomes ready for read.</li>
      * </ul>
      */
+    public void onChangeState() {
+        Collection<ClusterNode> rmtNodes = cluster.forServers().nodes();
+        List<ClusterNode> rmtNodes0 = new ArrayList<>(rmtNodes);
+
+        rmtNodes0.sort(Comparator.comparing(ClusterNode::id));
+
+        @Nullable Collection<BaselineNode> bltNodes = cluster.currentBaselineTopology();
+
+        if (F.isEmpty(bltNodes)) {
+            log.info("Baseline node collection is empty.");
+
+            return;
+        }
+
+        @Nullable UUID first = null;
+
+        Collection<Object> srvIds = F.nodeConsistentIds(bltNodes);
+
+        for (ClusterNode node : rmtNodes0) {
+            if (F.contains(srvIds, node.consistentId())) {
+                first = node.id();
+
+                break;
+            }
+        }
+
+        ClusterNode locNode = ctx.config().getDiscoverySpi().getLocalNode();
+
+        if (first == locNode.id() || locClusterTag != null) {

Review comment:
       Reference equality for UUIDs, can you please fix it?

##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
##########
@@ -329,10 +339,51 @@ public void updateTag(String newTag) throws IgniteCheckedException {
      * </ul>
      */
     public void onLocalJoin() {
-        cluster.setId(locClusterId != null ? locClusterId : UUID.randomUUID());
+        Collection<ClusterNode> rmtNodes = cluster.forServers().nodes();
+        List<ClusterNode> rmtNodes0 = new ArrayList<>(rmtNodes);
+
+        rmtNodes0.sort(Comparator.comparing(ClusterNode::id));
+
+        @Nullable Collection<BaselineNode> bltNodes = cluster.currentBaselineTopology();
+
+        if (F.isEmpty(bltNodes)) {
+            log.info("Baseline node collection is empty.");
+
+            return;
+        }
+
+        @Nullable UUID first = null;
+
+        Collection<Object> srvIds = F.nodeConsistentIds(bltNodes);
+
+        for (ClusterNode node : rmtNodes0) {
+            if (F.contains(srvIds, node.consistentId())) {
+                first = node.id();
+
+                break;
+            }
+        }
+
+        ClusterNode locNode = ctx.config().getDiscoverySpi().getLocalNode();
+
+        if (first == locNode.id() || locClusterId != null) {
+            cluster.setId(locClusterId != null ? locClusterId : UUID.randomUUID());
+
+            cluster.setTag(locClusterTag != null ? locClusterTag :
+                ClusterTagGenerator.generateTag());
 
-        cluster.setTag(locClusterTag != null ? locClusterTag :
-            ClusterTagGenerator.generateTag());
+            ClusterIdAndTag idAndTag = new ClusterIdAndTag(cluster.id(), cluster.tag());
+
+            if (log.isInfoEnabled())
+                log.info("Writing cluster ID and tag to metastorage on ready for write " + idAndTag);
+
+            try {
+                metastorage.writeAsync(CLUSTER_ID_TAG_KEY, idAndTag);
+            }
+            catch (IgniteCheckedException e) {
+                ctx.failure().process(new FailureContext(FailureType.CRITICAL_ERROR, e));

Review comment:
       Situation - node, that should invoke `metastorage.writeAsync(CLUSTER_ID_TAG_KEY, idAndTag);`, fails before doing so. What will hapen?




-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] zstan commented on a change in pull request #9527: IGNITE-15733 Eventually failure of baseline registration

Posted by GitBox <gi...@apache.org>.
zstan commented on a change in pull request #9527:
URL: https://github.com/apache/ignite/pull/9527#discussion_r736429498



##########
File path: modules/core/src/test/java/org/apache/ignite/internal/processors/metastorage/DistributedMetaStorageTest.java
##########
@@ -65,12 +72,16 @@
     @Override protected void beforeTestsStarted() throws Exception {
         super.beforeTestsStarted();
 
-        startGrid(0);
+        IgniteEx ign = startGrid(0);
 
         // We have to start the second node and wait when it is started
         // to be sure that all async metastorage updates of the node_0 are completed.
         startGrid(1);
 
+        ign.cluster().state(ClusterState.ACTIVE);
+
+        waitForCondition(() -> (int)metastorage(0).getUpdatesCount() == (isPersistent() ? 4 : 2), 10_000);

Review comment:
       Looks ugly but i have no ideas how to make it more clear.




-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] zstan commented on a change in pull request #9527: IGNITE-15733 Eventually failure of baseline registration

Posted by GitBox <gi...@apache.org>.
zstan commented on a change in pull request #9527:
URL: https://github.com/apache/ignite/pull/9527#discussion_r781012190



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
##########
@@ -283,10 +290,15 @@ public boolean diagnosticEnabled() {
                 try {
                     ClusterIdAndTag idAndTag = new ClusterIdAndTag(cluster.id(), cluster.tag());
 
-                    if (log.isInfoEnabled())
-                        log.info("Writing cluster ID and tag to metastorage on ready for write " + idAndTag);
+                    if (idAndTag.id() != null) {
+                        metastorage.writeAsync(CLUSTER_ID_TAG_KEY, idAndTag);

Review comment:
       I just reuse previous approach here, no cas was 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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] zstan commented on a change in pull request #9527: IGNITE-15733 Eventually failure of baseline registration

Posted by GitBox <gi...@apache.org>.
zstan commented on a change in pull request #9527:
URL: https://github.com/apache/ignite/pull/9527#discussion_r761908970



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
##########
@@ -328,11 +340,67 @@ public void updateTag(String newTag) throws IgniteCheckedException {
      *     when it becomes ready for read.</li>
      * </ul>
      */
+    public void onChangeState() {
+        Collection<ClusterNode> rmtNodes = cluster.forServers().nodes();
+        List<ClusterNode> rmtNodes0 = new ArrayList<>(rmtNodes);
+
+        rmtNodes0.sort(Comparator.comparing(ClusterNode::id));
+
+        @Nullable Collection<BaselineNode> bltNodes = cluster.currentBaselineTopology();
+
+        if (F.isEmpty(bltNodes)) {
+            log.info("Baseline node collection is empty.");
+
+            return;
+        }
+
+        @Nullable UUID first = null;
+
+        Collection<Object> srvIds = F.nodeConsistentIds(bltNodes);
+
+        for (ClusterNode node : rmtNodes0) {
+            if (F.contains(srvIds, node.consistentId())) {
+                first = node.id();

Review comment:
       hmm, we have two independent sets here, 1. nodes in topology 2. nodes in baseline i suppose they can be different at all, thus no min mechanics are suitable here, isn`t it ?




-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] zstan commented on a change in pull request #9527: IGNITE-15733 Eventually failure of baseline registration

Posted by GitBox <gi...@apache.org>.
zstan commented on a change in pull request #9527:
URL: https://github.com/apache/ignite/pull/9527#discussion_r789695631



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
##########
@@ -328,11 +340,67 @@ public void updateTag(String newTag) throws IgniteCheckedException {
      *     when it becomes ready for read.</li>
      * </ul>
      */
+    public void onChangeState() {
+        Collection<ClusterNode> rmtNodes = cluster.forServers().nodes();
+        List<ClusterNode> rmtNodes0 = new ArrayList<>(rmtNodes);
+
+        rmtNodes0.sort(Comparator.comparing(ClusterNode::id));
+
+        @Nullable Collection<BaselineNode> bltNodes = cluster.currentBaselineTopology();
+
+        if (F.isEmpty(bltNodes)) {
+            log.info("Baseline node collection is empty.");
+
+            return;
+        }
+
+        @Nullable UUID first = null;
+
+        Collection<Object> srvIds = F.nodeConsistentIds(bltNodes);
+
+        for (ClusterNode node : rmtNodes0) {
+            if (F.contains(srvIds, node.consistentId())) {
+                first = node.id();

Review comment:
       got it!




-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] zstan commented on a change in pull request #9527: IGNITE-15733 Eventually failure of baseline registration

Posted by GitBox <gi...@apache.org>.
zstan commented on a change in pull request #9527:
URL: https://github.com/apache/ignite/pull/9527#discussion_r781029023



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
##########
@@ -283,10 +290,15 @@ public boolean diagnosticEnabled() {
                 try {
                     ClusterIdAndTag idAndTag = new ClusterIdAndTag(cluster.id(), cluster.tag());
 
-                    if (log.isInfoEnabled())
-                        log.info("Writing cluster ID and tag to metastorage on ready for write " + idAndTag);
+                    if (idAndTag.id() != null) {
+                        metastorage.writeAsync(CLUSTER_ID_TAG_KEY, idAndTag);

Review comment:
       I jusr reuse previous approach here, if you prefer to use cas here, plz let me know and i investigate it.




-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] ibessonov commented on a change in pull request #9527: IGNITE-15733 Eventually failure of baseline registration

Posted by GitBox <gi...@apache.org>.
ibessonov commented on a change in pull request #9527:
URL: https://github.com/apache/ignite/pull/9527#discussion_r737190009



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
##########
@@ -669,6 +669,8 @@ private void onDiscovery0(DiscoveryNotification notification) {
                     else if (customMsg instanceof ChangeGlobalStateFinishMessage) {
                         ctx.state().onStateFinishMessage((ChangeGlobalStateFinishMessage)customMsg);
 
+                        ctx.cluster().onLocalJoin();

Review comment:
       This method should be renamed now

##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
##########
@@ -329,10 +339,51 @@ public void updateTag(String newTag) throws IgniteCheckedException {
      * </ul>
      */
     public void onLocalJoin() {
-        cluster.setId(locClusterId != null ? locClusterId : UUID.randomUUID());
+        Collection<ClusterNode> rmtNodes = cluster.forServers().nodes();
+        List<ClusterNode> rmtNodes0 = new ArrayList<>(rmtNodes);
+
+        rmtNodes0.sort(Comparator.comparing(ClusterNode::id));
+
+        @Nullable Collection<BaselineNode> bltNodes = cluster.currentBaselineTopology();
+
+        if (F.isEmpty(bltNodes)) {
+            log.info("Baseline node collection is empty.");
+
+            return;
+        }
+
+        @Nullable UUID first = null;
+
+        Collection<Object> srvIds = F.nodeConsistentIds(bltNodes);
+
+        for (ClusterNode node : rmtNodes0) {
+            if (F.contains(srvIds, node.consistentId())) {
+                first = node.id();
+
+                break;
+            }
+        }
+
+        ClusterNode locNode = ctx.config().getDiscoverySpi().getLocalNode();
+
+        if (first == locNode.id() || locClusterId != null) {
+            cluster.setId(locClusterId != null ? locClusterId : UUID.randomUUID());
+
+            cluster.setTag(locClusterTag != null ? locClusterTag :
+                ClusterTagGenerator.generateTag());
 
-        cluster.setTag(locClusterTag != null ? locClusterTag :
-            ClusterTagGenerator.generateTag());
+            ClusterIdAndTag idAndTag = new ClusterIdAndTag(cluster.id(), cluster.tag());
+
+            if (log.isInfoEnabled())
+                log.info("Writing cluster ID and tag to metastorage on ready for write " + idAndTag);
+
+            try {
+                metastorage.writeAsync(CLUSTER_ID_TAG_KEY, idAndTag);

Review comment:
       So, please correct me if I'm wrong:
    - This will happen on every activation.
    - Only the baseline node with the lowest nodeId can propagate this value.
    - It is implied that "locClusterTag" and "locClusterId" match setting from the cluster if they are present.
   
   Let's hope that none of external instruments will be affected by such change. 

##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
##########
@@ -329,10 +339,51 @@ public void updateTag(String newTag) throws IgniteCheckedException {
      * </ul>
      */
     public void onLocalJoin() {
-        cluster.setId(locClusterId != null ? locClusterId : UUID.randomUUID());
+        Collection<ClusterNode> rmtNodes = cluster.forServers().nodes();
+        List<ClusterNode> rmtNodes0 = new ArrayList<>(rmtNodes);
+
+        rmtNodes0.sort(Comparator.comparing(ClusterNode::id));
+
+        @Nullable Collection<BaselineNode> bltNodes = cluster.currentBaselineTopology();
+
+        if (F.isEmpty(bltNodes)) {
+            log.info("Baseline node collection is empty.");
+
+            return;
+        }
+
+        @Nullable UUID first = null;
+
+        Collection<Object> srvIds = F.nodeConsistentIds(bltNodes);
+
+        for (ClusterNode node : rmtNodes0) {
+            if (F.contains(srvIds, node.consistentId())) {
+                first = node.id();
+
+                break;
+            }
+        }
+
+        ClusterNode locNode = ctx.config().getDiscoverySpi().getLocalNode();
+
+        if (first == locNode.id() || locClusterId != null) {
+            cluster.setId(locClusterId != null ? locClusterId : UUID.randomUUID());
+
+            cluster.setTag(locClusterTag != null ? locClusterTag :
+                ClusterTagGenerator.generateTag());
 
-        cluster.setTag(locClusterTag != null ? locClusterTag :
-            ClusterTagGenerator.generateTag());
+            ClusterIdAndTag idAndTag = new ClusterIdAndTag(cluster.id(), cluster.tag());
+
+            if (log.isInfoEnabled())
+                log.info("Writing cluster ID and tag to metastorage on ready for write " + idAndTag);
+
+            try {
+                metastorage.writeAsync(CLUSTER_ID_TAG_KEY, idAndTag);
+            }
+            catch (IgniteCheckedException e) {
+                ctx.failure().process(new FailureContext(FailureType.CRITICAL_ERROR, e));

Review comment:
       What if this node actually fails? It feels like we'll be having a cluster without tag&id. Can "unconditional" "compareAndSet" save us from such situation?

##########
File path: modules/core/src/test/java/org/apache/ignite/internal/processors/metastorage/DistributedMetaStorageTest.java
##########
@@ -406,84 +417,180 @@ public void testDeactivateActivate() throws Exception {
     public void testOptimizedWriteTwice() throws Exception {
         IgniteEx igniteEx = startGrid(0);
 
-        igniteEx.cluster().active(true);
+        igniteEx.cluster().state(ClusterState.ACTIVE);
 
         metastorage(0).write("key1", "value1");
 
-        assertEquals(1, metastorage(0).getUpdatesCount() - initialUpdatesCount);
+        int expUpdatesCnt = 1;
+
+        assertTrue("initialUpdatesCount=" + initialUpdatesCount + ", upd=" + metastorage(0).getUpdatesCount(),
+            waitForCondition(() ->
+            (expUpdatesCnt == metastorage(0).getUpdatesCount() - initialUpdatesCount), 10_000));
 
         metastorage(0).write("key2", "value2");
 
-        assertEquals(2, metastorage(0).getUpdatesCount() - initialUpdatesCount);
+        assertEquals(expUpdatesCnt + 1, metastorage(0).getUpdatesCount() - initialUpdatesCount);
 
         metastorage(0).write("key1", "value1");
 
-        assertEquals(2, metastorage(0).getUpdatesCount() - initialUpdatesCount);
+        assertEquals(expUpdatesCnt + 1, metastorage(0).getUpdatesCount() - initialUpdatesCount);
     }
 
     /** */
     @Test
     public void testClient() throws Exception {
         IgniteEx igniteEx = startGrid(0);
 
-        igniteEx.cluster().active(true);
+        igniteEx.cluster().state(ClusterState.ACTIVE);
 
-        metastorage(0).write("key0", "value0");
+        checkStored(metastorage(0), metastorage(0), "key0", "value0");
 
         startClientGrid(1);
 
         AtomicInteger clientLsnrUpdatesCnt = new AtomicInteger();
 
-        assertEquals(1, metastorage(1).getUpdatesCount() - initialUpdatesCount);
+        int expUpdatesCnt = 1;
+
+        assertEquals("initialUpdatesCount=" + initialUpdatesCount + ", upd=" + metastorage(1).getUpdatesCount(),
+            expUpdatesCnt, metastorage(1).getUpdatesCount() - initialUpdatesCount);
 
         assertEquals("value0", metastorage(1).read("key0"));
 
         metastorage(1).listen(key -> true, (key, oldVal, newVal) -> clientLsnrUpdatesCnt.incrementAndGet());
 
-        metastorage(1).write("key1", "value1");
+        checkStored(metastorage(1), metastorage(1), "key1", "value1");
+
+        checkStored(metastorage(1), metastorage(0), "key1", "value1");
 
         assertEquals(1, clientLsnrUpdatesCnt.get());
+    }
 
-        assertEquals("value1", metastorage(1).read("key1"));
+    /** */
+    protected void checkStoredWithPers(
+        DistributedMetaStorage msToStore,
+        IgniteEx instanceToCheck,
+        String key,
+        String value
+    ) throws IgniteCheckedException {
+        assertTrue(isPersistent());
 
-        assertEquals("value1", metastorage(0).read("key1"));
+        final CountDownLatch latch = new CountDownLatch(1);
+
+        final DistributedMetaStorageImpl distrMetaStore =
+            (DistributedMetaStorageImpl)instanceToCheck.context().distributedMetastorage();
+
+        DmsDataWriterWorker worker = GridTestUtils.getFieldValue(distrMetaStore, "worker");
+
+        ReadWriteMetastorage metastorage = GridTestUtils.getFieldValue(worker, "metastorage");
+
+        assertNotNull(metastorage);
+
+        IgniteInternalFuture f = GridTestUtils.runAsync(() -> {
+            try {
+                latch.await();
+
+                assertTrue(waitForCondition(() -> {
+                    try {
+                        AtomicBoolean contains = new AtomicBoolean(false);
+                        metastorage.iterate("", (k, v) -> {

Review comment:
       Why don't you call "read" (or "get", whatever it is called)?

##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
##########
@@ -283,10 +287,16 @@ public boolean diagnosticEnabled() {
                 try {
                     ClusterIdAndTag idAndTag = new ClusterIdAndTag(cluster.id(), cluster.tag());
 
-                    if (log.isInfoEnabled())
-                        log.info("Writing cluster ID and tag to metastorage on ready for write " + idAndTag);
+                    if (log.isInfoEnabled()) {
+                        if (idAndTag.id() != null) {
+                            metastorage.writeAsync(CLUSTER_ID_TAG_KEY, idAndTag);

Review comment:
       I'm sorry, what is going on here? You only write to metastore if INFO level enabled in logs? That's not right

##########
File path: modules/core/src/test/java/org/apache/ignite/internal/processors/metastorage/DistributedMetaStorageTest.java
##########
@@ -65,12 +72,16 @@
     @Override protected void beforeTestsStarted() throws Exception {
         super.beforeTestsStarted();
 
-        startGrid(0);
+        IgniteEx ign = startGrid(0);
 
         // We have to start the second node and wait when it is started
         // to be sure that all async metastorage updates of the node_0 are completed.
         startGrid(1);
 
+        ign.cluster().state(ClusterState.ACTIVE);
+
+        waitForCondition(() -> (int)metastorage(0).getUpdatesCount() == (isPersistent() ? 4 : 2), 10_000);

Review comment:
       This is fine. I think you should just add a comment that will clarify exact keys that you mean here.

##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
##########
@@ -329,10 +339,51 @@ public void updateTag(String newTag) throws IgniteCheckedException {
      * </ul>
      */
     public void onLocalJoin() {
-        cluster.setId(locClusterId != null ? locClusterId : UUID.randomUUID());
+        Collection<ClusterNode> rmtNodes = cluster.forServers().nodes();
+        List<ClusterNode> rmtNodes0 = new ArrayList<>(rmtNodes);
+
+        rmtNodes0.sort(Comparator.comparing(ClusterNode::id));
+
+        @Nullable Collection<BaselineNode> bltNodes = cluster.currentBaselineTopology();
+
+        if (F.isEmpty(bltNodes)) {
+            log.info("Baseline node collection is empty.");
+
+            return;
+        }
+
+        @Nullable UUID first = null;
+
+        Collection<Object> srvIds = F.nodeConsistentIds(bltNodes);
+
+        for (ClusterNode node : rmtNodes0) {
+            if (F.contains(srvIds, node.consistentId())) {
+                first = node.id();
+
+                break;
+            }
+        }
+
+        ClusterNode locNode = ctx.config().getDiscoverySpi().getLocalNode();
+
+        if (first == locNode.id() || locClusterId != null) {
+            cluster.setId(locClusterId != null ? locClusterId : UUID.randomUUID());
+
+            cluster.setTag(locClusterTag != null ? locClusterTag :
+                ClusterTagGenerator.generateTag());
 
-        cluster.setTag(locClusterTag != null ? locClusterTag :
-            ClusterTagGenerator.generateTag());
+            ClusterIdAndTag idAndTag = new ClusterIdAndTag(cluster.id(), cluster.tag());
+
+            if (log.isInfoEnabled())
+                log.info("Writing cluster ID and tag to metastorage on ready for write " + idAndTag);

Review comment:
       This should probably be rephrased, or maye we shouldn't even write it in the first place if tag&id are already known

##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/FilePageStoreManager.java
##########
@@ -489,21 +490,32 @@ public FilePageStoreManager(GridKernalContext ctx) {
 
         int grpId = MetaStorage.METASTORAGE_CACHE_ID;
 
-        if (!idxCacheStores.containsKey(grpId)) {
-            DataRegion dataRegion = cctx.database().dataRegion(GridCacheDatabaseSharedManager.METASTORE_DATA_REGION_NAME);
-            PageMetrics pageMetrics = dataRegion.metrics().cacheGrpPageMetrics(grpId);
+        DataRegion dataRegion = cctx.database().dataRegion(GridCacheDatabaseSharedManager.METASTORE_DATA_REGION_NAME);
 
-            CacheStoreHolder holder = initDir(
-                new File(storeWorkDir, MetaStorage.METASTORAGE_DIR_NAME),
-                grpId,
-                MetaStorage.METASTORAGE_PARTITIONS.size(),
-                pageMetrics,
-                false);
+        AtomicReference<IgniteCheckedException> initException = new AtomicReference<>();
 
-            CacheStoreHolder old = idxCacheStores.put(grpId, holder);
+        idxCacheStores.computeIfAbsent(grpId, k -> {
+                PageMetrics pageMetrics = dataRegion.metrics().cacheGrpPageMetrics(grpId);
 
-            assert old == null : "Non-null old store holder for metastorage";
-        }
+                CacheStoreHolder holder = null;
+                try {
+                    holder = initDir(
+                        new File(storeWorkDir, MetaStorage.METASTORAGE_DIR_NAME),
+                        grpId,
+                        MetaStorage.METASTORAGE_PARTITIONS.size(),
+                        pageMetrics,
+                        false);
+                }
+                catch (IgniteCheckedException e) {
+                    initException.set(e);
+                }
+
+                return holder;
+            }
+        );
+
+        if (initException.get() != null)
+            throw new IgniteCheckedException("Metastorage initialization error: ", initException.get());

Review comment:
       Can't you just cast "initException.get()" to IgniteCheckedException?

##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/metastorage/persistence/DmsDataWriterWorker.java
##########
@@ -72,6 +73,9 @@
     /** */
     private volatile CountDownLatch latch = new CountDownLatch(0);
 
+    /** For tests purpose only. */
+    private volatile Predicate<String> writeCondition;

Review comment:
       You can also add `@TestOnly` annotation.




-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] zstan commented on a change in pull request #9527: IGNITE-15733 Eventually failure of baseline registration

Posted by GitBox <gi...@apache.org>.
zstan commented on a change in pull request #9527:
URL: https://github.com/apache/ignite/pull/9527#discussion_r737355149



##########
File path: modules/core/src/test/java/org/apache/ignite/internal/processors/metastorage/DistributedMetaStorageTest.java
##########
@@ -406,84 +417,180 @@ public void testDeactivateActivate() throws Exception {
     public void testOptimizedWriteTwice() throws Exception {
         IgniteEx igniteEx = startGrid(0);
 
-        igniteEx.cluster().active(true);
+        igniteEx.cluster().state(ClusterState.ACTIVE);
 
         metastorage(0).write("key1", "value1");
 
-        assertEquals(1, metastorage(0).getUpdatesCount() - initialUpdatesCount);
+        int expUpdatesCnt = 1;
+
+        assertTrue("initialUpdatesCount=" + initialUpdatesCount + ", upd=" + metastorage(0).getUpdatesCount(),
+            waitForCondition(() ->
+            (expUpdatesCnt == metastorage(0).getUpdatesCount() - initialUpdatesCount), 10_000));
 
         metastorage(0).write("key2", "value2");
 
-        assertEquals(2, metastorage(0).getUpdatesCount() - initialUpdatesCount);
+        assertEquals(expUpdatesCnt + 1, metastorage(0).getUpdatesCount() - initialUpdatesCount);
 
         metastorage(0).write("key1", "value1");
 
-        assertEquals(2, metastorage(0).getUpdatesCount() - initialUpdatesCount);
+        assertEquals(expUpdatesCnt + 1, metastorage(0).getUpdatesCount() - initialUpdatesCount);
     }
 
     /** */
     @Test
     public void testClient() throws Exception {
         IgniteEx igniteEx = startGrid(0);
 
-        igniteEx.cluster().active(true);
+        igniteEx.cluster().state(ClusterState.ACTIVE);
 
-        metastorage(0).write("key0", "value0");
+        checkStored(metastorage(0), metastorage(0), "key0", "value0");
 
         startClientGrid(1);
 
         AtomicInteger clientLsnrUpdatesCnt = new AtomicInteger();
 
-        assertEquals(1, metastorage(1).getUpdatesCount() - initialUpdatesCount);
+        int expUpdatesCnt = 1;
+
+        assertEquals("initialUpdatesCount=" + initialUpdatesCount + ", upd=" + metastorage(1).getUpdatesCount(),
+            expUpdatesCnt, metastorage(1).getUpdatesCount() - initialUpdatesCount);
 
         assertEquals("value0", metastorage(1).read("key0"));
 
         metastorage(1).listen(key -> true, (key, oldVal, newVal) -> clientLsnrUpdatesCnt.incrementAndGet());
 
-        metastorage(1).write("key1", "value1");
+        checkStored(metastorage(1), metastorage(1), "key1", "value1");
+
+        checkStored(metastorage(1), metastorage(0), "key1", "value1");
 
         assertEquals(1, clientLsnrUpdatesCnt.get());
+    }
 
-        assertEquals("value1", metastorage(1).read("key1"));
+    /** */
+    protected void checkStoredWithPers(
+        DistributedMetaStorage msToStore,
+        IgniteEx instanceToCheck,
+        String key,
+        String value
+    ) throws IgniteCheckedException {
+        assertTrue(isPersistent());
 
-        assertEquals("value1", metastorage(0).read("key1"));
+        final CountDownLatch latch = new CountDownLatch(1);
+
+        final DistributedMetaStorageImpl distrMetaStore =
+            (DistributedMetaStorageImpl)instanceToCheck.context().distributedMetastorage();
+
+        DmsDataWriterWorker worker = GridTestUtils.getFieldValue(distrMetaStore, "worker");
+
+        ReadWriteMetastorage metastorage = GridTestUtils.getFieldValue(worker, "metastorage");
+
+        assertNotNull(metastorage);
+
+        IgniteInternalFuture f = GridTestUtils.runAsync(() -> {
+            try {
+                latch.await();
+
+                assertTrue(waitForCondition(() -> {
+                    try {
+                        AtomicBoolean contains = new AtomicBoolean(false);
+                        metastorage.iterate("", (k, v) -> {

Review comment:
       cause in inner implementation it has been appended prefix stuff i don`t want to get all these logic here in test.




-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] zstan commented on a change in pull request #9527: IGNITE-15733 Eventually failure of baseline registration

Posted by GitBox <gi...@apache.org>.
zstan commented on a change in pull request #9527:
URL: https://github.com/apache/ignite/pull/9527#discussion_r781029376



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/metastorage/persistence/DmsDataWriterWorker.java
##########
@@ -201,6 +213,9 @@ public void cancel(boolean halt) throws InterruptedException {
             try {
                 RunnableFuture<?> curTask = updateQueue.take();
 
+                if (writeCondition != null && writeCondition.test(""))

Review comment:
       i write a comment




-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] zstan commented on a change in pull request #9527: IGNITE-15733 Eventually failure of baseline registration

Posted by GitBox <gi...@apache.org>.
zstan commented on a change in pull request #9527:
URL: https://github.com/apache/ignite/pull/9527#discussion_r781029023



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
##########
@@ -283,10 +290,15 @@ public boolean diagnosticEnabled() {
                 try {
                     ClusterIdAndTag idAndTag = new ClusterIdAndTag(cluster.id(), cluster.tag());
 
-                    if (log.isInfoEnabled())
-                        log.info("Writing cluster ID and tag to metastorage on ready for write " + idAndTag);
+                    if (idAndTag.id() != null) {
+                        metastorage.writeAsync(CLUSTER_ID_TAG_KEY, idAndTag);

Review comment:
       I just reuse previous approach here, if you prefer to use cas here, plz let me know and i investigate it.




-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org