ibessonov commented on code in PR #4816: URL: https://github.com/apache/ignite-3/pull/4816#discussion_r1867212465
########## modules/storage-api/src/testFixtures/java/org/apache/ignite/internal/storage/AbstractMvTableStorageConcurrencyTest.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.storage; + +import static java.util.concurrent.TimeUnit.SECONDS; +import static org.apache.ignite.internal.testframework.IgniteTestUtils.runRace; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.notNullValue; + +import org.apache.ignite.internal.storage.index.HashIndexStorage; +import org.apache.ignite.internal.storage.index.SortedIndexStorage; +import org.junit.jupiter.api.RepeatedTest; +import org.junit.jupiter.api.Test; + +/** + * Test to check for race conditions in MV table storage. + */ +@SuppressWarnings("JUnitTestMethodInProductSource") +public abstract class AbstractMvTableStorageConcurrencyTest extends BaseMvTableStorageTest { + /** To be used in a loop. {@link RepeatedTest} has a smaller failure rate due to recreating the storage every time. */ Review Comment: I know that the comment is copied. Maybe we should change the justification in it, because it seems like we recreate the storage every time anyway ########## modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/mv/VolatilePageMemoryMvTableStorageConcurrencyTest.java: ########## @@ -0,0 +1,72 @@ +/* + * 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.pagememory.mv; + +import static org.apache.ignite.internal.catalog.CatalogService.DEFAULT_STORAGE_PROFILE; +import static org.apache.ignite.internal.catalog.commands.CatalogUtils.DEFAULT_PARTITION_COUNT; + +import org.apache.ignite.internal.configuration.testframework.InjectConfiguration; +import org.apache.ignite.internal.pagememory.io.PageIoRegistry; +import org.apache.ignite.internal.storage.AbstractMvTableStorageConcurrencyTest; +import org.apache.ignite.internal.storage.configurations.StorageConfiguration; +import org.apache.ignite.internal.storage.engine.MvTableStorage; +import org.apache.ignite.internal.storage.engine.StorageTableDescriptor; +import org.apache.ignite.internal.storage.pagememory.VolatilePageMemoryStorageEngine; +import org.apache.ignite.internal.storage.pagememory.configuration.schema.VolatilePageMemoryStorageEngineConfiguration; +import org.apache.ignite.internal.util.IgniteUtils; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; + +class VolatilePageMemoryMvTableStorageConcurrencyTest extends AbstractMvTableStorageConcurrencyTest { + private VolatilePageMemoryStorageEngine engine; + + @BeforeEach + void setUp( + @InjectConfiguration VolatilePageMemoryStorageEngineConfiguration engineConfig, + @InjectConfiguration("mock.profiles.default = {engine = \"aimem\"}") StorageConfiguration storageConfig Review Comment: The same question here. You don't have to fix anything, but strings without quotes in them look cleaner ########## modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/mv/PersistentPageMemoryMvTableStorageConcurrencyTest.java: ########## @@ -0,0 +1,98 @@ +/* + * 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.pagememory.mv; + +import static org.apache.ignite.internal.catalog.CatalogService.DEFAULT_STORAGE_PROFILE; +import static org.apache.ignite.internal.catalog.commands.CatalogUtils.DEFAULT_PARTITION_COUNT; +import static org.mockito.Mockito.mock; + +import java.nio.file.Path; +import org.apache.ignite.internal.components.LogSyncer; +import org.apache.ignite.internal.configuration.testframework.InjectConfiguration; +import org.apache.ignite.internal.failure.FailureManager; +import org.apache.ignite.internal.pagememory.io.PageIoRegistry; +import org.apache.ignite.internal.storage.AbstractMvTableStorageConcurrencyTest; +import org.apache.ignite.internal.storage.configurations.StorageConfiguration; +import org.apache.ignite.internal.storage.engine.MvTableStorage; +import org.apache.ignite.internal.storage.engine.StorageTableDescriptor; +import org.apache.ignite.internal.storage.pagememory.PersistentPageMemoryStorageEngine; +import org.apache.ignite.internal.storage.pagememory.configuration.schema.PersistentPageMemoryStorageEngineConfiguration; +import org.apache.ignite.internal.testframework.WorkDirectory; +import org.apache.ignite.internal.testframework.WorkDirectoryExtension; +import org.apache.ignite.internal.util.IgniteUtils; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.extension.ExtendWith; + +@ExtendWith(WorkDirectoryExtension.class) +class PersistentPageMemoryMvTableStorageConcurrencyTest extends AbstractMvTableStorageConcurrencyTest { + private PersistentPageMemoryStorageEngine engine; + + @BeforeEach + void setUp( + @WorkDirectory Path workDir, + @InjectConfiguration("mock.checkpoint.checkpointDelayMillis = 0") + PersistentPageMemoryStorageEngineConfiguration engineConfig, + @InjectConfiguration("mock.profiles.default = {engine = \"aipersist\"}") Review Comment: Will it work without quotation? ########## modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/VolatilePageMemoryTableStorage.java: ########## @@ -174,7 +178,11 @@ private VersionChainTree createVersionChainTree(int partId) throws StorageExcept CompletableFuture<Void> clearStorageAndUpdateDataStructures(AbstractPageMemoryMvPartitionStorage mvPartitionStorage) { VolatilePageMemoryMvPartitionStorage volatilePartitionStorage = (VolatilePageMemoryMvPartitionStorage) mvPartitionStorage; - volatilePartitionStorage.destroyStructures(); + volatilePartitionStorage.destroyStructures().whenComplete((res, ex) -> { + if (ex != null) { + LOG.error("Could not destroy structures", ex); Review Comment: Should there be any extra information here? Like `tableId` or something similar? -- 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]
