sashapolo commented on code in PR #994:
URL: https://github.com/apache/ignite-3/pull/994#discussion_r941538391


##########
modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/RocksDbMvPartitionStorage.java:
##########
@@ -193,11 +193,9 @@ public <V> V runConsistently(WriteClosure<V> closure) 
throws StorageException {
     /** {@inheritDoc} */
     @Override
     public CompletableFuture<Void> flush() {
-        CompletableFuture<Void> flushFuture = new CompletableFuture<>();
-
-        CompletableFuture<Void> oldFuture = 
flushFuturesByAppliedIndex.put(lastAppliedIndex, flushFuture);
-
-        assert oldFuture == null;
+        CompletableFuture<Void> flushFuture = 
flushFuturesByAppliedIndex.computeIfAbsent(

Review Comment:
   Because `destroy` could have been called after a Raft command has been 
applied. This means that we will call `flush` twice: once for the command and 
once for the destroy, but they will have the same applied index. Instead of 
failing with the assertion, we should simply return the previous future



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