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 2022/02/07 10:44:20 UTC

[GitHub] [ignite-3] denis-chudov commented on a change in pull request #608: IGNITE-16365 Implement a logic of recovery finishing

denis-chudov commented on a change in pull request #608:
URL: https://github.com/apache/ignite-3/pull/608#discussion_r800491550



##########
File path: modules/raft/src/integrationTest/java/org/apache/ignite/raft/jraft/core/ItCliServiceTest.java
##########
@@ -43,6 +43,7 @@
 import java.util.function.BooleanSupplier;
 import org.apache.ignite.internal.testframework.WorkDirectory;
 import org.apache.ignite.internal.testframework.WorkDirectoryExtension;
+import org.apache.ignite.internal.util.IgniteUtils;

Review comment:
       unused import

##########
File path: modules/runner/src/main/java/org/apache/ignite/internal/app/IgniteImpl.java
##########
@@ -327,11 +331,55 @@ public void start(@Nullable String cfg) {
                 doStartComponent(name, startedComponents, component);
             }
 
+            CompletableFuture<Void> upToDateMetastorageRevisionFut = new CompletableFuture<>();
+
+            metaStorageMgr.listen(MetastorageEvent.REVISION_APPLIED, new EventListener<MetastorageEventParameters>() {
+                @Override
+                public boolean notify(@NotNull MetastorageEventParameters parameters, @Nullable Throwable exception) {
+                    if (exception != null) {
+                        upToDateMetastorageRevisionFut.completeExceptionally(exception);
+
+                        return true;
+                    }
+
+                    long metastorageRevision = metaStorageMgr.revision().join();
+
+                    assert metastorageRevision >= parameters.getRevision() : IgniteStringFormatter.format(
+                            "Metastorage revision must greater than the node applied revision [msRev={}, appliedRev={}",

Review comment:
       "must be greater"
   "node applied revision" - maybe - "local node applied revision"?

##########
File path: modules/runner/src/main/java/org/apache/ignite/internal/app/IgniteImpl.java
##########
@@ -327,11 +331,55 @@ public void start(@Nullable String cfg) {
                 doStartComponent(name, startedComponents, component);
             }
 
+            CompletableFuture<Void> upToDateMetastorageRevisionFut = new CompletableFuture<>();
+
+            metaStorageMgr.listen(MetastorageEvent.REVISION_APPLIED, new EventListener<MetastorageEventParameters>() {

Review comment:
       I'd recommend moving the listener body to separate method

##########
File path: modules/runner/src/main/java/org/apache/ignite/internal/app/IgniteImpl.java
##########
@@ -346,6 +394,17 @@ public void start(@Nullable String cfg) {
         }
     }
 
+    /**
+     * Checks the node up to date by metadata.
+     *
+     * @param metastorageRevision Metastorage revision.
+     * @param appliedRevision Last applied node revision.
+     * @return True when the applied revision is greater enough to node recovery complete, false otherwise.
+     */
+    private boolean isMetadataUpToDate(long metastorageRevision, long appliedRevision) {
+        return metastorageRevision - 100 < appliedRevision;

Review comment:
       maybe we need IgniteSystemProperty instead of `100`




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