diff --git a/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/VolatilePageMemoryTableStorage.java b/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/VolatilePageMemoryTableStorage.java index 5445ae9b98e..06113a0fff3 100644 --- a/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/VolatilePageMemoryTableStorage.java +++ b/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/VolatilePageMemoryTableStorage.java @@ -196,7 +196,8 @@ CompletableFuture clearStorageAndUpdateDataStructures(AbstractPageMemoryMv volatilePartitionStorage.updateDataStructures( createVersionChainTree(partitionId), createIndexMetaTree(partitionId), - createGarbageCollectionTree(partitionId) + createGarbageCollectionTree(partitionId), + createUpdateLogTree(partitionId) ); return nullCompletedFuture(); diff --git a/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/mv/AbstractPageMemoryMvPartitionStorage.java b/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/mv/AbstractPageMemoryMvPartitionStorage.java index 145a4d934d3..f75fa68dc9a 100644 --- a/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/mv/AbstractPageMemoryMvPartitionStorage.java +++ b/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/mv/AbstractPageMemoryMvPartitionStorage.java @@ -819,6 +819,7 @@ protected List getResourcesToClose() { RenewablePartitionStorageState localState = renewableState; resources.add(destructionExecutor::close); + resources.add(updateLogTree::close); resources.add(localState.versionChainTree()::close); resources.add(localState.indexMetaTree()::close); resources.add(localState.gcQueue()::close); diff --git a/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/mv/PersistentPageMemoryMvPartitionStorage.java b/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/mv/PersistentPageMemoryMvPartitionStorage.java index 1ef79918ca6..dd4352f02bb 100644 --- a/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/mv/PersistentPageMemoryMvPartitionStorage.java +++ b/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/mv/PersistentPageMemoryMvPartitionStorage.java @@ -474,6 +474,7 @@ List getResourcesToCloseOnCleanup() { localState.indexMetaTree()::close, localState.gcQueue()::close, localState.tombstonesTree()::close, + updateLogTree::close, blobStorage::close ); } diff --git a/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/mv/VolatilePageMemoryMvPartitionStorage.java b/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/mv/VolatilePageMemoryMvPartitionStorage.java index 7c6e79c3645..46f312edf3b 100644 --- a/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/mv/VolatilePageMemoryMvPartitionStorage.java +++ b/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/mv/VolatilePageMemoryMvPartitionStorage.java @@ -237,6 +237,7 @@ public CompletableFuture destroyStructures() { startMvDataDestruction(localState), startIndexMetaTreeDestruction(localState), startGarbageCollectionTreeDestruction(localState), + startUpdateLogTreeDestruction(), indexes.destroyStructures() ); @@ -329,6 +330,19 @@ private CompletableFuture startGarbageCollectionTreeDestruction(RenewableP }); } + private CompletableFuture startUpdateLogTreeDestruction() { + return destroyTree(updateLogTree, null) + .whenComplete((res, e) -> { + if (e != null) { + LOG.error( + "Update log tree destruction failed: [tableId={}, partitionId={}]", + e, + tableStorage.getTableId(), partitionId + ); + } + }); + } + private CompletableFuture destroyTree(BplusTree target, @Nullable Consumer consumer) { try { GradualTask task = target.startGradualDestruction(consumer, false, VolatilePageMemoryStorageEngine.MAX_DESTRUCTION_WORK_UNITS); @@ -346,7 +360,8 @@ List getResourcesToCloseOnCleanup() { return List.of( localState.versionChainTree()::close, localState.indexMetaTree()::close, - localState.gcQueue()::close + localState.gcQueue()::close, + updateLogTree::close ); } @@ -356,12 +371,14 @@ List getResourcesToCloseOnCleanup() { * @param versionChainTree Table tree for {@link VersionChain}. * @param indexMetaTree Tree that contains SQL indexes' metadata. * @param gcQueue Garbage collection queue. + * @param updateLogTree Update log tree. * @throws StorageException If failed. */ public void updateDataStructures( VersionChainTree versionChainTree, IndexMetaTree indexMetaTree, - GcQueue gcQueue + GcQueue gcQueue, + UpdateLogTree updateLogTree ) { throwExceptionIfStorageNotInCleanupOrRebalancedState(state.get(), this::createStorageInfo); @@ -374,6 +391,8 @@ public void updateDataStructures( gcQueue, null ); + + this.updateLogTree = updateLogTree; } @Override diff --git a/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/VolatilePageMemoryMvTableStorageTest.java b/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/VolatilePageMemoryMvTableStorageTest.java index f93f81f5e14..21478b0f530 100644 --- a/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/VolatilePageMemoryMvTableStorageTest.java +++ b/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/VolatilePageMemoryMvTableStorageTest.java @@ -48,7 +48,6 @@ import org.apache.ignite.internal.util.IgniteUtils; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; /** @@ -225,7 +224,6 @@ void tableStorageDestructionFreesSortedIndexPages() throws Exception { } @Test - @Disabled("GG-39117") public void testDestroyTablesNoLeakages() { int limit = 100000; for (int i = 1; i < limit; i++) {