Skip to content

Commit

Permalink
GG-39117 destroy updateLogTree in volatile storage (apache#846)
Browse files Browse the repository at this point in the history
  • Loading branch information
Phillippko authored Jun 19, 2024
1 parent 87a51bb commit 8ebb622
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ CompletableFuture<Void> clearStorageAndUpdateDataStructures(AbstractPageMemoryMv
volatilePartitionStorage.updateDataStructures(
createVersionChainTree(partitionId),
createIndexMetaTree(partitionId),
createGarbageCollectionTree(partitionId)
createGarbageCollectionTree(partitionId),
createUpdateLogTree(partitionId)
);

return nullCompletedFuture();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,7 @@ protected List<AutoCloseable> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,7 @@ List<AutoCloseable> getResourcesToCloseOnCleanup() {
localState.indexMetaTree()::close,
localState.gcQueue()::close,
localState.tombstonesTree()::close,
updateLogTree::close,
blobStorage::close
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ public CompletableFuture<Void> destroyStructures() {
startMvDataDestruction(localState),
startIndexMetaTreeDestruction(localState),
startGarbageCollectionTreeDestruction(localState),
startUpdateLogTreeDestruction(),
indexes.destroyStructures()
);

Expand Down Expand Up @@ -329,6 +330,19 @@ private CompletableFuture<Void> startGarbageCollectionTreeDestruction(RenewableP
});
}

private CompletableFuture<Void> 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 <T> CompletableFuture<Void> destroyTree(BplusTree<T, ?> target, @Nullable Consumer<T> consumer) {
try {
GradualTask task = target.startGradualDestruction(consumer, false, VolatilePageMemoryStorageEngine.MAX_DESTRUCTION_WORK_UNITS);
Expand All @@ -346,7 +360,8 @@ List<AutoCloseable> getResourcesToCloseOnCleanup() {
return List.of(
localState.versionChainTree()::close,
localState.indexMetaTree()::close,
localState.gcQueue()::close
localState.gcQueue()::close,
updateLogTree::close
);
}

Expand All @@ -356,12 +371,14 @@ List<AutoCloseable> 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);

Expand All @@ -374,6 +391,8 @@ public void updateDataStructures(
gcQueue,
null
);

this.updateLogTree = updateLogTree;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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++) {
Expand Down

0 comments on commit 8ebb622

Please sign in to comment.