Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IGNITE-23919 Remove DurableBackgroundCleanupIndexTreeTask and related code #11719

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import org.apache.ignite.failure.FailureContext;
import org.apache.ignite.internal.cache.query.index.AbstractIndex;
import org.apache.ignite.internal.cache.query.index.SingleCursor;
import org.apache.ignite.internal.cache.query.index.sorted.DurableBackgroundCleanupIndexTreeTaskV2;
import org.apache.ignite.internal.cache.query.index.sorted.DurableBackgroundCleanupIndexTreeTask;
import org.apache.ignite.internal.cache.query.index.sorted.IndexKeyTypeSettings;
import org.apache.ignite.internal.cache.query.index.sorted.IndexRow;
import org.apache.ignite.internal.cache.query.index.sorted.IndexRowImpl;
Expand Down Expand Up @@ -553,7 +553,7 @@ private void destroy0(boolean softDel) throws IgniteCheckedException {
if (cctx.group().persistenceEnabled() ||
cctx.shared().kernalContext().state().clusterState().state() != INACTIVE) {
// Actual destroy index task.
DurableBackgroundCleanupIndexTreeTaskV2 task = new DurableBackgroundCleanupIndexTreeTaskV2(
DurableBackgroundCleanupIndexTreeTask task = new DurableBackgroundCleanupIndexTreeTask(
cctx.group().name(),
cctx.name(),
def.idxName().idxName(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,6 @@ org.apache.ignite.internal.cache.query.index.IndexQueryResultMeta
org.apache.ignite.internal.cache.query.index.NullsOrder
org.apache.ignite.internal.cache.query.index.SortOrder
org.apache.ignite.internal.cache.query.index.sorted.DurableBackgroundCleanupIndexTreeTask
org.apache.ignite.internal.cache.query.index.sorted.DurableBackgroundCleanupIndexTreeTaskV2
org.apache.ignite.internal.cache.query.index.sorted.IndexKeyDefinition
org.apache.ignite.internal.cache.query.index.sorted.IndexKeyType
org.apache.ignite.internal.cache.query.index.sorted.IndexKeyTypeSettings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.cache.query.index.Index;
import org.apache.ignite.internal.cache.query.index.sorted.DurableBackgroundCleanupIndexTreeTaskV2;
import org.apache.ignite.internal.cache.query.index.sorted.DurableBackgroundCleanupIndexTreeTaskV2.InlineIndexTreeFactory;
import org.apache.ignite.internal.cache.query.index.sorted.DurableBackgroundCleanupIndexTreeTask;
import org.apache.ignite.internal.cache.query.index.sorted.DurableBackgroundCleanupIndexTreeTask.InlineIndexTreeFactory;
import org.apache.ignite.internal.cache.query.index.sorted.SortedIndexDefinition;
import org.apache.ignite.internal.cache.query.index.sorted.inline.InlineIndexTree;
import org.apache.ignite.internal.pagemem.FullPageId;
Expand All @@ -50,10 +50,10 @@
import static org.apache.ignite.IgniteSystemProperties.IGNITE_MAX_INDEX_PAYLOAD_SIZE;
import static org.apache.ignite.cluster.ClusterState.ACTIVE;
import static org.apache.ignite.cluster.ClusterState.INACTIVE;
import static org.apache.ignite.internal.cache.query.index.sorted.DurableBackgroundCleanupIndexTreeTaskV2.destroyIndexTrees;
import static org.apache.ignite.internal.cache.query.index.sorted.DurableBackgroundCleanupIndexTreeTaskV2.findIndexRootPages;
import static org.apache.ignite.internal.cache.query.index.sorted.DurableBackgroundCleanupIndexTreeTaskV2.idxTreeFactory;
import static org.apache.ignite.internal.cache.query.index.sorted.DurableBackgroundCleanupIndexTreeTaskV2.toRootPages;
import static org.apache.ignite.internal.cache.query.index.sorted.DurableBackgroundCleanupIndexTreeTask.destroyIndexTrees;
import static org.apache.ignite.internal.cache.query.index.sorted.DurableBackgroundCleanupIndexTreeTask.findIndexRootPages;
import static org.apache.ignite.internal.cache.query.index.sorted.DurableBackgroundCleanupIndexTreeTask.idxTreeFactory;
import static org.apache.ignite.internal.cache.query.index.sorted.DurableBackgroundCleanupIndexTreeTask.toRootPages;
import static org.apache.ignite.testframework.GridTestUtils.cacheContext;
import static org.apache.ignite.testframework.GridTestUtils.getFieldValue;
import static org.apache.ignite.testframework.GridTestUtils.runAsync;
Expand All @@ -63,7 +63,7 @@
*/
@WithSystemProperty(key = IGNITE_MAX_INDEX_PAYLOAD_SIZE, value = "1000000")
public class DropIndexTest extends AbstractRebuildIndexTest {
/** Original {@link DurableBackgroundCleanupIndexTreeTaskV2#idxTreeFactory}. */
/** Original {@link DurableBackgroundCleanupIndexTreeTask#idxTreeFactory}. */
private InlineIndexTreeFactory originalTaskIdxTreeFactory;

/** {@inheritDoc} */
Expand All @@ -89,7 +89,7 @@ public class DropIndexTest extends AbstractRebuildIndexTest {
}

/**
* Checking {@link DurableBackgroundCleanupIndexTreeTaskV2#destroyIndexTrees}.
* Checking {@link DurableBackgroundCleanupIndexTreeTask#destroyIndexTrees}.
*
* @throws Exception If failed.
*/
Expand All @@ -99,7 +99,7 @@ public void testDestroyIndexTrees() throws Exception {
}

/**
* Check that the {@link DurableBackgroundCleanupIndexTreeTaskV2} will not
* Check that the {@link DurableBackgroundCleanupIndexTreeTask} will not
* be executed if the cache group and root pages are not found.
*
* @throws Exception If failed.
Expand All @@ -112,12 +112,12 @@ public void testTaskNotExecuteIfAbsentCacheGroupOrRootPages() throws Exception {

GridCacheContext<Integer, Person> cctx = cacheContext(n.cache(DEFAULT_CACHE_NAME));

List<DurableBackgroundCleanupIndexTreeTaskV2> tasks = F.asList(
new DurableBackgroundCleanupIndexTreeTaskV2(fake, fake, fake, fake, fake, 10, null),
new DurableBackgroundCleanupIndexTreeTaskV2(cctx.group().name(), cctx.name(), fake, fake, fake, 10, null)
List<DurableBackgroundCleanupIndexTreeTask> tasks = F.asList(
new DurableBackgroundCleanupIndexTreeTask(fake, fake, fake, fake, fake, 10, null),
new DurableBackgroundCleanupIndexTreeTask(cctx.group().name(), cctx.name(), fake, fake, fake, 10, null)
);

for (DurableBackgroundCleanupIndexTreeTaskV2 task : tasks) {
for (DurableBackgroundCleanupIndexTreeTask task : tasks) {
DurableBackgroundTaskResult<Long> res = task.executeAsync(n.context()).get(0);

assertTrue(res.completed());
Expand All @@ -127,7 +127,7 @@ public void testTaskNotExecuteIfAbsentCacheGroupOrRootPages() throws Exception {
}

/**
* Checking that the {@link DurableBackgroundCleanupIndexTreeTaskV2} will work correctly.
* Checking that the {@link DurableBackgroundCleanupIndexTreeTask} will work correctly.
*
* @throws Exception If failed.
*/
Expand Down Expand Up @@ -164,7 +164,7 @@ public void testCorrectTaskExecute() throws Exception {
assertFalse(findIndexRootPages(cctx.group(), cctx.name(), oldTreeName, segments).isEmpty());
assertTrue(findIndexRootPages(cctx.group(), cctx.name(), newTreeName, segments).isEmpty());

DurableBackgroundCleanupIndexTreeTaskV2 task = new DurableBackgroundCleanupIndexTreeTaskV2(
DurableBackgroundCleanupIndexTreeTask task = new DurableBackgroundCleanupIndexTreeTask(
cctx.group().name(),
cctx.name(),
idxName,
Expand Down Expand Up @@ -204,7 +204,7 @@ public void testCorrectTaskExecute() throws Exception {
}

/**
* Checking that the {@link DurableBackgroundCleanupIndexTreeTaskV2} will
* Checking that the {@link DurableBackgroundCleanupIndexTreeTask} will
* run when the index drop is called.
*
* @throws Exception If failed.
Expand All @@ -216,7 +216,7 @@ public void testExecuteTaskOnDropIdx() throws Exception {

/**
* Checking that when the node is restarted, the
* {@link DurableBackgroundCleanupIndexTreeTaskV2} will finish correctly.
* {@link DurableBackgroundCleanupIndexTreeTask} will finish correctly.
*
* @throws Exception If failed.
*/
Expand All @@ -237,7 +237,7 @@ public void testExecuteTaskOnDropIdxAfterRestart() throws Exception {

/**
* Checking that when the node is re-activated, the
* {@link DurableBackgroundCleanupIndexTreeTaskV2} will finish correctly.
* {@link DurableBackgroundCleanupIndexTreeTask} will finish correctly.
*
* @throws Exception If failed.
*/
Expand All @@ -251,7 +251,7 @@ public void testExecuteTaskOnDropIdxAfterReActivated() throws Exception {
}

/**
* Checking that the {@link DurableBackgroundCleanupIndexTreeTaskV2} will
* Checking that the {@link DurableBackgroundCleanupIndexTreeTask} will
* work correctly for in-memory cache.
*
* @throws Exception If failed.
Expand All @@ -263,7 +263,7 @@ public void testExecuteTaskOnDropIdxForInMemory() throws Exception {

/**
* Checking that when the node is re-activated, the
* {@link DurableBackgroundCleanupIndexTreeTaskV2} will finish correctly for in-memory cache.
* {@link DurableBackgroundCleanupIndexTreeTask} will finish correctly for in-memory cache.
*
* @throws Exception If failed.
*/
Expand All @@ -277,7 +277,7 @@ public void testExecuteTaskOnDropIdxAfterReActivatedForInMemory() throws Excepti
}

/**
* Checking {@link DurableBackgroundCleanupIndexTreeTaskV2#destroyIndexTrees} for in-memory cache.
* Checking {@link DurableBackgroundCleanupIndexTreeTask#destroyIndexTrees} for in-memory cache.
*
* @throws Exception If failed.
*/
Expand All @@ -287,7 +287,7 @@ public void testDestroyIndexTreesForInMemory() throws Exception {
}

/**
* Checks that {@link DurableBackgroundCleanupIndexTreeTaskV2} will not be
* Checks that {@link DurableBackgroundCleanupIndexTreeTask} will not be
* added when the cluster is deactivated for in-memory caches.
*
* @throws Exception If failed.
Expand Down Expand Up @@ -344,7 +344,7 @@ private Map<String, DurableBackgroundTaskState<?>> tasks(IgniteEx n) {
}

/**
* Getting {@link DurableBackgroundCleanupIndexTreeTaskV2} name prefix.
* Getting {@link DurableBackgroundCleanupIndexTreeTask} name prefix.
*
* @param cacheName Cache name.
* @param idxName Index name.
Expand Down Expand Up @@ -394,7 +394,7 @@ private List<List<?>> dropIdx(IgniteCache<Integer, Person> cache, String idxName
}

/**
* Check that the {@link DurableBackgroundCleanupIndexTreeTaskV2} will be completed successfully.
* Check that the {@link DurableBackgroundCleanupIndexTreeTask} will be completed successfully.
*
* @param persistent Persistent default data region.
* @param expRes Expected result should not be less than which.
Expand Down Expand Up @@ -438,7 +438,7 @@ private void checkExecuteTask(

/**
* Check that after restart / reactivation of the node,
* the {@link DurableBackgroundCleanupIndexTreeTaskV2} will be completed successfully.
* the {@link DurableBackgroundCleanupIndexTreeTask} will be completed successfully.
*
* @param persistent Persistent default data region.
* @param expRes Expected result should not be less than which, or {@code null} if there should be no result.
Expand Down Expand Up @@ -492,7 +492,7 @@ private void checkExecuteTaskAfterRestart(
}

/**
* Checking {@link DurableBackgroundCleanupIndexTreeTaskV2#destroyIndexTrees}.
* Checking {@link DurableBackgroundCleanupIndexTreeTask#destroyIndexTrees}.
*
* @param persistent Persistent default data region.
* @param expRes Expected result should not be less than which.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.cache.query.index.IndexProcessor;
import org.apache.ignite.internal.cache.query.index.sorted.DurableBackgroundCleanupIndexTreeTaskV2;
import org.apache.ignite.internal.cache.query.index.sorted.DurableBackgroundCleanupIndexTreeTask;
import org.apache.ignite.internal.cache.query.index.sorted.IndexRowImpl;
import org.apache.ignite.internal.cache.query.index.sorted.inline.InlineIndexImpl;
import org.apache.ignite.internal.cache.query.index.sorted.inline.InlineIndexTree;
Expand Down Expand Up @@ -209,8 +209,8 @@ public void testCorruptedTree() throws Exception {
Collection<DurableBackgroundTaskState<?>> durableTasks = tasks(srv.context().durableBackgroundTask()).values();

Map<Integer, Set<String>> idxTasksByCache = durableTasks.stream().collect(Collectors.groupingBy(
state -> CU.cacheId(((DurableBackgroundCleanupIndexTreeTaskV2)state.task()).cacheName()),
Collectors.mapping(state -> ((DurableBackgroundCleanupIndexTreeTaskV2)state.task()).idxName(), toSet())
state -> CU.cacheId(((DurableBackgroundCleanupIndexTreeTask)state.task()).cacheName()),
Collectors.mapping(state -> ((DurableBackgroundCleanupIndexTreeTask)state.task()).idxName(), toSet())
));

checkCacheToCorruptedIndexMap(idxTasksByCache);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import org.apache.ignite.IgniteCache;
import org.apache.ignite.client.Person;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.cache.query.index.sorted.DurableBackgroundCleanupIndexTreeTaskV2;
import org.apache.ignite.internal.cache.query.index.sorted.DurableBackgroundCleanupIndexTreeTask;
import org.apache.ignite.internal.cache.query.index.sorted.SortedIndexDefinition;
import org.apache.ignite.internal.cache.query.index.sorted.inline.InlineIndexImpl;
import org.apache.ignite.internal.cache.query.index.sorted.inline.InlineIndexTree;
Expand All @@ -48,8 +48,8 @@
import static java.util.stream.Collectors.toList;
import static java.util.stream.Collectors.toSet;
import static java.util.stream.StreamSupport.stream;
import static org.apache.ignite.internal.cache.query.index.sorted.DurableBackgroundCleanupIndexTreeTaskV2.findIndexRootPages;
import static org.apache.ignite.internal.cache.query.index.sorted.DurableBackgroundCleanupIndexTreeTaskV2.renameIndexRootPages;
import static org.apache.ignite.internal.cache.query.index.sorted.DurableBackgroundCleanupIndexTreeTask.findIndexRootPages;
import static org.apache.ignite.internal.cache.query.index.sorted.DurableBackgroundCleanupIndexTreeTask.renameIndexRootPages;
import static org.apache.ignite.internal.pagemem.wal.record.WALRecord.RecordType.INDEX_ROOT_PAGE_RENAME_RECORD;
import static org.apache.ignite.internal.processors.cache.persistence.IndexStorageImpl.MAX_IDX_NAME_LEN;
import static org.apache.ignite.testframework.GridTestUtils.assertThrows;
Expand Down Expand Up @@ -217,8 +217,8 @@ public void testIndexRenameRootPageRecord() throws Exception {
}

/**
* Checking the correctness of {@link DurableBackgroundCleanupIndexTreeTaskV2#findIndexRootPages}
* and {@link DurableBackgroundCleanupIndexTreeTaskV2#renameIndexRootPages}.
* Checking the correctness of {@link DurableBackgroundCleanupIndexTreeTask#findIndexRootPages}
* and {@link DurableBackgroundCleanupIndexTreeTask#renameIndexRootPages}.
*
* @throws Exception If failed.
*/
Expand Down Expand Up @@ -280,7 +280,7 @@ public void testRenameFromTask() throws Exception {
}

/**
* Tests that {@link DurableBackgroundCleanupIndexTreeTaskV2#renameIndexTrees(CacheGroupContext)}
* Tests that {@link DurableBackgroundCleanupIndexTreeTask#renameIndexTrees(CacheGroupContext)}
* can be run before submitting the task.
*
* @throws Exception If failed.
Expand All @@ -302,7 +302,7 @@ public void testRenameBeforeRunningTask() throws Exception {

InlineIndexTree[] segments = getFieldValue(idx, "segments");

DurableBackgroundCleanupIndexTreeTaskV2 task = new DurableBackgroundCleanupIndexTreeTaskV2(
DurableBackgroundCleanupIndexTreeTask task = new DurableBackgroundCleanupIndexTreeTask(
cctx.group().name(),
cctx.name(),
idxName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,9 @@
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.failure.StopNodeFailureHandler;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.cache.query.index.IndexName;
import org.apache.ignite.internal.cache.query.index.sorted.DurableBackgroundCleanupIndexTreeTask;
import org.apache.ignite.internal.cache.query.index.sorted.DurableBackgroundCleanupIndexTreeTaskV2;
import org.apache.ignite.internal.cache.query.index.sorted.DurableBackgroundCleanupIndexTreeTaskV2.InlineIndexTreeFactory;
import org.apache.ignite.internal.cache.query.index.sorted.DurableBackgroundCleanupIndexTreeTaskV2.NoopRowHandlerFactory;
import org.apache.ignite.internal.cache.query.index.sorted.DurableBackgroundCleanupIndexTreeTask.InlineIndexTreeFactory;
import org.apache.ignite.internal.cache.query.index.sorted.DurableBackgroundCleanupIndexTreeTask.NoopRowHandlerFactory;
import org.apache.ignite.internal.cache.query.index.sorted.IndexKeyTypeSettings;
import org.apache.ignite.internal.cache.query.index.sorted.IndexRow;
import org.apache.ignite.internal.cache.query.index.sorted.IndexRowCache;
Expand Down Expand Up @@ -81,7 +79,6 @@
import org.apache.ignite.internal.processors.cache.persistence.tree.reuse.LongListReuseBag;
import org.apache.ignite.internal.processors.cache.persistence.tree.reuse.ReuseList;
import org.apache.ignite.internal.util.lang.GridTuple3;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.visor.VisorTaskArgument;
import org.apache.ignite.lang.IgniteInClosure;
import org.apache.ignite.testframework.CallbackExecutorLogListener;
Expand All @@ -93,15 +90,13 @@
import org.apache.ignite.thread.IgniteThread;
import org.junit.Test;

import static java.util.Collections.emptyList;
import static java.util.stream.Collectors.toList;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_SYSTEM_WORKER_BLOCKED_TIMEOUT;
import static org.apache.ignite.cluster.ClusterState.ACTIVE;
import static org.apache.ignite.cluster.ClusterState.INACTIVE;
import static org.apache.ignite.internal.cache.query.index.sorted.DurableBackgroundCleanupIndexTreeTaskV2.idxTreeFactory;
import static org.apache.ignite.internal.cache.query.index.sorted.DurableBackgroundCleanupIndexTreeTask.idxTreeFactory;
import static org.apache.ignite.internal.processors.query.QueryUtils.DFLT_SCHEMA;
import static org.apache.ignite.internal.util.IgniteUtils.EMPTY_UUIDS;
import static org.apache.ignite.testframework.GridTestUtils.getFieldValue;

/**
* Tests case when long index deletion operation happens.
Expand Down Expand Up @@ -173,7 +168,7 @@ public class LongDestroyDurableBackgroundTaskTest extends GridCommonAbstractTest
/** */
private DurableBackgroundTaskTestListener durableBackgroundTaskTestLsnr;

/** Original {@link DurableBackgroundCleanupIndexTreeTaskV2#idxTreeFactory}. */
/** Original {@link DurableBackgroundCleanupIndexTreeTask#idxTreeFactory}. */
private InlineIndexTreeFactory originalFactory;

/** */
Expand Down Expand Up @@ -781,38 +776,6 @@ public void testIndexDeletionTaskRemovedAfterCheckpointFinished() throws Excepti
assertTrue(durableBackgroundTaskTestLsnr.check());
}

/**
* Checking the converting of the old problem into the new one.
*/
@Test
public void testConvertOldTaskToNew() {
String grpName = "grpTest";
String cacheName = "cacheTest";
String treeName = "treeTest";
String idxName = "idxTest";

List<Long> pages = F.asList(100L);

DurableBackgroundCleanupIndexTreeTask oldTask = new DurableBackgroundCleanupIndexTreeTask(
pages,
emptyList(),
grpName,
cacheName,
new IndexName(cacheName, "schemaTest", "tableTest", idxName),
treeName
);

DurableBackgroundTask convertedTask = oldTask.convertAfterRestoreIfNeeded();
assertTrue(convertedTask instanceof DurableBackgroundCleanupIndexTreeTaskV2);

assertEquals(grpName, getFieldValue(convertedTask, "grpName"));
assertEquals(cacheName, getFieldValue(convertedTask, "cacheName"));
assertEquals(treeName, getFieldValue(convertedTask, "oldTreeName"));
assertNotNull(getFieldValue(convertedTask, "newTreeName"));
assertEquals(idxName, getFieldValue(convertedTask, "idxName"));
assertEquals(pages.size(), (int)getFieldValue(convertedTask, "segments"));
}

/** */
private class InlineIndexTreeTest extends InlineIndexTree {
/** */
Expand Down
Loading
Loading