This is an automated email from the ASF dual-hosted git repository.

ibessonov pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git


The following commit(s) were added to refs/heads/main by this push:
     new 3eb71d7b9c IGNITE-21993 Move WAL sync before RocksDB flush under if 
statement (#4166)
3eb71d7b9c is described below

commit 3eb71d7b9c201e088b79c7cf8aac2eb45d3fa198
Author: Phillippko <[email protected]>
AuthorDate: Fri Aug 2 16:30:14 2024 +0800

    IGNITE-21993 Move WAL sync before RocksDB flush under if statement (#4166)
---
 .../internal/raft/storage/impl/DefaultLogStorageFactory.java |  4 +++-
 .../ignite/internal/rocksdb/flush/RocksDbFlushListener.java  | 12 ++++++------
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git 
a/modules/raft/src/main/java/org/apache/ignite/internal/raft/storage/impl/DefaultLogStorageFactory.java
 
b/modules/raft/src/main/java/org/apache/ignite/internal/raft/storage/impl/DefaultLogStorageFactory.java
index 763b1c93ef..bee66827d9 100644
--- 
a/modules/raft/src/main/java/org/apache/ignite/internal/raft/storage/impl/DefaultLogStorageFactory.java
+++ 
b/modules/raft/src/main/java/org/apache/ignite/internal/raft/storage/impl/DefaultLogStorageFactory.java
@@ -202,7 +202,9 @@ public class DefaultLogStorageFactory implements 
LogStorageFactory {
 
     @Override
     public void sync() throws RocksDBException {
-        db.syncWal();
+        if (!dbOptions.useFsync()) {
+            db.syncWal();
+        }
     }
 
     /**
diff --git 
a/modules/rocksdb-common/src/main/java/org/apache/ignite/internal/rocksdb/flush/RocksDbFlushListener.java
 
b/modules/rocksdb-common/src/main/java/org/apache/ignite/internal/rocksdb/flush/RocksDbFlushListener.java
index c49c6f71c0..bf6ca84a0c 100644
--- 
a/modules/rocksdb-common/src/main/java/org/apache/ignite/internal/rocksdb/flush/RocksDbFlushListener.java
+++ 
b/modules/rocksdb-common/src/main/java/org/apache/ignite/internal/rocksdb/flush/RocksDbFlushListener.java
@@ -70,14 +70,14 @@ class RocksDbFlushListener extends AbstractEventListener {
     /** {@inheritDoc} */
     @Override
     public void onFlushBegin(RocksDB db, FlushJobInfo flushJobInfo) {
-        try {
-            logSyncer.sync();
-        } catch (Exception e) {
-            LOG.error("Couldn't sync RocksDB WAL on flush begin", e);
-        }
-
         if (lastEventType.compareAndSet(ON_FLUSH_COMPLETED, ON_FLUSH_BEGIN)) {
             lastFlushProcessed.join();
+
+            try {
+                logSyncer.sync();
+            } catch (Exception e) {
+                LOG.error("Couldn't sync RocksDB WAL on flush begin", e);
+            }
         }
     }
 

Reply via email to