You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "alievmirza (via GitHub)" <gi...@apache.org> on 2023/06/07 18:09:39 UTC

[GitHub] [ignite-3] alievmirza opened a new pull request, #2165: IGNITE-19674 introduce TestRocksDbKeyValueStorage

alievmirza opened a new pull request, #2165:
URL: https://github.com/apache/ignite-3/pull/2165

   https://issues.apache.org/jira/browse/IGNITE-19674


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

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


[GitHub] [ignite-3] ibessonov commented on a diff in pull request #2165: IGNITE-19674 introduce TestRocksDbKeyValueStorage

Posted by "ibessonov (via GitHub)" <gi...@apache.org>.
ibessonov commented on code in PR #2165:
URL: https://github.com/apache/ignite-3/pull/2165#discussion_r1222555363


##########
modules/metastorage/src/testFixtures/java/org/apache/ignite/internal/metastorage/server/TestRocksDbKeyValueStorage.java:
##########
@@ -0,0 +1,60 @@
+/*
+ * 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.metastorage.server;
+
+import static org.apache.ignite.internal.util.ByteUtils.bytesToLong;
+import static org.apache.ignite.lang.ErrorGroups.MetaStorage.STARTING_STORAGE_ERR;
+
+import java.nio.file.Path;
+import org.apache.ignite.internal.metastorage.exceptions.MetaStorageException;
+import org.apache.ignite.internal.metastorage.server.persistence.RocksDbKeyValueStorage;
+import org.jetbrains.annotations.TestOnly;
+import org.rocksdb.RocksDBException;
+
+/**
+ * Test version of {@link RocksDbKeyValueStorage}, but behavior on a start differs. In this version, storage is not destroyed on
+ * a restart, so it can be used in {@link org.apache.ignite.internal.metastorage.impl.StandaloneMetaStorageManager}, where raft
+ * layer is mocked and there are no raft's snapshot installing and log playback.
+ */
+@TestOnly
+public class TestRocksDbKeyValueStorage extends RocksDbKeyValueStorage {
+    /**
+     * Constructor.
+     *
+     * @param nodeName Node name.
+     * @param dbPath RocksDB path.
+     */
+    public TestRocksDbKeyValueStorage(String nodeName, Path dbPath) {
+        super(nodeName, dbPath);
+    }
+
+    @Override
+    public void start() {
+        try {
+            createDb();
+
+            byte[] revision = getData().get(REVISION_KEY);
+
+            if (revision != null) {
+                setRev(bytesToLong(revision));
+            }

Review Comment:
   You could move this to parent class and simply override "destroyRocksDb" with empty body. This way it would take less code and would be less confusing when it comes to abundance of "TestOnly" methods



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

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


[GitHub] [ignite-3] ibessonov commented on a diff in pull request #2165: IGNITE-19674 introduce TestRocksDbKeyValueStorage

Posted by "ibessonov (via GitHub)" <gi...@apache.org>.
ibessonov commented on code in PR #2165:
URL: https://github.com/apache/ignite-3/pull/2165#discussion_r1222600477


##########
modules/metastorage/src/main/java/org/apache/ignite/internal/metastorage/server/persistence/RocksDbKeyValueStorage.java:
##########
@@ -116,7 +117,7 @@ public class RocksDbKeyValueStorage implements KeyValueStorage {
     private static final long SYSTEM_REVISION_MARKER_VALUE = 0;
 
     /** Revision key. */
-    private static final byte[] REVISION_KEY = keyToRocksKey(
+    protected static final byte[] REVISION_KEY = keyToRocksKey(

Review Comment:
   This no longer needs to be protected



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

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


[GitHub] [ignite-3] ibessonov merged pull request #2165: IGNITE-19674 introduce TestRocksDbKeyValueStorage

Posted by "ibessonov (via GitHub)" <gi...@apache.org>.
ibessonov merged PR #2165:
URL: https://github.com/apache/ignite-3/pull/2165


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

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