You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/04/20 09:39:29 UTC
[15/22] ignite git commit: IGNITE-5033: Improved CREATE/DROP INDEX
tests. This closes #1835.
IGNITE-5033: Improved CREATE/DROP INDEX tests. This closes #1835.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2c37effe
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2c37effe
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2c37effe
Branch: refs/heads/ignite-1794
Commit: 2c37effe46de8afd22378c71bd7260fd0f79cddd
Parents: 0cb2c92
Author: devozerov <pp...@gmail.com>
Authored: Wed Apr 19 21:43:44 2017 +0300
Committer: devozerov <pp...@gmail.com>
Committed: Wed Apr 19 21:43:44 2017 +0300
----------------------------------------------------------------------
.../processors/query/h2/IgniteH2Indexing.java | 2 +-
.../query/h2/ddl/DdlStatementsProcessor.java | 19 +-
.../cache/index/AbstractSchemaSelfTest.java | 8 +-
.../DynamicIndexAbstractBasicSelfTest.java | 186 +++++++++++++++----
.../index/DynamicIndexAbstractSelfTest.java | 35 +---
5 files changed, 177 insertions(+), 73 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2c37effe/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 4f0a9f9..87b0d00 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
@@ -1717,7 +1717,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
if (DdlStatementsProcessor.isDdlStatement(prepared)) {
try {
- return ddlProc.runDdlStatement(stmt);
+ return ddlProc.runDdlStatement(sqlQry, stmt);
}
catch (IgniteCheckedException e) {
throw new IgniteSQLException("Failed to execute DDL statement [stmt=" + sqlQry + ']', e);
http://git-wip-us.apache.org/repos/asf/ignite/blob/2c37effe/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 5b4b494..949ea6a 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
@@ -71,10 +71,11 @@ public class DdlStatementsProcessor {
/**
* Execute DDL statement.
*
+ * @param sql SQL.
* @param stmt H2 statement to parse and execute.
*/
@SuppressWarnings("unchecked")
- public QueryCursor<List<?>> runDdlStatement(PreparedStatement stmt)
+ public QueryCursor<List<?>> runDdlStatement(String sql, PreparedStatement stmt)
throws IgniteCheckedException {
assert stmt instanceof JdbcPreparedStatement;
@@ -99,8 +100,8 @@ public class DdlStatementsProcessor {
GridH2Table tbl = idx.dataTable(createIdx.schemaName(), createIdx.tableName());
if (tbl == null)
- throw new IgniteSQLException("Table not found [schemaName=" + createIdx.schemaName() + ", " +
- "tblName=" + createIdx.tableName() + ']', IgniteQueryErrorCode.TABLE_NOT_FOUND);
+ throw new SchemaOperationException(SchemaOperationException.CODE_TABLE_NOT_FOUND,
+ createIdx.tableName());
assert tbl.rowDescriptor() != null;
@@ -111,8 +112,7 @@ public class DdlStatementsProcessor {
GridQueryProperty prop = typeDesc.property(e.getKey());
if (prop == null)
- throw new IgniteSQLException("Property not found [typeName=" + typeDesc.name() + ", propName=" +
- e.getKey() + ']');
+ throw new SchemaOperationException(SchemaOperationException.CODE_COLUMN_NOT_FOUND, e.getKey());
flds.put(prop.name(), e.getValue());
}
@@ -129,8 +129,8 @@ public class DdlStatementsProcessor {
fut = ctx.query().dynamicIndexDrop(spaceName, dropIdx.name(), dropIdx.ifExists());
}
else
- throw new IgniteSQLException("Unexpected DDL operation [type=" + gridStmt.getClass() + ']',
- IgniteQueryErrorCode.UNEXPECTED_OPERATION);
+ throw new IgniteSQLException("Unsupported DDL operation: " + sql,
+ IgniteQueryErrorCode.UNSUPPORTED_OPERATION);
fut.get();
@@ -144,8 +144,11 @@ public class DdlStatementsProcessor {
catch (SchemaOperationException e) {
throw convert(e);
}
+ catch (IgniteSQLException e) {
+ throw e;
+ }
catch (Exception e) {
- throw new IgniteSQLException("DLL operation failed.", e);
+ throw new IgniteSQLException("Unexpected DLL operation failure: " + e.getMessage(), e);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2c37effe/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/AbstractSchemaSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/AbstractSchemaSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/AbstractSchemaSelfTest.java
index a865b18..e228026 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/AbstractSchemaSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/AbstractSchemaSelfTest.java
@@ -204,7 +204,8 @@ public class AbstractSchemaSelfTest extends GridCommonAbstractTest {
}
}
- fail("Index not found [cacheName=" + cacheName + ", tlbName=" + tblName + ", idxName=" + idxName + ']');
+ fail("Index not found [node=" + node.name() + ", cacheName=" + cacheName + ", tlbName=" + tblName +
+ ", idxName=" + idxName + ']');
}
/**
@@ -263,7 +264,7 @@ public class AbstractSchemaSelfTest extends GridCommonAbstractTest {
* @param idxName Index name.
*/
protected static void assertNoIndex(IgniteEx node, String cacheName, String tblName, String idxName) {
- assertNoIndexDescriptor(node, cacheName, tblName, idxName);
+ assertNoIndexDescriptor(node, cacheName, idxName);
if (affinityNode(node, cacheName)) {
QueryTypeDescriptorImpl typeDesc = typeExisting(node, cacheName, tblName);
@@ -277,10 +278,9 @@ public class AbstractSchemaSelfTest extends GridCommonAbstractTest {
*
* @param node Node.
* @param cacheName Cache name.
- * @param tblName Table name.
* @param idxName Index name.
*/
- protected static void assertNoIndexDescriptor(IgniteEx node, String cacheName, String tblName, String idxName) {
+ protected static void assertNoIndexDescriptor(IgniteEx node, String cacheName, String idxName) {
awaitCompletion();
DynamicCacheDescriptor desc = node.context().cache().cacheDescriptor(cacheName);
http://git-wip-us.apache.org/repos/asf/ignite/blob/2c37effe/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 6bc1576..fc3529b 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
@@ -22,14 +22,21 @@ import org.apache.ignite.Ignition;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.QueryIndex;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode;
+import org.apache.ignite.internal.processors.query.IgniteSQLException;
import org.apache.ignite.internal.processors.query.schema.SchemaOperationException;
+import org.apache.ignite.internal.util.GridStringBuilder;
+import org.apache.ignite.internal.util.typedef.internal.SB;
+import javax.cache.CacheException;
import java.util.Arrays;
import java.util.List;
+import java.util.Map;
import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
@@ -182,20 +189,18 @@ public abstract class DynamicIndexAbstractBasicSelfTest extends DynamicIndexAbst
private void checkCreate(CacheMode mode, CacheAtomicityMode atomicityMode, boolean near) throws Exception {
initialize(mode, atomicityMode, near);
- final IgniteEx node = node();
-
final QueryIndex idx = index(IDX_NAME_1, field(FIELD_NAME_1));
- queryProcessor(node).dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false).get();
+ dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false);
assertIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1, field(FIELD_NAME_1));
assertSchemaException(new RunnableX() {
@Override public void run() throws Exception {
- queryProcessor(node).dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false).get();
+ dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false);
}
- }, SchemaOperationException.CODE_INDEX_EXISTS);
+ }, IgniteQueryErrorCode.INDEX_ALREADY_EXISTS);
- queryProcessor(node).dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, true).get();
+ dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, true);
assertIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1, field(FIELD_NAME_1));
assertSimpleIndexOperations(SQL_SIMPLE_FIELD_1);
@@ -270,7 +275,7 @@ public abstract class DynamicIndexAbstractBasicSelfTest extends DynamicIndexAbst
final QueryIndex idx = index(IDX_NAME_1, field(FIELD_NAME_1), field(alias(FIELD_NAME_2)));
- queryProcessor(node()).dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false).get();
+ dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false);
assertIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1, field(FIELD_NAME_1), field(alias(FIELD_NAME_2)));
assertCompositeIndexOperations(SQL_COMPOSITE);
@@ -345,13 +350,21 @@ public abstract class DynamicIndexAbstractBasicSelfTest extends DynamicIndexAbst
final QueryIndex idx = index(IDX_NAME_1, field(FIELD_NAME_1));
- assertSchemaException(new RunnableX() {
- @Override public void run() throws Exception {
- queryProcessor(node()).dynamicIndexCreate(randomString(), TBL_NAME, idx, false).get();
- }
- }, SchemaOperationException.CODE_CACHE_NOT_FOUND);
+ try {
+ queryProcessor(node()).dynamicIndexCreate(randomString(), TBL_NAME, idx, false).get();
+ }
+ catch (SchemaOperationException e) {
+ assertEquals(SchemaOperationException.CODE_CACHE_NOT_FOUND, e.code());
- assertNoIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1);
+ assertNoIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1);
+
+ return;
+ }
+ catch (Exception e) {
+ fail("Unexpected exception: " + e);
+ }
+
+ fail(SchemaOperationException.class.getSimpleName() + " is not thrown.");
}
/**
@@ -423,9 +436,9 @@ public abstract class DynamicIndexAbstractBasicSelfTest extends DynamicIndexAbst
assertSchemaException(new RunnableX() {
@Override public void run() throws Exception {
- queryProcessor(node()).dynamicIndexCreate(CACHE_NAME, randomString(), idx, false).get();
+ dynamicIndexCreate(CACHE_NAME, randomString(), idx, false);
}
- }, SchemaOperationException.CODE_TABLE_NOT_FOUND);
+ }, IgniteQueryErrorCode.TABLE_NOT_FOUND);
assertNoIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1);
}
@@ -499,9 +512,9 @@ public abstract class DynamicIndexAbstractBasicSelfTest extends DynamicIndexAbst
assertSchemaException(new RunnableX() {
@Override public void run() throws Exception {
- queryProcessor(node()).dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false).get();
+ dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false);
}
- }, SchemaOperationException.CODE_COLUMN_NOT_FOUND);
+ }, IgniteQueryErrorCode.COLUMN_NOT_FOUND);
assertNoIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1);
}
@@ -576,15 +589,15 @@ public abstract class DynamicIndexAbstractBasicSelfTest extends DynamicIndexAbst
@Override public void run() throws Exception {
QueryIndex idx = index(IDX_NAME_1, field(FIELD_NAME_2));
- queryProcessor(node()).dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false).get();
+ dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false);
}
- }, SchemaOperationException.CODE_COLUMN_NOT_FOUND);
+ }, IgniteQueryErrorCode.COLUMN_NOT_FOUND);
assertNoIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1);
QueryIndex idx = index(IDX_NAME_1, field(alias(FIELD_NAME_2)));
- queryProcessor(node()).dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false).get();
+ dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false);
assertIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1, field(alias(FIELD_NAME_2)));
assertSimpleIndexOperations(SQL_SIMPLE_FIELD_2);
@@ -659,7 +672,7 @@ public abstract class DynamicIndexAbstractBasicSelfTest extends DynamicIndexAbst
QueryIndex idx = index(IDX_NAME_1, field(FIELD_NAME_1));
- queryProcessor(node()).dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false).get();
+ dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false);
assertIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1, field(FIELD_NAME_1));
assertIndexUsed(IDX_NAME_1, SQL_SIMPLE_FIELD_1, SQL_ARG_1);
@@ -668,7 +681,7 @@ public abstract class DynamicIndexAbstractBasicSelfTest extends DynamicIndexAbst
loadInitialData();
- queryProcessor(node()).dynamicIndexDrop(CACHE_NAME, IDX_NAME_1, false).get();
+ dynamicIndexDrop(CACHE_NAME, IDX_NAME_1, false);
assertNoIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1);
assertSimpleIndexOperations(SQL_SIMPLE_FIELD_1);
@@ -743,11 +756,11 @@ public abstract class DynamicIndexAbstractBasicSelfTest extends DynamicIndexAbst
assertSchemaException(new RunnableX() {
@Override public void run() throws Exception {
- queryProcessor(node()).dynamicIndexDrop(CACHE_NAME, IDX_NAME_1, false).get();
+ dynamicIndexDrop(CACHE_NAME, IDX_NAME_1, false);
}
- }, SchemaOperationException.CODE_INDEX_NOT_FOUND);
+ }, IgniteQueryErrorCode.INDEX_NOT_FOUND);
- queryProcessor(node()).dynamicIndexDrop(CACHE_NAME, IDX_NAME_1, true).get();
+ dynamicIndexDrop(CACHE_NAME, IDX_NAME_1, true);
assertNoIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1);
}
@@ -818,13 +831,21 @@ public abstract class DynamicIndexAbstractBasicSelfTest extends DynamicIndexAbst
private void checkDropNoCache(CacheMode mode, CacheAtomicityMode atomicityMode, boolean near) throws Exception {
initialize(mode, atomicityMode, near);
- assertSchemaException(new RunnableX() {
- @Override public void run() throws Exception {
- queryProcessor(node()).dynamicIndexDrop(randomString(), "my_idx", false).get();
- }
- }, SchemaOperationException.CODE_CACHE_NOT_FOUND);
+ try {
+ queryProcessor(node()).dynamicIndexDrop(randomString(), "my_idx", false).get();
+ }
+ catch (SchemaOperationException e) {
+ assertEquals(SchemaOperationException.CODE_CACHE_NOT_FOUND, e.code());
- assertNoIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1);
+ assertNoIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1);
+
+ return;
+ }
+ catch (Exception e) {
+ fail("Unexpected exception: " + e);
+ }
+
+ fail(SchemaOperationException.class.getSimpleName() + " is not thrown.");
}
/**
@@ -842,17 +863,17 @@ public abstract class DynamicIndexAbstractBasicSelfTest extends DynamicIndexAbst
assertSchemaException(new RunnableX() {
@Override public void run() throws Exception {
- queryProcessor(node()).dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, true).get();
+ dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, true);
}
- }, SchemaOperationException.CODE_GENERIC);
+ }, IgniteQueryErrorCode.UNSUPPORTED_OPERATION);
assertNoIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1);
assertSchemaException(new RunnableX() {
@Override public void run() throws Exception {
- queryProcessor(node()).dynamicIndexDrop(CACHE_NAME, IDX_NAME_1, true).get();
+ dynamicIndexDrop(CACHE_NAME, IDX_NAME_1, true);
}
- }, SchemaOperationException.CODE_GENERIC);
+ }, IgniteQueryErrorCode.UNSUPPORTED_OPERATION);
}
/**
@@ -947,4 +968,99 @@ public abstract class DynamicIndexAbstractBasicSelfTest extends DynamicIndexAbst
for (Ignite node : Ignition.allGrids())
assertSqlCompositeData(node, sql, 0);
}
+
+ /**
+ * Ensure that schema exception is thrown.
+ *
+ * @param r Runnable.
+ * @param expCode Error code.
+ */
+ protected static void assertSchemaException(RunnableX r, int expCode) {
+ try {
+ r.run();
+ }
+ catch (CacheException e) {
+ Throwable cause = e.getCause();
+
+ assertTrue(cause != null);
+ assertTrue("Unexpected cause: " + cause.getClass().getName(), cause instanceof IgniteSQLException);
+
+ IgniteSQLException cause0 = (IgniteSQLException)cause;
+
+ int code = cause0.statusCode();
+
+ assertEquals("Unexpected error code [expected=" + expCode + ", actual=" + code +
+ ", msg=" + cause.getMessage() + ']', expCode, code);
+
+ return;
+ }
+ catch (Exception e) {
+ fail("Unexpected exception: " + e);
+ }
+
+ fail(IgniteSQLException.class.getSimpleName() + " is not thrown.");
+ }
+
+ /**
+ * Synchronously create index.
+ *
+ * @param space Space.
+ * @param tblName Table name.
+ * @param idx Index.
+ * @param ifNotExists When set to true operation will fail if index already exists.
+ * @throws Exception If failed.
+ */
+ private void dynamicIndexCreate(String space, String tblName, QueryIndex idx, boolean ifNotExists)
+ throws Exception {
+ GridStringBuilder sql = new SB("CREATE INDEX ")
+ .a(ifNotExists ? "IF NOT EXISTS " : "")
+ .a("\"" + idx.getName() + "\"")
+ .a(" ON ")
+ .a(tblName)
+ .a(" (");
+
+ boolean first = true;
+
+ for (Map.Entry<String, Boolean> fieldEntry : idx.getFields().entrySet()) {
+ if (first)
+ first = false;
+ else
+ sql.a(", ");
+
+ String name = fieldEntry.getKey();
+ boolean asc = fieldEntry.getValue();
+
+ sql.a("\"" + name + "\"").a(" ").a(asc ? "ASC" : "DESC");
+ }
+
+ sql.a(')');
+
+ executeSql(space, sql.toString());
+ }
+
+ /**
+ * Synchronously drop index.
+ *
+ * @param space Space.
+ * @param idxName Index name.
+ * @param ifExists When set to true operation fill fail if index doesn't exists.
+ * @throws Exception if failed.
+ */
+ private void dynamicIndexDrop(String space, String idxName, boolean ifExists) throws Exception {
+ String sql = "DROP INDEX " + (ifExists ? "IF EXISTS " : "") + "\"" + idxName + "\"";
+
+ executeSql(space, sql);
+ }
+
+ /**
+ * Execute SQL.
+ *
+ * @param space Space.
+ * @param sql SQL.
+ */
+ private void executeSql(String space, String sql) {
+ log.info("Executing DDL: " + sql);
+
+ node().cache(space).query(new SqlFieldsQuery(sql)).getAll();
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2c37effe/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractSelfTest.java
index e52e0d3..1ed7426 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractSelfTest.java
@@ -29,9 +29,10 @@ import org.apache.ignite.cache.query.SqlQuery;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.MemoryConfiguration;
+import org.apache.ignite.configuration.MemoryPolicyConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.binary.BinaryMarshaller;
-import org.apache.ignite.internal.processors.query.schema.SchemaOperationException;
import org.apache.ignite.internal.util.typedef.T2;
import org.apache.ignite.lang.IgnitePredicate;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
@@ -135,6 +136,13 @@ public abstract class DynamicIndexAbstractSelfTest extends AbstractSchemaSelfTes
cfg.setMarshaller(new BinaryMarshaller());
+ MemoryConfiguration memCfg = new MemoryConfiguration()
+ .setDefaultMemoryPolicyName("default")
+ .setMemoryPolicies(new MemoryPolicyConfiguration().setName("default").setSize(32 * 1024 * 1024L)
+ );
+
+ cfg.setMemoryConfiguration(memCfg);
+
return optimize(cfg);
}
@@ -168,29 +176,6 @@ public abstract class DynamicIndexAbstractSelfTest extends AbstractSchemaSelfTes
}
/**
- * Ensure that schema exception is thrown.
- *
- * @param r Runnable.
- * @param expCode Error code.
- */
- protected static void assertSchemaException(RunnableX r, int expCode) {
- try {
- r.run();
- }
- catch (SchemaOperationException e) {
- assertEquals("Unexpected error code [expected=" + expCode + ", actual=" + e.code() + ']',
- expCode, e.code());
-
- return;
- }
- catch (Exception e) {
- fail("Unexpected exception: " + e);
- }
-
- fail(SchemaOperationException.class.getSimpleName() + " is not thrown.");
- }
-
- /**
* Ensure index is used in plan.
*
* @param idxName Index name.
@@ -374,7 +359,7 @@ public abstract class DynamicIndexAbstractSelfTest extends AbstractSchemaSelfTes
* @return Random string.
*/
protected static String randomString() {
- return UUID.randomUUID().toString();
+ return "random" + UUID.randomUUID().toString().replace("-", "");
}
/**