IGNITE-4810: Removed index rebuild methods.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6fda2c20 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6fda2c20 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6fda2c20 Branch: refs/heads/ignite-4705-2 Commit: 6fda2c203b82314acff190304168b40043f587c3 Parents: 5899cc3 Author: devozerov <voze...@gridgain.com> Authored: Fri Mar 10 13:10:07 2017 +0300 Committer: devozerov <voze...@gridgain.com> Committed: Fri Mar 10 13:10:07 2017 +0300 ---------------------------------------------------------------------- .../cache/query/GridCacheQueryManager.java | 18 -- .../processors/query/GridQueryIndexing.java | 8 - .../processors/query/GridQueryProcessor.java | 102 -------- .../processors/query/h2/IgniteH2Indexing.java | 13 - .../query/h2/opt/GridH2IndexBase.java | 10 - .../processors/query/h2/opt/GridH2Table.java | 33 --- .../query/h2/opt/GridH2TreeIndex.java | 23 -- .../query/h2/GridH2IndexRebuildTest.java | 261 ------------------- .../h2/GridIndexingSpiAbstractSelfTest.java | 17 -- .../query/h2/opt/GridH2TableSelfTest.java | 54 ---- .../IgniteCacheQuerySelfTestSuite.java | 2 - 11 files changed, 541 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/6fda2c20/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java index b92ecaf..93dee54 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java @@ -324,24 +324,6 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte } /** - * Rebuilds all search indexes of given value type. - * - * @param typeName Value type name. - * @return Future that will be completed when rebuilding of all indexes is finished. - */ - public IgniteInternalFuture<?> rebuildIndexes(String typeName) { - if (!enterBusy()) - throw new IllegalStateException("Failed to rebuild indexes (grid is stopping)."); - - try { - return qryProc.rebuildIndexes(space, typeName); - } - finally { - leaveBusy(); - } - } - - /** * Marks this request as canceled. * * @param reqId Request id. http://git-wip-us.apache.org/repos/asf/ignite/blob/6fda2c20/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java index ca04724..629de78 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java @@ -208,14 +208,6 @@ public interface GridQueryIndexing { public void onUnswap(@Nullable String spaceName, CacheObject key, CacheObject val) throws IgniteCheckedException; /** - * Rebuilds all indexes of given type. - * - * @param spaceName Space name. - * @param type Type descriptor. - */ - public void rebuildIndexes(@Nullable String spaceName, GridQueryTypeDescriptor type); - - /** * Returns backup filter. * * @param topVer Topology version. http://git-wip-us.apache.org/repos/asf/ignite/blob/6fda2c20/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java index 1c5b822..176178c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java @@ -35,7 +35,6 @@ import java.util.Map; import java.util.Set; import java.util.UUID; import java.util.concurrent.ConcurrentMap; -import java.util.concurrent.ExecutorService; import javax.cache.Cache; import javax.cache.CacheException; import org.apache.ignite.IgniteCheckedException; @@ -52,7 +51,6 @@ import org.apache.ignite.cache.query.SqlQuery; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.events.CacheQueryExecutedEvent; import org.apache.ignite.internal.GridKernalContext; -import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.internal.binary.BinaryMarshaller; import org.apache.ignite.internal.processors.GridProcessorAdapter; import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion; @@ -75,16 +73,12 @@ import org.apache.ignite.internal.processors.query.property.QueryPropertyAccesso import org.apache.ignite.internal.processors.query.property.QueryReadOnlyMethodsAccessor; import org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor; import org.apache.ignite.internal.util.GridSpinBusyLock; -import org.apache.ignite.internal.util.future.GridCompoundFuture; -import org.apache.ignite.internal.util.future.GridFinishedFuture; import org.apache.ignite.internal.util.lang.GridCloseableIterator; import org.apache.ignite.internal.util.lang.GridClosureException; import org.apache.ignite.internal.util.lang.IgniteOutClosureX; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.internal.A; import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.internal.util.worker.GridWorker; -import org.apache.ignite.internal.util.worker.GridWorkerFuture; import org.apache.ignite.lang.IgniteBiTuple; import org.apache.ignite.lang.IgniteFuture; import org.apache.ignite.spi.indexing.IndexingQueryFilter; @@ -139,9 +133,6 @@ public class GridQueryProcessor extends GridProcessorAdapter { private final ConcurrentMap<QueryTypeNameKey, QueryTypeDescriptorImpl> typesByName = new ConcurrentHashMap8<>(); /** */ - private ExecutorService execSvc; - - /** */ private final GridQueryIndexing idx; /** */ @@ -172,8 +163,6 @@ public class GridQueryProcessor extends GridProcessorAdapter { if (idx != null) { ctx.resource().injectGeneric(idx); - execSvc = ctx.getExecutorService(); - idx.start(ctx, busyLock); } @@ -556,97 +545,6 @@ public class GridQueryProcessor extends GridProcessorAdapter { } /** - * Rebuilds all search indexes of given value type for given space of spi. - * - * @param space Space. - * @param valTypeName Value type name. - * @return Future that will be completed when rebuilding of all indexes is finished. - */ - public IgniteInternalFuture<?> rebuildIndexes(@Nullable final String space, String valTypeName) { - if (!busyLock.enterBusy()) - throw new IllegalStateException("Failed to rebuild indexes (grid is stopping)."); - - try { - return rebuildIndexes( - space, - typesByName.get( - new QueryTypeNameKey( - space, - valTypeName))); - } - finally { - busyLock.leaveBusy(); - } - } - - /** - * @param space Space. - * @param desc Type descriptor. - * @return Future that will be completed when rebuilding of all indexes is finished. - */ - private IgniteInternalFuture<?> rebuildIndexes(@Nullable final String space, @Nullable final QueryTypeDescriptorImpl desc) { - if (idx == null) - return new GridFinishedFuture<>(new IgniteCheckedException("Indexing is disabled.")); - - if (desc == null || !desc.registered()) - return new GridFinishedFuture<Void>(); - - final GridWorkerFuture<?> fut = new GridWorkerFuture<Void>(); - - GridWorker w = new GridWorker(ctx.gridName(), "index-rebuild-worker", log) { - @Override protected void body() { - try { - idx.rebuildIndexes(space, desc); - - fut.onDone(); - } - catch (Exception e) { - fut.onDone(e); - } - catch (Throwable e) { - log.error("Failed to rebuild indexes for type: " + desc.name(), e); - - fut.onDone(e); - - if (e instanceof Error) - throw e; - } - } - }; - - fut.setWorker(w); - - execSvc.execute(w); - - return fut; - } - - /** - * Rebuilds all search indexes for given spi. - * - * @return Future that will be completed when rebuilding of all indexes is finished. - */ - @SuppressWarnings("unchecked") - public IgniteInternalFuture<?> rebuildAllIndexes() { - if (!busyLock.enterBusy()) - throw new IllegalStateException("Failed to get space size (grid is stopping)."); - - try { - GridCompoundFuture<?, ?> fut = new GridCompoundFuture<Object, Object>(); - - for (Map.Entry<QueryTypeIdKey, QueryTypeDescriptorImpl> e : types.entrySet()) - fut.add((IgniteInternalFuture)rebuildIndexes(e.getKey().space(), e.getValue())); - - fut.markInitialized(); - - return fut; - } - finally { - busyLock.leaveBusy(); - } - } - - /** * @param space Space name. * @return Cache object context. */ http://git-wip-us.apache.org/repos/asf/ignite/blob/6fda2c20/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java index a26406d..2f8faa4 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java @@ -1699,19 +1699,6 @@ public class IgniteH2Indexing implements GridQueryIndexing { return schema.spaceName; } - /** {@inheritDoc} */ - @Override public void rebuildIndexes(@Nullable String spaceName, GridQueryTypeDescriptor type) { - TableDescriptor tbl = tableDescriptor(spaceName, type); - - if (tbl == null) - return; - - if (tbl.schema.offheap != null) - throw new UnsupportedOperationException("Index rebuilding is not supported when off-heap memory is used"); - - tbl.tbl.rebuildIndexes(); - } - /** * Gets size (for tests only). * http://git-wip-us.apache.org/repos/asf/ignite/blob/6fda2c20/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java index bab219c..5669fd0 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java @@ -178,16 +178,6 @@ public abstract class GridH2IndexBase extends BaseIndex { } /** - * If the index supports rebuilding it has to creates its own copy. - * - * @return Rebuilt copy. - * @throws InterruptedException If interrupted. - */ - public GridH2IndexBase rebuild() throws InterruptedException { - return this; - } - - /** * Put row if absent. * * @param row Row. http://git-wip-us.apache.org/repos/asf/ignite/blob/6fda2c20/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java index 8d080ae..ca1bcb0 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java @@ -639,39 +639,6 @@ public class GridH2Table extends TableBase { return res; } - /** - * Rebuilds all indexes of this table. - */ - public void rebuildIndexes() { - if (!snapshotEnabled) - return; - - Lock l = lock(true, Long.MAX_VALUE); - - ArrayList<Index> idxs0 = new ArrayList<>(idxs); - - try { - snapshotIndexes(null); // Allow read access while we are rebuilding indexes. - - for (int i = 1, len = idxs.size(); i < len; i++) { - GridH2IndexBase newIdx = index(i).rebuild(); - - idxs.set(i, newIdx); - - if (i == 1) // ScanIndex at 0 and actualSnapshot can contain references to old indexes, reset them. - idxs.set(0, new ScanIndex(newIdx)); - } - } - catch (InterruptedException e) { - throw new IgniteInterruptedException(e); - } - finally { - releaseSnapshots0(idxs0); - - unlock(l); - } - } - /** {@inheritDoc} */ @Override public Index addIndex(Session ses, String s, int i, IndexColumn[] idxCols, IndexType idxType, boolean b, String s1) { http://git-wip-us.apache.org/repos/asf/ignite/blob/6fda2c20/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java index 914e0da..aa0846f 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java @@ -27,7 +27,6 @@ import org.apache.ignite.internal.util.GridEmptyIterator; import org.apache.ignite.internal.util.offheap.unsafe.GridOffHeapSnapTreeMap; import org.apache.ignite.internal.util.offheap.unsafe.GridUnsafeGuard; import org.apache.ignite.internal.util.snaptree.SnapTreeMap; -import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.internal.SB; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.spi.indexing.IndexingQueryFilter; @@ -457,26 +456,4 @@ public class GridH2TreeIndex extends GridH2IndexBase implements Comparator<GridS throw new IllegalStateException(); } } - - /** {@inheritDoc} */ - @Override public GridH2TreeIndex rebuild() throws InterruptedException { - IndexColumn[] cols = getIndexColumns(); - - GridH2TreeIndex idx = new GridH2TreeIndex(getName(), getTable(), - getIndexType().isUnique(), F.asList(cols)); - - Thread thread = Thread.currentThread(); - - long i = 0; - - for (GridH2Row row : tree.values()) { - // Check for interruptions every 1000 iterations. - if (++i % 1000 == 0 && thread.isInterrupted()) - throw new InterruptedException(); - - idx.tree.put(row, row); - } - - return idx; - } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/6fda2c20/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridH2IndexRebuildTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridH2IndexRebuildTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridH2IndexRebuildTest.java deleted file mode 100644 index 2dec475..0000000 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridH2IndexRebuildTest.java +++ /dev/null @@ -1,261 +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.processors.query.h2; - -import java.util.ArrayList; -import java.util.concurrent.Callable; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.cache.query.SqlQuery; -import org.apache.ignite.cache.query.annotations.QuerySqlField; -import org.apache.ignite.cache.query.annotations.QueryTextField; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.internal.IgniteFutureCancelledCheckedException; -import org.apache.ignite.internal.IgniteInternalFuture; -import org.apache.ignite.internal.IgniteInterruptedCheckedException; -import org.apache.ignite.internal.processors.cache.GridCacheAbstractSelfTest; -import org.apache.ignite.internal.processors.query.GridQueryProcessor; -import org.apache.ignite.internal.processors.query.GridQueryTypeDescriptor; -import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.testframework.GridTestUtils; -import org.jetbrains.annotations.Nullable; - -/** - */ -public class GridH2IndexRebuildTest extends GridCacheAbstractSelfTest { - /** */ - private static final int GRID_CNT = 1; - - /** {@inheritDoc} */ - @Override protected int gridCount() { - return GRID_CNT; - } - - /** - * Overrides rebuildIndexes to check it can be interrupted. - */ - private static class SleepingH2Indexing extends IgniteH2Indexing { - /** */ - private volatile boolean sleepInRebuild; - - /** */ - private volatile CountDownLatch interrupted; - - /** - * Constructor. - */ - public SleepingH2Indexing() { - spi = this; - } - - /** {@inheritDoc} */ - @Override public void rebuildIndexes(@Nullable String spaceName, GridQueryTypeDescriptor type) { - if (sleepInRebuild) { - try { - U.sleep(Long.MAX_VALUE); - } - catch (IgniteInterruptedCheckedException ignored) { - interrupted.countDown(); - } - } - - super.rebuildIndexes(spaceName, type); - } - } - - /** */ - private static SleepingH2Indexing spi; - - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { - IgniteConfiguration cfg = super.getConfiguration(gridName); - - GridQueryProcessor.idxCls = SleepingH2Indexing.class; - - return cfg; - } - - /** - * Value class with regular and compound indexes. - */ - @SuppressWarnings("UnusedDeclaration") - private static class TestValue1 { - /** */ - @QuerySqlField(index = true) - private long val1; - - /** */ - @QuerySqlField(index = true) - private String val2; - - /** */ - @QuerySqlField(groups = "group1") - private int val3; - - /** */ - @QuerySqlField(groups = "group1") - private int val4; - - /** - */ - TestValue1(long val1, String val2, int val3, int val4) { - this.val1 = val1; - this.val2 = val2; - this.val3 = val3; - this.val4 = val4; - } - } - - /** - * Value class with regular and text indexes. - */ - @SuppressWarnings("UnusedDeclaration") - private static class TestValue2 { - /** */ - @QuerySqlField(index = true) - private long val1; - - /** */ - @QueryTextField - private String val2; - - /** - */ - TestValue2(long val1, String val2) { - this.val1 = val1; - this.val2 = val2; - } - } - - /** */ - private static final int ENTRY_CNT = 10000; - - /** {@inheritDoc} */ - @Override protected Class<?>[] indexedTypes() { - return new Class<?>[] { - Integer.class, TestValue1.class, - Integer.class, TestValue2.class - }; - } - - /** - * @throws Exception if failed. - */ - public void testRebuildIndexes() throws Exception { - grid(0).context().query().rebuildIndexes(null, ArrayList.class.getName()).get(); - - grid(0).context().query().rebuildAllIndexes().get(); - - IgniteCache<Integer, TestValue1> cache1 = grid(0).cache(null); - IgniteCache<Integer, TestValue2> cache2 = grid(0).cache(null); - - for (int i = 0; i < ENTRY_CNT; i++) { - cache1.put(i, new TestValue1(i, "val2-" + i, i, i)); - cache2.put(ENTRY_CNT * 2 + i, new TestValue2(i, "val2-" + i)); - } - - SqlQuery<Integer, TestValue1> qry1 = new SqlQuery(TestValue1.class, "val1 = 9000"); - - SqlQuery<Integer, TestValue1> qry2 = new SqlQuery(TestValue1.class, "val2 = 'val2-9000'"); - - SqlQuery<Integer, TestValue1> qry3 = new SqlQuery(TestValue1.class, "val3 = 9000 and val4 = 9000"); - - SqlQuery<Integer, TestValue2> qry4 = new SqlQuery(TestValue2.class, "val1 = 9000"); - - SqlQuery<Integer, TestValue2> qry5 = new SqlQuery(TestValue2.class, "val2 = 'val2-9000'"); - - assertEquals(1, cache1.query(qry1).getAll().size()); - assertEquals(1, cache1.query(qry2).getAll().size()); - assertEquals(1, cache1.query(qry3).getAll().size()); - assertEquals(1, cache2.query(qry4).getAll().size()); - assertEquals(1, cache2.query(qry5).getAll().size()); - - for (int i = 0; i < ENTRY_CNT / 2; i++) { - cache1.remove(i); - cache2.remove(ENTRY_CNT * 2 + i); - } - - grid(0).context().query().rebuildIndexes(null, TestValue1.class.getName()).get(); - grid(0).context().query().rebuildIndexes(null, TestValue2.class.getName()).get(); - - assertEquals(1, cache1.query(qry1).getAll().size()); - assertEquals(1, cache1.query(qry2).getAll().size()); - assertEquals(1, cache1.query(qry3).getAll().size()); - assertEquals(1, cache2.query(qry4).getAll().size()); - assertEquals(1, cache2.query(qry5).getAll().size()); - - grid(0).context().query().rebuildAllIndexes().get(); - - assertEquals(1, cache1.query(qry1).getAll().size()); - assertEquals(1, cache1.query(qry2).getAll().size()); - assertEquals(1, cache1.query(qry3).getAll().size()); - assertEquals(1, cache2.query(qry4).getAll().size()); - assertEquals(1, cache2.query(qry5).getAll().size()); - } - - /** - * @throws Exception if failed. - */ - public void testRebuildInterrupted() throws Exception { - spi.sleepInRebuild = true; - - IgniteCache<Integer, TestValue1> cache1 = grid(0).cache(null); - IgniteCache<Integer, TestValue2> cache2 = grid(0).cache(null); - - cache1.put(0, new TestValue1(0, "val0", 0 ,0)); - cache2.put(1, new TestValue2(0, "val0")); - - checkCancel(grid(0).context().query().rebuildIndexes(null, "TestValue1")); - - checkCancel(grid(0).context().query().rebuildAllIndexes()); - - spi.sleepInRebuild = false; - - final IgniteInternalFuture<?> fut1 = grid(0).context().query().rebuildIndexes(null, TestValue1.class.getName()); - - assertFalse(fut1.isCancelled()); - - fut1.get(); - - final IgniteInternalFuture<?> fut2 = grid(0).context().query().rebuildAllIndexes();; - - assertFalse(fut2.isCancelled()); - - fut2.get(); - } - - /** - * @param fut Future. - * @throws Exception if failed. - */ - private void checkCancel(final IgniteInternalFuture<?> fut) throws Exception { - spi.interrupted = new CountDownLatch(1); - - assertTrue(fut.cancel()); - - GridTestUtils.assertThrows(log, new Callable<Void>() { - @Override public Void call() throws Exception { - fut.get(); - return null; - } - }, IgniteFutureCancelledCheckedException.class, null); - - assertTrue(spi.interrupted.await(5, TimeUnit.SECONDS)); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/6fda2c20/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java index 3b31051..49914c5 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java @@ -392,23 +392,6 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract assertEquals(2, spi.size(typeAB.space(), typeAB)); assertEquals(0, spi.size(typeBA.space(), typeBA)); - boolean h2IdxOffheap = offheap(); - - // At the time of this writing index rebuilding is not supported for GridH2Indexing with off-heap storage. - if (!h2IdxOffheap) { - // Rebuild - - spi.rebuildIndexes(typeAB.space(), typeAB); - - assertEquals(1, spi.size(typeAA.space(), typeAA)); - assertEquals(2, spi.size(typeAB.space(), typeAB)); - assertEquals(0, spi.size(typeBA.space(), typeBA)); - - // For invalid space name/type should not fail. - spi.rebuildIndexes("not_existing_space", typeAA); - spi.rebuildIndexes(typeAA.space(), new TypeDesc("C", "C", fieldsAA, null)); - } - // Unregister. spi.unregisterType(typeAA.space(), typeAA); http://git-wip-us.apache.org/repos/asf/ignite/blob/6fda2c20/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TableSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TableSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TableSelfTest.java index 8408ba0..a3baad4 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TableSelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TableSelfTest.java @@ -46,7 +46,6 @@ import org.h2.value.ValueString; import org.h2.value.ValueTimestamp; import org.h2.value.ValueUuid; import org.jetbrains.annotations.Nullable; -import org.junit.Assert; /** * Tests H2 Table. @@ -274,18 +273,6 @@ public class GridH2TableSelfTest extends GridCommonAbstractTest { } /** - * Dumps all table rows for index. - * - * @param idx Index. - */ - private void dumpRows(GridH2TreeIndex idx) { - Iterator<GridH2Row> iter = idx.rows(); - - while (iter.hasNext()) - System.out.println(iter.next().toString()); - } - - /** * Multithreaded indexes consistency test. * * @throws Exception If failed. @@ -512,47 +499,6 @@ public class GridH2TableSelfTest extends GridCommonAbstractTest { } /** - * @throws Exception If failed. - */ - public void testRebuildIndexes() throws Exception { - ArrayList<GridH2IndexBase> idxsBefore = tbl.indexes(); - - assertEquals(3, idxsBefore.size()); - - Random rnd = new Random(); - - for (int i = 0; i < MAX_X; i++) { - UUID id = UUID.randomUUID(); - - GridH2Row row = row(id, System.currentTimeMillis(), rnd.nextBoolean() ? id.toString() : - UUID.randomUUID().toString(), rnd.nextInt(100)); - - tbl.doUpdate(row, false); - } - - for (GridH2IndexBase idx : idxsBefore) - assertEquals(MAX_X, idx.getRowCountApproximation()); - - tbl.rebuildIndexes(); - - ArrayList<GridH2IndexBase> idxsAfter = tbl.indexes(); - - assertEquals(3, idxsAfter.size()); - - for (int i = 0; i < 3; i++) { - GridH2IndexBase idxBefore = idxsBefore.get(i); - GridH2IndexBase idxAfter = idxsAfter.get(i); - - assertNotSame(idxBefore, idxAfter); - assertEquals(idxBefore.getName(), idxAfter.getName()); - assertSame(idxBefore.getTable(), idxAfter.getTable()); - assertEquals(idxBefore.getRowCountApproximation(), idxAfter.getRowCountApproximation()); - assertEquals(idxBefore.getIndexType().isUnique(), idxAfter.getIndexType().isUnique()); - Assert.assertArrayEquals(idxBefore.getColumns(), idxAfter.getColumns()); - } - } - - /** * Check query plan to correctly select index. * * @param conn Connection. http://git-wip-us.apache.org/repos/asf/ignite/blob/6fda2c20/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java index 3ef331f..7bf3887 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java +++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java @@ -100,7 +100,6 @@ import org.apache.ignite.internal.processors.query.IgniteSqlQueryDedicatedPoolTe import org.apache.ignite.internal.processors.query.IgniteSqlEntryCacheModeAgnosticTest; import org.apache.ignite.internal.processors.query.IgniteSqlSchemaIndexingTest; import org.apache.ignite.internal.processors.query.IgniteSqlSplitterSelfTest; -import org.apache.ignite.internal.processors.query.h2.GridH2IndexRebuildTest; import org.apache.ignite.internal.processors.query.h2.GridH2IndexingInMemSelfTest; import org.apache.ignite.internal.processors.query.h2.GridH2IndexingOffheapSelfTest; import org.apache.ignite.internal.processors.query.h2.opt.GridH2TableSelfTest; @@ -125,7 +124,6 @@ public class IgniteCacheQuerySelfTestSuite extends TestSuite { suite.addTest(new TestSuite(GridH2TableSelfTest.class)); suite.addTest(new TestSuite(GridH2IndexingInMemSelfTest.class)); suite.addTest(new TestSuite(GridH2IndexingOffheapSelfTest.class)); - suite.addTest(new TestSuite(GridH2IndexRebuildTest.class)); // Parsing suite.addTestSuite(GridQueryParsingTest.class);