tkalkirill commented on code in PR #3441:
URL: https://github.com/apache/ignite-3/pull/3441#discussion_r1530541770
##########
modules/cluster-management/src/main/java/org/apache/ignite/internal/cluster/management/raft/RocksDbClusterStateStorage.java:
##########
@@ -68,33 +71,46 @@ public class RocksDbClusterStateStorage implements
ClusterStateStorage {
private final Object snapshotRestoreLock = new Object();
- public RocksDbClusterStateStorage(Path dbPath) {
+ /**
+ * Creates a new instance.
+ *
+ * @param dbPath Path to the database.
+ * @param nodeName Ignite node name.
+ */
+ public RocksDbClusterStateStorage(Path dbPath, String nodeName) {
this.dbPath = dbPath;
+ this.snapshotExecutor = Executors.newSingleThreadExecutor(
+ NamedThreadFactory.create(nodeName,
"cluster-state-snapshot-executor", LOG)
+ );
}
@Override
public CompletableFuture<Void> start() {
- options = new Options().setCreateIfMissing(true);
+ init();
+
+ return nullCompletedFuture();
+ }
+ private void init() {
try {
- db = RocksDB.open(options, dbPath.toString());
+ RocksDB db = RocksDB.open(options, dbPath.toString());
ColumnFamily defaultCf = ColumnFamily.wrap(db,
db.getDefaultColumnFamily());
snapshotManager = new RocksSnapshotManager(db,
List.of(fullRange(defaultCf)), snapshotExecutor);
+
+ this.db = db;
} catch (RocksDBException e) {
- throw new IgniteInternalException("Failed to start the storage",
e);
+ throw new StorageException("Failed to start the storage", e);
Review Comment:
Why StorageException? IgniteInternalException looks better
##########
modules/cluster-management/src/main/java/org/apache/ignite/internal/cluster/management/raft/StorageException.java:
##########
@@ -0,0 +1,31 @@
+/*
+ * 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.cluster.management.raft;
+
+import static org.apache.ignite.lang.ErrorGroups.Common.INTERNAL_ERR;
+
+import org.apache.ignite.internal.lang.IgniteInternalException;
+
+/**
+ * Exception used by {@link RocksDbClusterStateStorage} to signal about errors.
+ */
+public class StorageException extends IgniteInternalException {
Review Comment:
Please rename to `CmgStorageException`
--
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]