ibessonov commented on code in PR #3535:
URL: https://github.com/apache/ignite-3/pull/3535#discussion_r1551421837


##########
modules/core/src/main/java/org/apache/ignite/internal/components/LogSyncer.java:
##########
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.components;
+
+/**  Interface to synchronize write-ahead log. Operates only for persistent 
physical memory log storages. */

Review Comment:
   What's a "physical memory log storages"? Looks a bit confusing.



##########
modules/rocksdb-common/src/test/java/org/apache/ignite/internal/rocksdb/flush/RocksDbFlushListenerTest.java:
##########
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.rocksdb.flush;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
+import org.apache.ignite.internal.testframework.BaseIgniteAbstractTest;
+import org.apache.ignite.internal.util.IgniteSpinBusyLock;
+import org.junit.jupiter.api.Test;
+import org.rocksdb.FlushJobInfo;
+import org.rocksdb.RocksDB;
+import org.rocksdb.RocksDBException;
+
+/** Tests for {@link RocksDbFlushListener} */
+public class RocksDbFlushListenerTest extends BaseIgniteAbstractTest {
+    @Test
+    void testSyncWalBeforeFlush() throws RocksDBException {
+        RocksDB mockDb = mock(RocksDB.class);
+        RocksDbFlusher flusher = new RocksDbFlusher(
+                new IgniteSpinBusyLock(),
+                new ScheduledThreadPoolExecutor(20),
+                Executors.newSingleThreadExecutor(),
+                () -> 0,
+                () -> {} // No-op.
+        );
+
+        RocksDbFlushListener listener = new RocksDbFlushListener(flusher);
+
+        listener.onFlushBegin(mockDb, mock(FlushJobInfo.class));

Review Comment:
   Oh no, that's not what you need to check, ideally. Can we start a table with 
rocksdb engine, call "flush" and check that the log is synced? That would be 
much more robust. Also, such a test would be reusable. We can add it to base 
class with generic storage tests, only enabling it for non-volatile engines, of 
course (using `assumeTrue`, for example)



##########
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/persistence/checkpoint/Checkpointer.java:
##########
@@ -340,6 +346,14 @@ void doCheckpoint() throws IgniteInternalCheckedException {
                     }
                 }
 
+                try {
+                    logSyncer.sync();
+                } catch (Exception e) {
+                    log.error("Failed to sync write-ahead log during 
checkpoint processing ", e);

Review Comment:
   I don't remember whether we should end the statement with a dot or not, 
please check other messages



##########
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/persistence/checkpoint/Checkpointer.java:
##########
@@ -340,6 +346,14 @@ void doCheckpoint() throws IgniteInternalCheckedException {
                     }
                 }
 
+                try {
+                    logSyncer.sync();
+                } catch (Exception e) {
+                    log.error("Failed to sync write-ahead log during 
checkpoint processing ", e);

Review Comment:
   ```suggestion
                       log.error("Failed to sync write-ahead log during 
checkpoint", e);
   ```



##########
modules/core/src/main/java/org/apache/ignite/internal/components/LogSyncer.java:
##########
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.components;
+
+/**  Interface to synchronize write-ahead log. Operates only for persistent 
physical memory log storages. */

Review Comment:
   ```suggestion
   /** Interface to synchronize write-ahead log. Operates only for persistent 
physical memory log storages. */
   ```



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