rpuch commented on code in PR #4931:
URL: https://github.com/apache/ignite-3/pull/4931#discussion_r1893738643


##########
modules/metastorage/src/integrationTest/java/org/apache/ignite/internal/metastorage/impl/ItMetaStorageServiceTest.java:
##########
@@ -524,6 +524,24 @@ public void testRemoveAll() throws Exception {
         }
     }
 
+    /**
+     * Tests {@link MetaStorageService#removeByPrefix(ByteArray)}.
+     *
+     * @throws Exception If failed.
+     */
+    @Test
+    public void testRemoveAllByPrefix() throws Exception {

Review Comment:
   ```suggestion
       public void testRemoveByPrefix() throws Exception {
   ```



##########
modules/metastorage/src/main/java/org/apache/ignite/internal/metastorage/server/KeyValueStorage.java:
##########
@@ -283,6 +283,14 @@ public interface KeyValueStorage extends ManuallyCloseable 
{
      */
     void removeAll(List<byte[]> keys, KeyValueUpdateContext context);
 
+    /**
+     * Remove all entries corresponding to given prefix.

Review Comment:
   ```suggestion
        * Removes all entries corresponding to given prefix.
   ```



##########
modules/metastorage/src/main/java/org/apache/ignite/internal/metastorage/server/persistence/RocksDbKeyValueStorage.java:
##########
@@ -783,6 +783,29 @@ public void removeAll(List<byte[]> keys, 
KeyValueUpdateContext context) {
         }
     }
 
+    @Override
+    public void removeByPrefix(byte[] prefix, KeyValueUpdateContext context) {
+        rwLock.writeLock().lock();
+
+        try (WriteBatch batch = new WriteBatch(); Cursor<Entry> entryCursor = 
range(prefix, nextKey(prefix))) {

Review Comment:
   Let's separate the content of `try(...)` into separate lines



##########
modules/metastorage/src/main/java/org/apache/ignite/internal/metastorage/server/MetastorageChecksum.java:
##########
@@ -208,8 +218,9 @@ private enum Op {
         PUT_ALL(2),
         REMOVE(3),
         REMOVE_ALL(4),
-        SINGLE_INVOKE(5),
-        MULTI_INVOKE(6);
+        REMOVE_BY_PREFIX(5),

Review Comment:
   Changing the numeration is a breaking change. We need to either do it 
without changing the existing op codes, or handle this as a breaking change.



##########
modules/metastorage/src/main/java/org/apache/ignite/internal/metastorage/command/RemoveByPrefixCommand.java:
##########
@@ -0,0 +1,32 @@
+/*
+ * 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.command;
+
+import java.nio.ByteBuffer;
+import org.apache.ignite.internal.network.annotations.Transferable;
+
+/**
+ * Remove all command for MetaStorageCommandListener that removes all entries 
by the given prefix.

Review Comment:
   ```suggestion
    * Removal command for MetaStorageCommandListener that removes all entries 
by the given prefix.
   ```



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