sashapolo commented on code in PR #2237:
URL: https://github.com/apache/ignite-3/pull/2237#discussion_r1242239452
##########
modules/metastorage/src/main/java/org/apache/ignite/internal/metastorage/impl/MetaStorageManagerImpl.java:
##########
@@ -148,6 +155,77 @@ public MetaStorageManagerImpl(
this.clusterTime = new ClusterTimeImpl(busyLock, clock);
}
+ private CompletableFuture<Long> recover(MetaStorageServiceImpl service) {
+ if (!busyLock.enterBusy()) {
+ return CompletableFuture.failedFuture(new NodeStoppingException());
+ }
+
+ try {
+ CompletableFuture<Long> res = new CompletableFuture<>();
+
+ service.currentRevision().whenComplete((targetRevision, throwable)
-> {
+ if (throwable != null) {
+ res.completeExceptionally(throwable);
+
+ return;
+ }
+
+ LOG.info("Performing MetaStorage recovery from revision {} to
{}", storage.revision(), targetRevision);
+
+ assert targetRevision != null;
+
+ listenForRecovery(res, targetRevision);
+ });
+
+ return res;
+ } finally {
+ busyLock.leaveBusy();
+ }
+ }
+
+ private void listenForRecovery(CompletableFuture<Long> res, Long
targetRevision) {
Review Comment:
why is `targetRevision` `Long` and not `long`?
##########
modules/metastorage/src/main/java/org/apache/ignite/internal/metastorage/impl/MetaStorageManagerImpl.java:
##########
@@ -148,6 +155,77 @@ public MetaStorageManagerImpl(
this.clusterTime = new ClusterTimeImpl(busyLock, clock);
}
+ private CompletableFuture<Long> recover(MetaStorageServiceImpl service) {
+ if (!busyLock.enterBusy()) {
+ return CompletableFuture.failedFuture(new NodeStoppingException());
+ }
+
+ try {
+ CompletableFuture<Long> res = new CompletableFuture<>();
Review Comment:
Why don't we use `recoveryFinishedFuture` here? This way we can also get rid
of the `IgniteBiTuple`!
##########
modules/metastorage/src/main/java/org/apache/ignite/internal/metastorage/server/persistence/RocksDbKeyValueStorage.java:
##########
@@ -311,6 +318,12 @@ protected void createDb() throws RocksDBException {
}
}
+ private void notifyRevisionUpdate() {
Review Comment:
We should specify that this method must be called under the write lock
--
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]