You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ib...@apache.org on 2022/08/10 08:06:34 UTC
[ignite-3] branch main updated: IGNITE-17310 Add index related methods to the MvTableStorage interface (#992)
This is an automated email from the ASF dual-hosted git repository.
ibessonov pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git
The following commit(s) were added to refs/heads/main by this push:
new 513dff3af IGNITE-17310 Add index related methods to the MvTableStorage interface (#992)
513dff3af is described below
commit 513dff3af81d68718c7b23fe7227c6fcf5cf5cad
Author: Alexander Polovtcev <al...@gmail.com>
AuthorDate: Wed Aug 10 11:06:28 2022 +0300
IGNITE-17310 Add index related methods to the MvTableStorage interface (#992)
---
.../internal/storage/engine/MvTableStorage.java | 48 +++++-
.../internal/storage/engine/StorageEngine.java | 4 +-
.../storage/AbstractMvTableStorageTest.java | 173 +++++++++++++++++++++
.../ConcurrentHashMapMvTableStorageTest.java | 50 ++++++
.../storage/TestMvPartitionStorageTest.java | 6 +-
.../TestConcurrentHashMapMvPartitionStorage.java} | 12 +-
.../chm/TestConcurrentHashMapMvTableStorage.java | 134 ++++++++++++++++
.../chm/TestConcurrentHashMapStorageEngine.java | 2 +-
.../internal/storage/chm/TestMvTableStorage.java | 87 -----------
.../internal/storage/{impl => chm}/TestRowId.java | 2 +-
.../index/AbstractSortedIndexStorageTest.java | 2 +-
.../index/impl/BinaryTupleRowSerializer.java | 21 +--
.../internal/storage/index/impl/TestIndexRow.java | 2 +-
.../storage/index/impl/TestSortedIndexStorage.java | 15 +-
.../pagememory/AbstractPageMemoryTableStorage.java | 19 ++-
.../storage/rocksdb/RocksDbTableStorage.java | 19 ++-
.../ignite/distributed/ItTablePersistenceTest.java | 4 +-
.../distributed/ItTxDistributedTestSingleNode.java | 4 +-
.../org/apache/ignite/internal/table/Example.java | 4 +-
.../internal/table/InteropOperationsTest.java | 4 +-
.../table/KeyValueBinaryViewOperationsTest.java | 4 +-
.../KeyValueViewOperationsSimpleSchemaTest.java | 4 +-
.../internal/table/KeyValueViewOperationsTest.java | 4 +-
.../table/RecordBinaryViewOperationsTest.java | 4 +-
.../internal/table/RecordViewOperationsTest.java | 4 +-
.../internal/table/SchemaValidationTest.java | 4 +-
.../apache/ignite/internal/table/TxLocalTest.java | 6 +-
.../raft/PartitionCommandListenerTest.java | 4 +-
28 files changed, 484 insertions(+), 162 deletions(-)
diff --git a/modules/storage-api/src/main/java/org/apache/ignite/internal/storage/engine/MvTableStorage.java b/modules/storage-api/src/main/java/org/apache/ignite/internal/storage/engine/MvTableStorage.java
index 7cfcbde45..484f9357a 100644
--- a/modules/storage-api/src/main/java/org/apache/ignite/internal/storage/engine/MvTableStorage.java
+++ b/modules/storage-api/src/main/java/org/apache/ignite/internal/storage/engine/MvTableStorage.java
@@ -21,6 +21,8 @@ import java.util.concurrent.CompletableFuture;
import org.apache.ignite.configuration.schemas.table.TableConfiguration;
import org.apache.ignite.internal.storage.MvPartitionStorage;
import org.apache.ignite.internal.storage.StorageException;
+import org.apache.ignite.internal.storage.index.SortedIndexStorage;
+import org.jetbrains.annotations.Nullable;
/**
* Table storage that contains meta, partitions and SQL indexes.
@@ -31,8 +33,8 @@ public interface MvTableStorage {
*
* @param partitionId Partition id.
* @return Partition storage.
- * @throws IllegalArgumentException If partition id is out of bounds.
- * @throws StorageException If an error has occurred during the partition creation.
+ * @throws IllegalArgumentException If partition id is out of configured bounds.
+ * @throws StorageException If an error has occurred during the partition creation.
*/
MvPartitionStorage getOrCreateMvPartition(int partitionId) throws StorageException;
@@ -40,20 +42,50 @@ public interface MvTableStorage {
* Returns the partition storage or {@code null} if the requested storage doesn't exist.
*
* @param partitionId Partition id.
- * @return Partition storage or {@code null}.
- * @throws IllegalArgumentException If partition id is out of bounds.
- * @throws NullPointerException If partition doesn't exist.
+ * @return Partition storage or {@code null} if it does not exist.
+ * @throws IllegalArgumentException If partition id is out of configured bounds.
*/
+ @Nullable
MvPartitionStorage getMvPartition(int partitionId);
/**
- * Destroys a partition if it exists.
+ * Destroys a partition and all associated indices.
*
* @param partitionId Partition id.
* @throws IllegalArgumentException If partition id is out of bounds.
- * @throws StorageException If an error has occurred during the partition destruction.
+ * @throws StorageException If an error has occurred during the partition destruction.
+ */
+ CompletableFuture<Void> destroyPartition(int partitionId) throws StorageException;
+
+ /**
+ * Creates an index with the given name.
+ *
+ * <p>A prerequisite for calling this method is to have the index already configured under the same name in the Table Configuration
+ * (see {@link #configuration()}).
+ *
+ * @param indexName Index name.
+ * @throws StorageException if no index has been configured under the given name.
+ */
+ void createIndex(String indexName);
+
+ /**
+ * Returns an already created Sorted Index with the given name or {@code null} if it does not exist.
+ *
+ * @param partitionId Partition ID for which this index has been built.
+ * @param indexName Index name.
+ * @return Sorted Index storage or {@code null} if it does not exist..
+ */
+ @Nullable
+ SortedIndexStorage getSortedIndex(int partitionId, String indexName);
+
+ /**
+ * Destroys the index under the given name and all data in it.
+ *
+ * <p>This method is a no-op if the index under the given name does not exist.
+ *
+ * @param indexName Index name.
*/
- CompletableFuture<?> destroyPartition(int partitionId) throws StorageException;
+ CompletableFuture<Void> destroyIndex(String indexName);
/**
* Returns {@code true} if this storage is volatile (i.e. stores its data in memory), or {@code false} if it's persistent.
diff --git a/modules/storage-api/src/main/java/org/apache/ignite/internal/storage/engine/StorageEngine.java b/modules/storage-api/src/main/java/org/apache/ignite/internal/storage/engine/StorageEngine.java
index 1e6ba299b..1eabe2642 100644
--- a/modules/storage-api/src/main/java/org/apache/ignite/internal/storage/engine/StorageEngine.java
+++ b/modules/storage-api/src/main/java/org/apache/ignite/internal/storage/engine/StorageEngine.java
@@ -55,7 +55,5 @@ public interface StorageEngine {
* @param tableCfg Table configuration.
* @throws StorageException If an error has occurs while creating the table.
*/
- default MvTableStorage createMvTable(TableConfiguration tableCfg) throws StorageException {
- throw new UnsupportedOperationException("createMvTable");
- }
+ MvTableStorage createMvTable(TableConfiguration tableCfg) throws StorageException;
}
diff --git a/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/AbstractMvTableStorageTest.java b/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/AbstractMvTableStorageTest.java
new file mode 100644
index 000000000..cf8faaace
--- /dev/null
+++ b/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/AbstractMvTableStorageTest.java
@@ -0,0 +1,173 @@
+/*
+ * 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.storage;
+
+import static org.apache.ignite.internal.testframework.matchers.CompletableFutureMatcher.willCompleteSuccessfully;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
+import static org.hamcrest.Matchers.nullValue;
+
+import java.util.concurrent.CompletableFuture;
+import org.apache.ignite.internal.schema.configuration.SchemaConfigurationConverter;
+import org.apache.ignite.internal.storage.engine.MvTableStorage;
+import org.apache.ignite.schema.SchemaBuilders;
+import org.apache.ignite.schema.definition.ColumnType;
+import org.apache.ignite.schema.definition.TableDefinition;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+/**
+ * Abstract class that contains tests for {@link MvTableStorage} implementations.
+ */
+// TODO: Use this to test RocksDB-based storage, see https://issues.apache.org/jira/browse/IGNITE-17318
+// TODO: Use this to test B+tree-based storage, see https://issues.apache.org/jira/browse/IGNITE-17320
+public abstract class AbstractMvTableStorageTest {
+ private static final String SORTED_INDEX_NAME_1 = "SORTED_IDX_1";
+
+ private static final String SORTED_INDEX_NAME_2 = "SORTED_IDX_2";
+
+ private MvTableStorage tableStorage;
+
+ protected abstract MvTableStorage tableStorage();
+
+ @BeforeEach
+ void setUp() {
+ tableStorage = tableStorage();
+
+ createTestTable();
+ }
+
+ @AfterEach
+ void tearDown() {
+ tableStorage.destroy();
+ }
+
+ /**
+ * Tests creating a partition.
+ */
+ @Test
+ public void testCreatePartition() {
+ int partitionId = 0;
+
+ assertThat(tableStorage.getMvPartition(partitionId), is(nullValue()));
+
+ assertThat(tableStorage.getOrCreateMvPartition(partitionId), is(notNullValue()));
+
+ assertThat(tableStorage.getMvPartition(partitionId), is(notNullValue()));
+ }
+
+ /**
+ * Tests destroying a partition.
+ */
+ @Test
+ public void testDestroyPartition() {
+ int partitionId = 0;
+
+ assertThat(tableStorage.getOrCreateMvPartition(partitionId), is(notNullValue()));
+
+ tableStorage.createIndex(SORTED_INDEX_NAME_1);
+
+ assertThat(tableStorage.getMvPartition(partitionId), is(notNullValue()));
+
+ assertThat(tableStorage.getSortedIndex(partitionId, SORTED_INDEX_NAME_1), is(notNullValue()));
+
+ // Validate that destroying a partition also destroys associated indices.
+ assertThat(tableStorage.destroyPartition(partitionId), willCompleteSuccessfully());
+
+ assertThat(tableStorage.getMvPartition(partitionId), is(nullValue()));
+
+ assertThat(tableStorage.getSortedIndex(partitionId, SORTED_INDEX_NAME_1), is(nullValue()));
+ }
+
+ /**
+ * Test creating an index.
+ */
+ @Test
+ public void testCreateSortedIndex() {
+ int partitionId = 0;
+
+ assertThat(tableStorage.getSortedIndex(partitionId, SORTED_INDEX_NAME_1), is(nullValue()));
+
+ tableStorage.createIndex(SORTED_INDEX_NAME_1);
+
+ assertThat(tableStorage.getSortedIndex(partitionId, SORTED_INDEX_NAME_1), is(nullValue()));
+
+ // Index should only be available after the associated partition has been created.
+ tableStorage.getOrCreateMvPartition(partitionId);
+
+ assertThat(tableStorage.getSortedIndex(partitionId, SORTED_INDEX_NAME_1), is(notNullValue()));
+ }
+
+ /**
+ * Tests destroying an index.
+ */
+ @Test
+ public void testDestroyIndex() {
+ int partitionId = 0;
+
+ tableStorage.getOrCreateMvPartition(partitionId);
+
+ tableStorage.createIndex(SORTED_INDEX_NAME_1);
+ tableStorage.createIndex(SORTED_INDEX_NAME_2);
+
+ assertThat(tableStorage.getSortedIndex(partitionId, SORTED_INDEX_NAME_1), is(notNullValue()));
+ assertThat(tableStorage.getSortedIndex(partitionId, SORTED_INDEX_NAME_2), is(notNullValue()));
+
+ assertThat(tableStorage.destroyIndex(SORTED_INDEX_NAME_1), willCompleteSuccessfully());
+
+ assertThat(tableStorage.getSortedIndex(partitionId, SORTED_INDEX_NAME_1), is(nullValue()));
+ assertThat(tableStorage.getSortedIndex(partitionId, SORTED_INDEX_NAME_2), is(notNullValue()));
+
+ // Check that destroying an index twice is not an error
+ assertThat(tableStorage.destroyIndex(SORTED_INDEX_NAME_1), willCompleteSuccessfully());
+
+ assertThat(tableStorage.getSortedIndex(partitionId, SORTED_INDEX_NAME_1), is(nullValue()));
+
+ assertThat(tableStorage.destroyIndex(SORTED_INDEX_NAME_2), willCompleteSuccessfully());
+
+ assertThat(tableStorage.getSortedIndex(partitionId, SORTED_INDEX_NAME_1), is(nullValue()));
+ assertThat(tableStorage.getSortedIndex(partitionId, SORTED_INDEX_NAME_2), is(nullValue()));
+ }
+
+ private void createTestTable() {
+ TableDefinition tableDefinition = SchemaBuilders.tableBuilder("PUBLIC", "TEST")
+ .columns(
+ SchemaBuilders.column("ID", ColumnType.INT32).build(),
+ SchemaBuilders.column("COLUMN0", ColumnType.INT32).build()
+ )
+ .withPrimaryKey("ID")
+ .withIndex(
+ SchemaBuilders.sortedIndex(SORTED_INDEX_NAME_1)
+ .addIndexColumn("COLUMN0").done()
+ .build()
+ )
+ .withIndex(
+ SchemaBuilders.sortedIndex(SORTED_INDEX_NAME_2)
+ .addIndexColumn("COLUMN0").done()
+ .build()
+ )
+ .build();
+
+ CompletableFuture<Void> createTableFuture = tableStorage.configuration()
+ .change(tableChange -> SchemaConfigurationConverter.convert(tableDefinition, tableChange));
+
+ assertThat(createTableFuture, willCompleteSuccessfully());
+ }
+}
diff --git a/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/ConcurrentHashMapMvTableStorageTest.java b/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/ConcurrentHashMapMvTableStorageTest.java
new file mode 100644
index 000000000..843f8d981
--- /dev/null
+++ b/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/ConcurrentHashMapMvTableStorageTest.java
@@ -0,0 +1,50 @@
+/*
+ * 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.storage;
+
+import org.apache.ignite.configuration.schemas.table.NullValueDefaultConfigurationSchema;
+import org.apache.ignite.configuration.schemas.table.SortedIndexConfigurationSchema;
+import org.apache.ignite.configuration.schemas.table.TableConfiguration;
+import org.apache.ignite.internal.configuration.testframework.ConfigurationExtension;
+import org.apache.ignite.internal.configuration.testframework.InjectConfiguration;
+import org.apache.ignite.internal.storage.chm.TestConcurrentHashMapMvTableStorage;
+import org.apache.ignite.internal.storage.chm.TestConcurrentHashMapStorageEngine;
+import org.apache.ignite.internal.storage.chm.schema.TestConcurrentHashMapDataStorageConfigurationSchema;
+import org.apache.ignite.internal.storage.engine.MvTableStorage;
+import org.junit.jupiter.api.extension.ExtendWith;
+
+/**
+ * Class for testing the {@link TestConcurrentHashMapMvTableStorage} class.
+ */
+@ExtendWith(ConfigurationExtension.class)
+public class ConcurrentHashMapMvTableStorageTest extends AbstractMvTableStorageTest {
+ @InjectConfiguration(
+ polymorphicExtensions = {
+ TestConcurrentHashMapDataStorageConfigurationSchema.class,
+ SortedIndexConfigurationSchema.class,
+ NullValueDefaultConfigurationSchema.class
+ },
+ value = "mock.dataStorage.name = " + TestConcurrentHashMapStorageEngine.ENGINE_NAME
+ )
+ private TableConfiguration tableConfig;
+
+ @Override
+ protected MvTableStorage tableStorage() {
+ return new TestConcurrentHashMapMvTableStorage(tableConfig);
+ }
+}
diff --git a/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/TestMvPartitionStorageTest.java b/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/TestMvPartitionStorageTest.java
index 47a53663c..de48fe2b1 100644
--- a/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/TestMvPartitionStorageTest.java
+++ b/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/TestMvPartitionStorageTest.java
@@ -17,16 +17,16 @@
package org.apache.ignite.internal.storage;
-import org.apache.ignite.internal.storage.impl.TestMvPartitionStorage;
+import org.apache.ignite.internal.storage.chm.TestConcurrentHashMapMvPartitionStorage;
/**
- * MV partition storage test implementation for {@link TestMvPartitionStorage} class.
+ * MV partition storage test implementation for {@link TestConcurrentHashMapMvPartitionStorage} class.
*/
public class TestMvPartitionStorageTest extends AbstractMvPartitionStorageTest {
/**
* Creates new instance.
*/
public TestMvPartitionStorageTest() {
- storage = new TestMvPartitionStorage(0);
+ storage = new TestConcurrentHashMapMvPartitionStorage(0);
}
}
diff --git a/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/impl/TestMvPartitionStorage.java b/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/chm/TestConcurrentHashMapMvPartitionStorage.java
similarity index 97%
rename from modules/storage-api/src/test/java/org/apache/ignite/internal/storage/impl/TestMvPartitionStorage.java
rename to modules/storage-api/src/test/java/org/apache/ignite/internal/storage/chm/TestConcurrentHashMapMvPartitionStorage.java
index 4b2f6a375..5716d8a27 100644
--- a/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/impl/TestMvPartitionStorage.java
+++ b/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/chm/TestConcurrentHashMapMvPartitionStorage.java
@@ -5,17 +5,17 @@
* 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.
+ * limitations under the License.
*/
-package org.apache.ignite.internal.storage.impl;
+package org.apache.ignite.internal.storage.chm;
import java.util.Iterator;
import java.util.Map.Entry;
@@ -37,14 +37,14 @@ import org.jetbrains.annotations.Nullable;
/**
* Test implementation of MV partition storage.
*/
-public class TestMvPartitionStorage implements MvPartitionStorage {
+public class TestConcurrentHashMapMvPartitionStorage implements MvPartitionStorage {
private final ConcurrentMap<RowId, VersionChain> map = new ConcurrentHashMap<>();
private long lastAppliedIndex = 0;
private final int partitionId;
- public TestMvPartitionStorage(int partitionId) {
+ public TestConcurrentHashMapMvPartitionStorage(int partitionId) {
this.partitionId = partitionId;
}
diff --git a/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/chm/TestConcurrentHashMapMvTableStorage.java b/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/chm/TestConcurrentHashMapMvTableStorage.java
new file mode 100644
index 000000000..1f2aca83a
--- /dev/null
+++ b/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/chm/TestConcurrentHashMapMvTableStorage.java
@@ -0,0 +1,134 @@
+/*
+ * 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.storage.chm;
+
+import java.util.Map;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ConcurrentHashMap;
+import org.apache.ignite.configuration.schemas.table.TableConfiguration;
+import org.apache.ignite.internal.storage.MvPartitionStorage;
+import org.apache.ignite.internal.storage.StorageException;
+import org.apache.ignite.internal.storage.engine.MvTableStorage;
+import org.apache.ignite.internal.storage.index.SortedIndexDescriptor;
+import org.apache.ignite.internal.storage.index.SortedIndexStorage;
+import org.apache.ignite.internal.storage.index.impl.TestSortedIndexStorage;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Test table storage implementation.
+ */
+public class TestConcurrentHashMapMvTableStorage implements MvTableStorage {
+ private final TableConfiguration tableConfig;
+
+ private final Map<Integer, MvPartitionStorage> partitions = new ConcurrentHashMap<>();
+
+ private final Map<String, Indices> sortedIndicesByName = new ConcurrentHashMap<>();
+
+ /**
+ * Class for storing Sorted Indices for a particular partition.
+ */
+ private static class Indices {
+ private final SortedIndexDescriptor descriptor;
+
+ final Map<Integer, SortedIndexStorage> storageByPartitionId = new ConcurrentHashMap<>();
+
+ Indices(SortedIndexDescriptor descriptor) {
+ this.descriptor = descriptor;
+ }
+
+ SortedIndexStorage getOrCreateStorage(Integer partitionId) {
+ return storageByPartitionId.computeIfAbsent(partitionId, id -> new TestSortedIndexStorage(descriptor));
+ }
+ }
+
+ public TestConcurrentHashMapMvTableStorage(TableConfiguration tableCfg) {
+ this.tableConfig = tableCfg;
+ }
+
+ @Override
+ public MvPartitionStorage getOrCreateMvPartition(int partitionId) throws StorageException {
+ return partitions.computeIfAbsent(partitionId, TestConcurrentHashMapMvPartitionStorage::new);
+ }
+
+ @Override
+ @Nullable
+ public MvPartitionStorage getMvPartition(int partitionId) {
+ return partitions.get(partitionId);
+ }
+
+ @Override
+ public CompletableFuture<Void> destroyPartition(int partitionId) throws StorageException {
+ Integer boxedPartitionId = partitionId;
+
+ partitions.remove(boxedPartitionId);
+
+ sortedIndicesByName.values().forEach(indices -> indices.storageByPartitionId.remove(boxedPartitionId));
+
+ return CompletableFuture.completedFuture(null);
+ }
+
+ @Override
+ public void createIndex(String indexName) {
+ sortedIndicesByName.computeIfAbsent(indexName, name -> {
+ var descriptor = new SortedIndexDescriptor(name, tableConfig.value());
+
+ return new Indices(descriptor);
+ });
+ }
+
+ @Override
+ @Nullable
+ public SortedIndexStorage getSortedIndex(int partitionId, String indexName) {
+ Indices indices = sortedIndicesByName.get(indexName);
+
+ if (indices == null || !partitions.containsKey(partitionId)) {
+ return null;
+ }
+
+ return indices.getOrCreateStorage(partitionId);
+ }
+
+ @Override
+ public CompletableFuture<Void> destroyIndex(String indexName) {
+ sortedIndicesByName.remove(indexName);
+
+ return CompletableFuture.completedFuture(null);
+ }
+
+ @Override
+ public boolean isVolatile() {
+ return true;
+ }
+
+ @Override
+ public TableConfiguration configuration() {
+ return tableConfig;
+ }
+
+ @Override
+ public void start() throws StorageException {
+ }
+
+ @Override
+ public void stop() throws StorageException {
+ }
+
+ @Override
+ public void destroy() throws StorageException {
+ }
+}
diff --git a/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/chm/TestConcurrentHashMapStorageEngine.java b/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/chm/TestConcurrentHashMapStorageEngine.java
index 5a62821f0..18936e04d 100644
--- a/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/chm/TestConcurrentHashMapStorageEngine.java
+++ b/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/chm/TestConcurrentHashMapStorageEngine.java
@@ -54,6 +54,6 @@ public class TestConcurrentHashMapStorageEngine implements StorageEngine {
/** {@inheritDoc} */
@Override
public MvTableStorage createMvTable(TableConfiguration tableCfg) throws StorageException {
- return new TestMvTableStorage(tableCfg);
+ return new TestConcurrentHashMapMvTableStorage(tableCfg);
}
}
diff --git a/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/chm/TestMvTableStorage.java b/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/chm/TestMvTableStorage.java
deleted file mode 100644
index 80f1c989e..000000000
--- a/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/chm/TestMvTableStorage.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * 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.storage.chm;
-
-import java.util.Map;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ConcurrentHashMap;
-import org.apache.ignite.configuration.schemas.table.TableConfiguration;
-import org.apache.ignite.internal.storage.MvPartitionStorage;
-import org.apache.ignite.internal.storage.StorageException;
-import org.apache.ignite.internal.storage.engine.MvTableStorage;
-import org.apache.ignite.internal.storage.impl.TestMvPartitionStorage;
-
-/**
- * Test table storage implementation.
- */
-public class TestMvTableStorage implements MvTableStorage {
- private final TableConfiguration tableConfig;
-
- private final Map<Integer, TestMvPartitionStorage> partitions = new ConcurrentHashMap<>();
-
- public TestMvTableStorage(TableConfiguration tableCfg) {
- this.tableConfig = tableCfg;
- }
-
- @Override
- public MvPartitionStorage getOrCreateMvPartition(int partitionId) throws StorageException {
- TestMvPartitionStorage storage = partitions.get(partitionId);
-
- if (storage != null) {
- return storage;
- }
-
- partitions.put(partitionId, new TestMvPartitionStorage(partitionId));
-
- return getMvPartition(partitionId);
- }
-
- @Override
- public MvPartitionStorage getMvPartition(int partitionId) {
- return partitions.get(partitionId);
- }
-
- @Override
- public CompletableFuture<?> destroyPartition(int partitionId) throws StorageException {
- partitions.remove(partitionId);
-
- return CompletableFuture.completedFuture(null);
- }
-
- @Override
- public boolean isVolatile() {
- return true;
- }
-
- @Override
- public TableConfiguration configuration() {
- return tableConfig;
- }
-
- @Override
- public void start() throws StorageException {
- }
-
- @Override
- public void stop() throws StorageException {
- }
-
- @Override
- public void destroy() throws StorageException {
- }
-}
diff --git a/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/impl/TestRowId.java b/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/chm/TestRowId.java
similarity index 97%
rename from modules/storage-api/src/test/java/org/apache/ignite/internal/storage/impl/TestRowId.java
rename to modules/storage-api/src/test/java/org/apache/ignite/internal/storage/chm/TestRowId.java
index d73152b68..085a53156 100644
--- a/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/impl/TestRowId.java
+++ b/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/chm/TestRowId.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.ignite.internal.storage.impl;
+package org.apache.ignite.internal.storage.chm;
import java.util.Objects;
import java.util.UUID;
diff --git a/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/index/AbstractSortedIndexStorageTest.java b/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/index/AbstractSortedIndexStorageTest.java
index 7d9483faf..8a8222769 100644
--- a/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/index/AbstractSortedIndexStorageTest.java
+++ b/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/index/AbstractSortedIndexStorageTest.java
@@ -62,8 +62,8 @@ import org.apache.ignite.internal.logger.Loggers;
import org.apache.ignite.internal.schema.BinaryTuple;
import org.apache.ignite.internal.schema.SchemaTestUtils;
import org.apache.ignite.internal.storage.chm.TestConcurrentHashMapStorageEngine;
+import org.apache.ignite.internal.storage.chm.TestRowId;
import org.apache.ignite.internal.storage.chm.schema.TestConcurrentHashMapDataStorageConfigurationSchema;
-import org.apache.ignite.internal.storage.impl.TestRowId;
import org.apache.ignite.internal.storage.index.SortedIndexDescriptor.ColumnDescriptor;
import org.apache.ignite.internal.storage.index.impl.TestIndexRow;
import org.apache.ignite.internal.testframework.VariableSource;
diff --git a/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/index/impl/BinaryTupleRowSerializer.java b/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/index/impl/BinaryTupleRowSerializer.java
index 8f97989c1..96b382f6a 100644
--- a/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/index/impl/BinaryTupleRowSerializer.java
+++ b/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/index/impl/BinaryTupleRowSerializer.java
@@ -17,7 +17,6 @@
package org.apache.ignite.internal.storage.index.impl;
-import java.util.stream.IntStream;
import org.apache.ignite.internal.schema.BinaryTuple;
import org.apache.ignite.internal.schema.BinaryTupleBuilder;
import org.apache.ignite.internal.schema.BinaryTupleSchema;
@@ -25,23 +24,24 @@ import org.apache.ignite.internal.schema.BinaryTupleSchema.Element;
import org.apache.ignite.internal.storage.RowId;
import org.apache.ignite.internal.storage.index.IndexRow;
import org.apache.ignite.internal.storage.index.IndexRowSerializer;
+import org.apache.ignite.internal.storage.index.SortedIndexDescriptor;
/**
* {@link IndexRowSerializer} implementation that uses {@link BinaryTuple} as the index keys serialization mechanism.
*/
class BinaryTupleRowSerializer implements IndexRowSerializer {
- private final BinaryTupleSchema schema;
+ private final SortedIndexDescriptor descriptor;
- BinaryTupleRowSerializer(BinaryTupleSchema schema) {
- this.schema = schema;
+ BinaryTupleRowSerializer(SortedIndexDescriptor descriptor) {
+ this.descriptor = descriptor;
}
@Override
public IndexRow createIndexRow(Object[] columnValues, RowId rowId) {
- if (columnValues.length != schema.elementCount()) {
+ if (columnValues.length != descriptor.indexColumns().size()) {
throw new IllegalArgumentException(String.format(
"Incorrect number of column values passed. Expected %d, got %d",
- schema.elementCount(),
+ descriptor.indexColumns().size(),
columnValues.length
));
}
@@ -51,16 +51,17 @@ class BinaryTupleRowSerializer implements IndexRowSerializer {
@Override
public BinaryTuple createIndexRowPrefix(Object[] prefixColumnValues) {
- if (prefixColumnValues.length > schema.elementCount()) {
+ if (prefixColumnValues.length > descriptor.indexColumns().size()) {
throw new IllegalArgumentException(String.format(
"Incorrect number of column values passed. Expected not more than %d, got %d",
- schema.elementCount(),
+ descriptor.indexColumns().size(),
prefixColumnValues.length
));
}
- Element[] prefixElements = IntStream.range(0, prefixColumnValues.length)
- .mapToObj(schema::element)
+ Element[] prefixElements = descriptor.indexColumns().stream()
+ .limit(prefixColumnValues.length)
+ .map(columnDescriptor -> new Element(columnDescriptor.type(), columnDescriptor.nullable()))
.toArray(Element[]::new);
BinaryTupleSchema prefixSchema = BinaryTupleSchema.create(prefixElements);
diff --git a/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/index/impl/TestIndexRow.java b/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/index/impl/TestIndexRow.java
index aea6098c2..4dcff6c54 100644
--- a/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/index/impl/TestIndexRow.java
+++ b/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/index/impl/TestIndexRow.java
@@ -31,7 +31,7 @@ import java.util.stream.IntStream;
import org.apache.ignite.internal.schema.BinaryTuple;
import org.apache.ignite.internal.schema.SchemaTestUtils;
import org.apache.ignite.internal.storage.RowId;
-import org.apache.ignite.internal.storage.impl.TestRowId;
+import org.apache.ignite.internal.storage.chm.TestRowId;
import org.apache.ignite.internal.storage.index.IndexRow;
import org.apache.ignite.internal.storage.index.SortedIndexDescriptor.ColumnDescriptor;
import org.apache.ignite.internal.storage.index.SortedIndexStorage;
diff --git a/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/index/impl/TestSortedIndexStorage.java b/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/index/impl/TestSortedIndexStorage.java
index 5d55a0cdf..16881717e 100644
--- a/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/index/impl/TestSortedIndexStorage.java
+++ b/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/index/impl/TestSortedIndexStorage.java
@@ -27,8 +27,6 @@ import java.util.concurrent.ConcurrentNavigableMap;
import java.util.concurrent.ConcurrentSkipListMap;
import java.util.function.ToIntFunction;
import org.apache.ignite.internal.schema.BinaryTuple;
-import org.apache.ignite.internal.schema.BinaryTupleSchema;
-import org.apache.ignite.internal.schema.BinaryTupleSchema.Element;
import org.apache.ignite.internal.storage.RowId;
import org.apache.ignite.internal.storage.index.IndexRow;
import org.apache.ignite.internal.storage.index.IndexRowDeserializer;
@@ -46,25 +44,14 @@ public class TestSortedIndexStorage implements SortedIndexStorage {
private final SortedIndexDescriptor descriptor;
- private final BinaryTupleSchema schema;
-
/**
* Constructor.
*/
public TestSortedIndexStorage(SortedIndexDescriptor descriptor) {
this.descriptor = descriptor;
- this.schema = createSchema(descriptor);
this.index = new ConcurrentSkipListMap<>(BinaryTupleComparator.newComparator(descriptor));
}
- private static BinaryTupleSchema createSchema(SortedIndexDescriptor descriptor) {
- Element[] elements = descriptor.indexColumns().stream()
- .map(columnDescriptor -> new Element(columnDescriptor.type(), columnDescriptor.nullable()))
- .toArray(Element[]::new);
-
- return BinaryTupleSchema.create(elements);
- }
-
@Override
public SortedIndexDescriptor indexDescriptor() {
return descriptor;
@@ -72,7 +59,7 @@ public class TestSortedIndexStorage implements SortedIndexStorage {
@Override
public IndexRowSerializer indexRowSerializer() {
- return new BinaryTupleRowSerializer(schema);
+ return new BinaryTupleRowSerializer(descriptor);
}
@Override
diff --git a/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/AbstractPageMemoryTableStorage.java b/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/AbstractPageMemoryTableStorage.java
index 2804acce8..36190248a 100644
--- a/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/AbstractPageMemoryTableStorage.java
+++ b/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/AbstractPageMemoryTableStorage.java
@@ -31,6 +31,7 @@ import org.apache.ignite.internal.storage.PartitionStorage;
import org.apache.ignite.internal.storage.StorageException;
import org.apache.ignite.internal.storage.engine.MvTableStorage;
import org.apache.ignite.internal.storage.engine.TableStorage;
+import org.apache.ignite.internal.storage.index.SortedIndexStorage;
import org.apache.ignite.internal.storage.pagememory.mv.AbstractPageMemoryMvPartitionStorage;
import org.apache.ignite.internal.tostring.S;
import org.apache.ignite.internal.util.IgniteUtils;
@@ -183,7 +184,7 @@ public abstract class AbstractPageMemoryTableStorage implements TableStorage, Mv
/** {@inheritDoc} */
@Override
- public CompletableFuture<?> destroyPartition(int partitionId) throws StorageException {
+ public CompletableFuture<Void> destroyPartition(int partitionId) throws StorageException {
assert started : "Storage has not started yet";
MvPartitionStorage partition = getMvPartition(partitionId);
@@ -199,6 +200,22 @@ public abstract class AbstractPageMemoryTableStorage implements TableStorage, Mv
return CompletableFuture.completedFuture(null);
}
+ @Override
+ public void createIndex(String indexName) {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ @Override
+ @Nullable
+ public SortedIndexStorage getSortedIndex(int partitionId, String indexName) {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ @Override
+ public CompletableFuture<Void> destroyIndex(String indexName) {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
/**
* Closes all {@link #partitions} and {@link #autoCloseables}.
*
diff --git a/modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/RocksDbTableStorage.java b/modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/RocksDbTableStorage.java
index 84210e5d5..2dfd53320 100644
--- a/modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/RocksDbTableStorage.java
+++ b/modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/RocksDbTableStorage.java
@@ -42,6 +42,7 @@ import org.apache.ignite.internal.storage.PartitionStorage;
import org.apache.ignite.internal.storage.StorageException;
import org.apache.ignite.internal.storage.engine.MvTableStorage;
import org.apache.ignite.internal.storage.engine.TableStorage;
+import org.apache.ignite.internal.storage.index.SortedIndexStorage;
import org.apache.ignite.internal.tostring.S;
import org.apache.ignite.internal.util.IgniteSpinBusyLock;
import org.apache.ignite.internal.util.IgniteUtils;
@@ -332,7 +333,7 @@ class RocksDbTableStorage implements TableStorage, MvTableStorage {
/** {@inheritDoc} */
@Override
- public CompletableFuture<?> destroyPartition(int partitionId) throws StorageException {
+ public CompletableFuture<Void> destroyPartition(int partitionId) throws StorageException {
RocksDbMvPartitionStorage mvPartition = getMvPartition(partitionId);
if (mvPartition != null) {
@@ -344,6 +345,22 @@ class RocksDbTableStorage implements TableStorage, MvTableStorage {
return CompletableFuture.completedFuture(null);
}
+ @Override
+ public void createIndex(String indexName) {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ @Override
+ @Nullable
+ public SortedIndexStorage getSortedIndex(int partitionId, String indexName) {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ @Override
+ public CompletableFuture<Void> destroyIndex(String indexName) {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
/** {@inheritDoc} */
@Override
public boolean isVolatile() {
diff --git a/modules/table/src/integrationTest/java/org/apache/ignite/distributed/ItTablePersistenceTest.java b/modules/table/src/integrationTest/java/org/apache/ignite/distributed/ItTablePersistenceTest.java
index d1a94c64b..0b7f1fb13 100644
--- a/modules/table/src/integrationTest/java/org/apache/ignite/distributed/ItTablePersistenceTest.java
+++ b/modules/table/src/integrationTest/java/org/apache/ignite/distributed/ItTablePersistenceTest.java
@@ -38,8 +38,8 @@ import org.apache.ignite.internal.schema.NativeTypes;
import org.apache.ignite.internal.schema.SchemaDescriptor;
import org.apache.ignite.internal.schema.row.Row;
import org.apache.ignite.internal.schema.row.RowAssembler;
+import org.apache.ignite.internal.storage.chm.TestConcurrentHashMapMvPartitionStorage;
import org.apache.ignite.internal.storage.engine.MvTableStorage;
-import org.apache.ignite.internal.storage.impl.TestMvPartitionStorage;
import org.apache.ignite.internal.table.distributed.TableTxManagerImpl;
import org.apache.ignite.internal.table.distributed.raft.PartitionListener;
import org.apache.ignite.internal.table.distributed.storage.InternalTableImpl;
@@ -214,7 +214,7 @@ public class ItTablePersistenceTest extends ItAbstractListenerSnapshotTest<Parti
PartitionListener listener = new PartitionListener(
UUID.randomUUID(),
- new VersionedRowStore(new TestMvPartitionStorage(0), txManager));
+ new VersionedRowStore(new TestConcurrentHashMapMvPartitionStorage(0), txManager));
paths.put(listener, workDir);
diff --git a/modules/table/src/integrationTest/java/org/apache/ignite/distributed/ItTxDistributedTestSingleNode.java b/modules/table/src/integrationTest/java/org/apache/ignite/distributed/ItTxDistributedTestSingleNode.java
index 22494b5d7..41e5d240f 100644
--- a/modules/table/src/integrationTest/java/org/apache/ignite/distributed/ItTxDistributedTestSingleNode.java
+++ b/modules/table/src/integrationTest/java/org/apache/ignite/distributed/ItTxDistributedTestSingleNode.java
@@ -40,8 +40,8 @@ import org.apache.ignite.internal.logger.Loggers;
import org.apache.ignite.internal.raft.Loza;
import org.apache.ignite.internal.raft.server.RaftGroupOptions;
import org.apache.ignite.internal.raft.server.impl.JraftServerImpl;
+import org.apache.ignite.internal.storage.chm.TestConcurrentHashMapMvPartitionStorage;
import org.apache.ignite.internal.storage.engine.MvTableStorage;
-import org.apache.ignite.internal.storage.impl.TestMvPartitionStorage;
import org.apache.ignite.internal.table.TableImpl;
import org.apache.ignite.internal.table.TxAbstractTest;
import org.apache.ignite.internal.table.distributed.TableTxManagerImpl;
@@ -280,7 +280,7 @@ public class ItTxDistributedTestSingleNode extends TxAbstractTest {
grpId,
partNodes,
() -> new PartitionListener(tblId,
- new VersionedRowStore(new TestMvPartitionStorage(0), txManagers.get(node))),
+ new VersionedRowStore(new TestConcurrentHashMapMvPartitionStorage(0), txManagers.get(node))),
RaftGroupOptions.defaults()
);
}
diff --git a/modules/table/src/test/java/org/apache/ignite/internal/table/Example.java b/modules/table/src/test/java/org/apache/ignite/internal/table/Example.java
index 90fdf59e2..e0a62d9b5 100644
--- a/modules/table/src/test/java/org/apache/ignite/internal/table/Example.java
+++ b/modules/table/src/test/java/org/apache/ignite/internal/table/Example.java
@@ -27,7 +27,7 @@ import org.apache.ignite.binary.BinaryObjects;
import org.apache.ignite.internal.schema.Column;
import org.apache.ignite.internal.schema.NativeTypes;
import org.apache.ignite.internal.schema.SchemaDescriptor;
-import org.apache.ignite.internal.storage.impl.TestMvPartitionStorage;
+import org.apache.ignite.internal.storage.chm.TestConcurrentHashMapMvPartitionStorage;
import org.apache.ignite.internal.table.distributed.storage.VersionedRowStore;
import org.apache.ignite.internal.table.impl.DummyInternalTableImpl;
import org.apache.ignite.internal.tx.impl.HeapLockManager;
@@ -56,7 +56,7 @@ public class Example {
TxManagerImpl txManager = new TxManagerImpl(null, new HeapLockManager());
return Collections.singletonList(new TableImpl(new DummyInternalTableImpl(new VersionedRowStore(
- new TestMvPartitionStorage(0), txManager), txManager, new AtomicLong()), null));
+ new TestConcurrentHashMapMvPartitionStorage(0), txManager), txManager, new AtomicLong()), null));
}
/**
diff --git a/modules/table/src/test/java/org/apache/ignite/internal/table/InteropOperationsTest.java b/modules/table/src/test/java/org/apache/ignite/internal/table/InteropOperationsTest.java
index 426843e5f..787fa39de 100644
--- a/modules/table/src/test/java/org/apache/ignite/internal/table/InteropOperationsTest.java
+++ b/modules/table/src/test/java/org/apache/ignite/internal/table/InteropOperationsTest.java
@@ -45,7 +45,7 @@ import org.apache.ignite.internal.schema.NativeTypes;
import org.apache.ignite.internal.schema.SchemaDescriptor;
import org.apache.ignite.internal.schema.SchemaRegistry;
import org.apache.ignite.internal.schema.marshaller.RecordMarshallerTest;
-import org.apache.ignite.internal.storage.impl.TestMvPartitionStorage;
+import org.apache.ignite.internal.storage.chm.TestConcurrentHashMapMvPartitionStorage;
import org.apache.ignite.internal.table.distributed.raft.PartitionListener;
import org.apache.ignite.internal.table.distributed.storage.VersionedRowStore;
import org.apache.ignite.internal.table.impl.DummyInternalTableImpl;
@@ -122,7 +122,7 @@ public class InteropOperationsTest {
AtomicLong raftIndex = new AtomicLong();
INT_TABLE = new DummyInternalTableImpl(
- new VersionedRowStore(new TestMvPartitionStorage(0), txManager),
+ new VersionedRowStore(new TestConcurrentHashMapMvPartitionStorage(0), txManager),
txManager,
raftIndex
);
diff --git a/modules/table/src/test/java/org/apache/ignite/internal/table/KeyValueBinaryViewOperationsTest.java b/modules/table/src/test/java/org/apache/ignite/internal/table/KeyValueBinaryViewOperationsTest.java
index 633c8dd36..d641e04a9 100644
--- a/modules/table/src/test/java/org/apache/ignite/internal/table/KeyValueBinaryViewOperationsTest.java
+++ b/modules/table/src/test/java/org/apache/ignite/internal/table/KeyValueBinaryViewOperationsTest.java
@@ -31,7 +31,7 @@ import java.util.concurrent.atomic.AtomicLong;
import org.apache.ignite.internal.schema.Column;
import org.apache.ignite.internal.schema.NativeTypes;
import org.apache.ignite.internal.schema.SchemaDescriptor;
-import org.apache.ignite.internal.storage.impl.TestMvPartitionStorage;
+import org.apache.ignite.internal.storage.chm.TestConcurrentHashMapMvPartitionStorage;
import org.apache.ignite.internal.table.distributed.raft.PartitionListener;
import org.apache.ignite.internal.table.distributed.storage.VersionedRowStore;
import org.apache.ignite.internal.table.impl.DummyInternalTableImpl;
@@ -467,7 +467,7 @@ public class KeyValueBinaryViewOperationsTest {
AtomicLong raftIndex = new AtomicLong();
DummyInternalTableImpl table = new DummyInternalTableImpl(
- new VersionedRowStore(new TestMvPartitionStorage(0), txManager),
+ new VersionedRowStore(new TestConcurrentHashMapMvPartitionStorage(0), txManager),
txManager,
raftIndex
);
diff --git a/modules/table/src/test/java/org/apache/ignite/internal/table/KeyValueViewOperationsSimpleSchemaTest.java b/modules/table/src/test/java/org/apache/ignite/internal/table/KeyValueViewOperationsSimpleSchemaTest.java
index 33792e409..baab2128f 100644
--- a/modules/table/src/test/java/org/apache/ignite/internal/table/KeyValueViewOperationsSimpleSchemaTest.java
+++ b/modules/table/src/test/java/org/apache/ignite/internal/table/KeyValueViewOperationsSimpleSchemaTest.java
@@ -40,7 +40,7 @@ import org.apache.ignite.internal.schema.NativeTypeSpec;
import org.apache.ignite.internal.schema.NativeTypes;
import org.apache.ignite.internal.schema.SchemaDescriptor;
import org.apache.ignite.internal.schema.SchemaTestUtils;
-import org.apache.ignite.internal.storage.impl.TestMvPartitionStorage;
+import org.apache.ignite.internal.storage.chm.TestConcurrentHashMapMvPartitionStorage;
import org.apache.ignite.internal.table.distributed.raft.PartitionListener;
import org.apache.ignite.internal.table.distributed.storage.VersionedRowStore;
import org.apache.ignite.internal.table.impl.DummyInternalTableImpl;
@@ -722,7 +722,7 @@ public class KeyValueViewOperationsSimpleSchemaTest {
AtomicLong raftIndex = new AtomicLong();
DummyInternalTableImpl table = new DummyInternalTableImpl(
- new VersionedRowStore(new TestMvPartitionStorage(0), txManager),
+ new VersionedRowStore(new TestConcurrentHashMapMvPartitionStorage(0), txManager),
txManager,
raftIndex
);
diff --git a/modules/table/src/test/java/org/apache/ignite/internal/table/KeyValueViewOperationsTest.java b/modules/table/src/test/java/org/apache/ignite/internal/table/KeyValueViewOperationsTest.java
index 86547493d..33996e37f 100644
--- a/modules/table/src/test/java/org/apache/ignite/internal/table/KeyValueViewOperationsTest.java
+++ b/modules/table/src/test/java/org/apache/ignite/internal/table/KeyValueViewOperationsTest.java
@@ -50,7 +50,7 @@ import org.apache.ignite.internal.schema.NativeTypeSpec;
import org.apache.ignite.internal.schema.NativeTypes;
import org.apache.ignite.internal.schema.SchemaDescriptor;
import org.apache.ignite.internal.schema.testobjects.TestObjectWithAllTypes;
-import org.apache.ignite.internal.storage.impl.TestMvPartitionStorage;
+import org.apache.ignite.internal.storage.chm.TestConcurrentHashMapMvPartitionStorage;
import org.apache.ignite.internal.table.distributed.raft.PartitionListener;
import org.apache.ignite.internal.table.distributed.storage.VersionedRowStore;
import org.apache.ignite.internal.table.impl.DummyInternalTableImpl;
@@ -637,7 +637,7 @@ public class KeyValueViewOperationsTest {
AtomicLong raftIndex = new AtomicLong();
DummyInternalTableImpl table = new DummyInternalTableImpl(
- new VersionedRowStore(new TestMvPartitionStorage(0), txManager),
+ new VersionedRowStore(new TestConcurrentHashMapMvPartitionStorage(0), txManager),
txManager,
raftIndex
);
diff --git a/modules/table/src/test/java/org/apache/ignite/internal/table/RecordBinaryViewOperationsTest.java b/modules/table/src/test/java/org/apache/ignite/internal/table/RecordBinaryViewOperationsTest.java
index f70675837..e019daba3 100644
--- a/modules/table/src/test/java/org/apache/ignite/internal/table/RecordBinaryViewOperationsTest.java
+++ b/modules/table/src/test/java/org/apache/ignite/internal/table/RecordBinaryViewOperationsTest.java
@@ -35,7 +35,7 @@ import org.apache.ignite.internal.schema.InvalidTypeException;
import org.apache.ignite.internal.schema.NativeTypes;
import org.apache.ignite.internal.schema.SchemaDescriptor;
import org.apache.ignite.internal.schema.SchemaMismatchException;
-import org.apache.ignite.internal.storage.impl.TestMvPartitionStorage;
+import org.apache.ignite.internal.storage.chm.TestConcurrentHashMapMvPartitionStorage;
import org.apache.ignite.internal.table.distributed.raft.PartitionListener;
import org.apache.ignite.internal.table.distributed.storage.VersionedRowStore;
import org.apache.ignite.internal.table.impl.DummyInternalTableImpl;
@@ -698,7 +698,7 @@ public class RecordBinaryViewOperationsTest {
AtomicLong raftIndex = new AtomicLong();
DummyInternalTableImpl table = new DummyInternalTableImpl(
- new VersionedRowStore(new TestMvPartitionStorage(0), txManager),
+ new VersionedRowStore(new TestConcurrentHashMapMvPartitionStorage(0), txManager),
txManager,
raftIndex
);
diff --git a/modules/table/src/test/java/org/apache/ignite/internal/table/RecordViewOperationsTest.java b/modules/table/src/test/java/org/apache/ignite/internal/table/RecordViewOperationsTest.java
index a75b60b35..e0a502628 100644
--- a/modules/table/src/test/java/org/apache/ignite/internal/table/RecordViewOperationsTest.java
+++ b/modules/table/src/test/java/org/apache/ignite/internal/table/RecordViewOperationsTest.java
@@ -48,7 +48,7 @@ import org.apache.ignite.internal.schema.NativeTypeSpec;
import org.apache.ignite.internal.schema.NativeTypes;
import org.apache.ignite.internal.schema.SchemaDescriptor;
import org.apache.ignite.internal.schema.testobjects.TestObjectWithAllTypes;
-import org.apache.ignite.internal.storage.impl.TestMvPartitionStorage;
+import org.apache.ignite.internal.storage.chm.TestConcurrentHashMapMvPartitionStorage;
import org.apache.ignite.internal.table.distributed.raft.PartitionListener;
import org.apache.ignite.internal.table.distributed.storage.VersionedRowStore;
import org.apache.ignite.internal.table.impl.DummyInternalTableImpl;
@@ -308,7 +308,7 @@ public class RecordViewOperationsTest {
AtomicLong raftIndex = new AtomicLong();
DummyInternalTableImpl table = new DummyInternalTableImpl(
- new VersionedRowStore(new TestMvPartitionStorage(0), txManager),
+ new VersionedRowStore(new TestConcurrentHashMapMvPartitionStorage(0), txManager),
txManager,
raftIndex
);
diff --git a/modules/table/src/test/java/org/apache/ignite/internal/table/SchemaValidationTest.java b/modules/table/src/test/java/org/apache/ignite/internal/table/SchemaValidationTest.java
index 59fe31c8d..2da5deee5 100644
--- a/modules/table/src/test/java/org/apache/ignite/internal/table/SchemaValidationTest.java
+++ b/modules/table/src/test/java/org/apache/ignite/internal/table/SchemaValidationTest.java
@@ -28,7 +28,7 @@ import org.apache.ignite.internal.schema.InvalidTypeException;
import org.apache.ignite.internal.schema.NativeTypes;
import org.apache.ignite.internal.schema.SchemaDescriptor;
import org.apache.ignite.internal.schema.SchemaMismatchException;
-import org.apache.ignite.internal.storage.impl.TestMvPartitionStorage;
+import org.apache.ignite.internal.storage.chm.TestConcurrentHashMapMvPartitionStorage;
import org.apache.ignite.internal.table.distributed.raft.PartitionListener;
import org.apache.ignite.internal.table.distributed.storage.VersionedRowStore;
import org.apache.ignite.internal.table.impl.DummyInternalTableImpl;
@@ -68,7 +68,7 @@ public class SchemaValidationTest {
AtomicLong raftIndex = new AtomicLong();
DummyInternalTableImpl table = new DummyInternalTableImpl(
- new VersionedRowStore(new TestMvPartitionStorage(0), txManager),
+ new VersionedRowStore(new TestConcurrentHashMapMvPartitionStorage(0), txManager),
txManager,
raftIndex
);
diff --git a/modules/table/src/test/java/org/apache/ignite/internal/table/TxLocalTest.java b/modules/table/src/test/java/org/apache/ignite/internal/table/TxLocalTest.java
index 88aa2d8fe..892c64013 100644
--- a/modules/table/src/test/java/org/apache/ignite/internal/table/TxLocalTest.java
+++ b/modules/table/src/test/java/org/apache/ignite/internal/table/TxLocalTest.java
@@ -22,7 +22,7 @@ import static org.mockito.Answers.RETURNS_DEEP_STUBS;
import java.util.List;
import java.util.concurrent.atomic.AtomicLong;
import java.util.function.Function;
-import org.apache.ignite.internal.storage.impl.TestMvPartitionStorage;
+import org.apache.ignite.internal.storage.chm.TestConcurrentHashMapMvPartitionStorage;
import org.apache.ignite.internal.table.distributed.raft.PartitionListener;
import org.apache.ignite.internal.table.distributed.storage.VersionedRowStore;
import org.apache.ignite.internal.table.impl.DummyInternalTableImpl;
@@ -65,7 +65,7 @@ public class TxLocalTest extends TxAbstractTest {
AtomicLong accountsRaftIndex = new AtomicLong();
DummyInternalTableImpl table = new DummyInternalTableImpl(
- new VersionedRowStore(new TestMvPartitionStorage(0), txManager),
+ new VersionedRowStore(new TestConcurrentHashMapMvPartitionStorage(0), txManager),
txManager,
accountsRaftIndex
);
@@ -74,7 +74,7 @@ public class TxLocalTest extends TxAbstractTest {
AtomicLong customersRaftIndex = new AtomicLong();
DummyInternalTableImpl table2 = new DummyInternalTableImpl(
- new VersionedRowStore(new TestMvPartitionStorage(0), txManager),
+ new VersionedRowStore(new TestConcurrentHashMapMvPartitionStorage(0), txManager),
txManager,
customersRaftIndex
);
diff --git a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/raft/PartitionCommandListenerTest.java b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/raft/PartitionCommandListenerTest.java
index 9bd889772..3046b1eed 100644
--- a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/raft/PartitionCommandListenerTest.java
+++ b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/raft/PartitionCommandListenerTest.java
@@ -43,7 +43,7 @@ import org.apache.ignite.internal.schema.NativeTypes;
import org.apache.ignite.internal.schema.SchemaDescriptor;
import org.apache.ignite.internal.schema.row.Row;
import org.apache.ignite.internal.schema.row.RowAssembler;
-import org.apache.ignite.internal.storage.impl.TestMvPartitionStorage;
+import org.apache.ignite.internal.storage.chm.TestConcurrentHashMapMvPartitionStorage;
import org.apache.ignite.internal.table.distributed.command.DeleteAllCommand;
import org.apache.ignite.internal.table.distributed.command.DeleteCommand;
import org.apache.ignite.internal.table.distributed.command.DeleteExactAllCommand;
@@ -108,7 +108,7 @@ public class PartitionCommandListenerTest {
Mockito.when(clusterService.topologyService().localMember().address()).thenReturn(addr);
versionedRowStore = new VersionedRowStore(
- new TestMvPartitionStorage(0),
+ new TestConcurrentHashMapMvPartitionStorage(0),
new TxManagerImpl(clusterService, new HeapLockManager())
);