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


##########
modules/raft/src/main/java/org/apache/ignite/internal/raft/storage/impl/StripeAwareLogManager.java:
##########
@@ -0,0 +1,262 @@
+/*
+ * 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.raft.storage.impl;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.apache.ignite.internal.logger.IgniteLogger;
+import org.apache.ignite.internal.logger.Loggers;
+import org.apache.ignite.raft.jraft.Status;
+import org.apache.ignite.raft.jraft.entity.LogEntry;
+import org.apache.ignite.raft.jraft.entity.LogId;
+import org.apache.ignite.raft.jraft.error.RaftError;
+import org.apache.ignite.raft.jraft.option.LogManagerOptions;
+import org.apache.ignite.raft.jraft.storage.LogStorage;
+import org.apache.ignite.raft.jraft.storage.impl.LogManagerImpl;
+
+/**
+ * Log manager that enables batch processing of log entries from different 
partitions within a stripe.
+ * <br>
+ * Upon each flush of the log, it will also trigger flush on all the other log 
storages, that belong to the same stripe in
+ * corresponding {@link LogManagerOptions#getLogManagerDisruptor()}.
+ */
+public class StripeAwareLogManager extends LogManagerImpl {
+    /** The logger. */
+    private static final IgniteLogger LOG = 
Loggers.forClass(LogManagerImpl.class);
+
+    /** Log storage instance. */
+    private LogStorage logStorage;
+
+    /** Stripe, that corresponds to the current log storage instance. */
+    private final Stripe stripe;
+
+    /** Size threshold of log entries list, that will trigger the flush upon 
the excess. */
+    private int maxAppendBufferSize;
+
+    /**
+     * Whether the log storage is a {@link RocksDbSharedLogStorage} or not.
+     * It requires special treatment in order to better optimize writes.
+     */
+    private boolean sharedLogStorage;
+
+    /**
+     * Constructor.
+     *
+     * @param stripe Stripe that corresponds to a worker thread in {@link 
LogManagerOptions#getLogManagerDisruptor()}.
+     */
+    public StripeAwareLogManager(Stripe stripe) {
+        this.stripe = stripe;
+    }
+
+    @Override
+    public boolean init(LogManagerOptions opts) {
+        LogStorage logStorage = opts.getLogStorage();
+
+        this.sharedLogStorage = logStorage instanceof RocksDbSharedLogStorage;

Review Comment:
   Yes, it should, there are benefits for them as well. That's actually how 
it's supposed to be according to jraft, they don't have shared logs, they 
prepare batches for a single log storage only



-- 
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-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to