Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 2E423200C88 for ; Fri, 2 Jun 2017 11:44:10 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 2D70B160BDD; Fri, 2 Jun 2017 09:44:10 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 4F83D160BD2 for ; Fri, 2 Jun 2017 11:44:09 +0200 (CEST) Received: (qmail 21112 invoked by uid 500); 2 Jun 2017 09:44:08 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 21103 invoked by uid 99); 2 Jun 2017 09:44:08 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Jun 2017 09:44:08 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 47607DFB8A; Fri, 2 Jun 2017 09:44:08 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: vozerov@apache.org To: commits@ignite.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: ignite git commit: IGNITE-5391: CREATE INDEX and DROP INDEX are now allowed on non-sql caches again :-) Date: Fri, 2 Jun 2017 09:44:08 +0000 (UTC) archived-at: Fri, 02 Jun 2017 09:44:10 -0000 Repository: ignite Updated Branches: refs/heads/master fbcd47430 -> c7638bc46 IGNITE-5391: CREATE INDEX and DROP INDEX are now allowed on non-sql caches again :-) Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c7638bc4 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c7638bc4 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c7638bc4 Branch: refs/heads/master Commit: c7638bc46c32234eb3a37c81a30f1cd1e5d9c984 Parents: fbcd474 Author: devozerov Authored: Fri Jun 2 12:43:59 2017 +0300 Committer: devozerov Committed: Fri Jun 2 12:43:59 2017 +0300 ---------------------------------------------------------------------- .../processors/query/GridQueryProcessor.java | 10 -------- .../query/h2/ddl/DdlStatementsProcessor.java | 26 +------------------- .../DynamicIndexAbstractBasicSelfTest.java | 22 +++++------------ 3 files changed, 7 insertions(+), 51 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/c7638bc4/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 bfbfb6c..fef7d4c 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 @@ -358,14 +358,6 @@ public class GridQueryProcessor extends GridProcessorAdapter { msg.onError(new SchemaOperationException(SchemaOperationException.CODE_CACHE_NOT_FOUND, cacheName)); } - else if (!cacheDesc.sql()) { - if (log.isDebugEnabled()) - log.debug("Received schema propose discovery message, but cache was not created through " + - "CREATE TABLE command (will report error) [opId=" + opId + ", msg=" + msg + ']');; - - msg.onError(new SchemaOperationException("CREATE INDEX and DROP INDEX operations are only allowed on " + - "caches created with CREATE TABLE command [cacheName=" + cacheName + ']')); - } else { CacheConfiguration ccfg = cacheDesc.cacheConfiguration(); @@ -601,8 +593,6 @@ public class GridQueryProcessor extends GridProcessorAdapter { boolean nop = false; if (cacheExists) { - assert cacheDesc.sql(); - if (cacheRegistered) { // If cache is started, we perform validation against real schema. T3 res = prepareChangeOnStartedCache(op); http://git-wip-us.apache.org/repos/asf/ignite/blob/c7638bc4/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java index 7051f09..04a0c62 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java @@ -28,8 +28,6 @@ import org.apache.ignite.cache.QueryIndex; import org.apache.ignite.cache.query.FieldsQueryCursor; import org.apache.ignite.internal.GridKernalContext; import org.apache.ignite.internal.IgniteInternalFuture; -import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor; -import org.apache.ignite.internal.processors.cache.GridCacheContext; import org.apache.ignite.internal.processors.cache.QueryCursorImpl; import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode; import org.apache.ignite.internal.processors.query.GridQueryProperty; @@ -46,7 +44,6 @@ import org.apache.ignite.internal.processors.query.h2.sql.GridSqlQueryParser; import org.apache.ignite.internal.processors.query.h2.sql.GridSqlStatement; import org.apache.ignite.internal.processors.query.schema.SchemaOperationException; import org.apache.ignite.internal.util.future.GridFinishedFuture; -import org.apache.ignite.internal.util.typedef.internal.A; import org.h2.command.Prepared; import org.h2.command.ddl.CreateIndex; import org.h2.command.ddl.CreateTable; @@ -104,8 +101,6 @@ public class DdlStatementsProcessor { if (tbl == null) throw new SchemaOperationException(SchemaOperationException.CODE_TABLE_NOT_FOUND, cmd.tableName()); - checkSqlCache(tbl.cache()); - assert tbl.rowDescriptor() != null; QueryIndex newIdx = new QueryIndex(); @@ -134,13 +129,11 @@ public class DdlStatementsProcessor { newIdx, cmd.ifNotExists()); } else if (stmt0 instanceof GridSqlDropIndex) { - GridSqlDropIndex cmd = (GridSqlDropIndex)stmt0; + GridSqlDropIndex cmd = (GridSqlDropIndex) stmt0; GridH2Table tbl = idx.dataTableForIndex(cmd.schemaName(), cmd.indexName()); if (tbl != null) { - checkSqlCache(tbl.cache()); - fut = ctx.query().dynamicIndexDrop(tbl.cacheName(), cmd.schemaName(), cmd.indexName(), cmd.ifExists()); } @@ -280,23 +273,6 @@ public class DdlStatementsProcessor { } /** - * Check that given context corresponds to an SQL cache. - * @param cctx Cache context. - * @throws SchemaOperationException if given context does not correspond to an SQL cache. - */ - private static void checkSqlCache(GridCacheContext cctx) throws SchemaOperationException { - A.notNull(cctx, "cctx"); - - DynamicCacheDescriptor desc = cctx.grid().context().cache().cacheDescriptor(cctx.cacheId()); - - assert desc != null; - - if (!desc.sql()) - throw new SchemaOperationException("CREATE INDEX and DROP INDEX operations are only allowed on caches " + - "created with CREATE TABLE command [cacheName=" + cctx.name() + ']'); - } - - /** * @param cmd Statement. * @return Whether {@code cmd} is a DDL statement we're able to handle. */ http://git-wip-us.apache.org/repos/asf/ignite/blob/c7638bc4/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractBasicSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractBasicSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractBasicSelfTest.java index cf83319..0b6b0ca 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractBasicSelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractBasicSelfTest.java @@ -897,28 +897,18 @@ public abstract class DynamicIndexAbstractBasicSelfTest extends DynamicIndexAbst } /** - * Test that operations fail on statically configured cache. + * Test that operations work on statically configured cache. * * @throws Exception If failed. */ - public void testFailOnNonSqlCache() throws Exception { + public void testNonSqlCache() throws Exception { final QueryIndex idx = index(IDX_NAME_2, field(FIELD_NAME_1)); - assertSchemaException(new RunnableX() { - @Override public void run() throws Exception { - dynamicIndexCreate(STATIC_CACHE_NAME, TBL_NAME, idx, true); - } - }, "CREATE INDEX and DROP INDEX operations are only allowed on caches created with CREATE TABLE command " + - "[cacheName=cache_static]", IgniteQueryErrorCode.UNKNOWN); - - assertNoIndex(STATIC_CACHE_NAME, TBL_NAME, IDX_NAME_2); + dynamicIndexCreate(STATIC_CACHE_NAME, TBL_NAME, idx, true); + assertIndex(STATIC_CACHE_NAME, TBL_NAME, IDX_NAME_1, field(FIELD_NAME_1_ESCAPED)); - assertSchemaException(new RunnableX() { - @Override public void run() throws Exception { - dynamicIndexDrop(STATIC_CACHE_NAME, IDX_NAME_1, true); - } - }, "CREATE INDEX and DROP INDEX operations are only allowed on caches created with CREATE TABLE command " + - "[cacheName=cache_static]", IgniteQueryErrorCode.UNKNOWN); + dynamicIndexDrop(STATIC_CACHE_NAME, IDX_NAME_1, true); + assertNoIndex(STATIC_CACHE_NAME, TBL_NAME, IDX_NAME_1); } /**