This is an automated email from the ASF dual-hosted git repository.
nizhikov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push:
new 197d0784fac IGNITE-26797 Method to create SQL cache via thin client
(#12448)
197d0784fac is described below
commit 197d0784facc56be0815ac3a926c96872f34db29
Author: Nikolay <[email protected]>
AuthorDate: Wed Oct 22 23:35:33 2025 +0300
IGNITE-26797 Method to create SQL cache via thin client (#12448)
---
.../ignite/internal/client/thin/ClientUtils.java | 5 +-
.../client/thin/ProtocolBitmaskFeature.java | 15 ++-
.../internal/client/thin/TcpIgniteClient.java | 35 +++++-
.../platform/client/ClientBitmaskFeature.java | 14 ++-
.../cache/ClientCacheConfigurationSerializer.java | 8 +-
.../ClientCacheCreateWithConfigurationRequest.java | 15 ++-
...ntCacheGetOrCreateWithConfigurationRequest.java | 31 +++++-
.../ignite/internal/dump/DumpCacheConfigTest.java | 120 +++++++++++++++++++++
8 files changed, 228 insertions(+), 15 deletions(-)
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientUtils.java
b/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientUtils.java
index fae94521de8..c21dd8d2537 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientUtils.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ClientUtils.java
@@ -241,8 +241,11 @@ public final class ClientUtils {
}
/** Serialize configuration to stream. */
- void cacheConfiguration(ClientCacheConfiguration cfg, BinaryOutputStream
out, ProtocolContext protocolCtx) {
+ void cacheConfiguration(ClientCacheConfiguration cfg, boolean sql,
BinaryOutputStream out, ProtocolContext protocolCtx) {
try (BinaryWriterEx writer = BinaryUtils.writer(marsh.context(), out,
null)) {
+ if
(protocolCtx.isFeatureSupported(ProtocolBitmaskFeature.SQL_CACHE_CREATION))
+ out.writeBoolean(sql);
+
int origPos = out.position();
writer.writeInt(0); // configuration length is to be assigned in
the end
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ProtocolBitmaskFeature.java
b/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ProtocolBitmaskFeature.java
index cf931b31653..fb2508523a7 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ProtocolBitmaskFeature.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/client/thin/ProtocolBitmaskFeature.java
@@ -23,6 +23,9 @@ import java.util.EnumSet;
import org.apache.ignite.client.ClientCacheConfiguration;
import org.apache.ignite.client.ClientServices;
import org.apache.ignite.cluster.ClusterState;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.internal.processors.cache.GridCacheProcessor;
/**
* Defines supported bitmask features for thin client.
@@ -96,7 +99,17 @@ public enum ProtocolBitmaskFeature {
* @see ClientCacheConfiguration#setStoragePaths(String...)
* @see ClientCacheConfiguration#setIndexPath(String)
*/
- CACHE_STORAGES(20);
+ CACHE_STORAGES(20),
+
+ /**
+ * Internal operation.
+ * Support of specifying {@code sql} flag on cache creation.
+ * When {@code sql} flag is {@code true} Ignite treats cache as created
via SQL DDL: {@code CREATE TABLE}.
+ * Set this flag required when creating caches during dump restoration and
similar processes.
+ *
+ * @see GridCacheProcessor#dynamicStartCache(CacheConfiguration, String,
NearCacheConfiguration, boolean, boolean, boolean)
+ */
+ SQL_CACHE_CREATION(21);
/** */
private static final EnumSet<ProtocolBitmaskFeature>
ALL_FEATURES_AS_ENUM_SET =
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/TcpIgniteClient.java
b/modules/core/src/main/java/org/apache/ignite/internal/client/thin/TcpIgniteClient.java
index 0bef412ca93..a86d6306bc0 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/client/thin/TcpIgniteClient.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/client/thin/TcpIgniteClient.java
@@ -80,6 +80,7 @@ import org.apache.ignite.marshaller.MarshallerContext;
import org.apache.ignite.marshaller.MarshallerUtils;
import org.apache.ignite.marshaller.Marshallers;
import org.apache.ignite.marshaller.jdk.JdkMarshaller;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
@@ -216,10 +217,23 @@ public class TcpIgniteClient implements IgniteClient {
/** {@inheritDoc} */
@Override public <K, V> ClientCache<K, V> getOrCreateCache(
ClientCacheConfiguration cfg) throws ClientException {
+ return getOrCreateCache(cfg, false);
+ }
+
+ /**
+ * Gets the existing cache or creates a new cache if it does not exist.
+ *
+ * @param cfg Cache configuration. If the cache exists, this configuration
is ignored.
+ * @param sql If {@code true} then cache will be treated as created with
SQL DDL: {@code CREATE TABLE}.
+ * @param <K> Type of the cache key.
+ * @param <V> Type of the cache value.
+ * @return Client cache instance.
+ */
+ public <K, V> ClientCache<K, V> getOrCreateCache(ClientCacheConfiguration
cfg, boolean sql) {
ensureCacheConfiguration(cfg);
ch.request(ClientOperation.CACHE_GET_OR_CREATE_WITH_CONFIGURATION,
- req -> serDes.cacheConfiguration(cfg, req.out(),
req.clientChannel().protocolCtx()));
+ req -> serDes.cacheConfiguration(cfg, sql, req.out(),
req.clientChannel().protocolCtx()));
return new TcpClientCache<>(cfg.getName(), ch, marsh, transactions,
lsnrsRegistry, log);
}
@@ -231,7 +245,7 @@ public class TcpIgniteClient implements IgniteClient {
return new IgniteClientFutureImpl<>(
ch.requestAsync(ClientOperation.CACHE_GET_OR_CREATE_WITH_CONFIGURATION,
- req -> serDes.cacheConfiguration(cfg, req.out(),
req.clientChannel().protocolCtx()))
+ req -> serDes.cacheConfiguration(cfg, false,
req.out(), req.clientChannel().protocolCtx()))
.thenApply(x -> new TcpClientCache<>(cfg.getName(),
ch, marsh, transactions, lsnrsRegistry, log)));
}
@@ -292,10 +306,23 @@ public class TcpIgniteClient implements IgniteClient {
/** {@inheritDoc} */
@Override public <K, V> ClientCache<K, V>
createCache(ClientCacheConfiguration cfg) throws ClientException {
+ return createCache(cfg, false);
+ }
+
+ /**
+ * Creates a cache with the specified configuration.
+ *
+ * @param cfg Cache configuration.
+ * @param sql If {@code true} then cache will be treated as created with
SQL DDL: {@code CREATE TABLE}.
+ * @param <K> Type of the cache key.
+ * @param <V> Type of the cache value.
+ * @return Resulting cache.
+ */
+ public <K, V> @NotNull TcpClientCache<K, V>
createCache(ClientCacheConfiguration cfg, boolean sql) {
ensureCacheConfiguration(cfg);
ch.request(ClientOperation.CACHE_CREATE_WITH_CONFIGURATION,
- req -> serDes.cacheConfiguration(cfg, req.out(),
req.clientChannel().protocolCtx()));
+ req -> serDes.cacheConfiguration(cfg, sql, req.out(),
req.clientChannel().protocolCtx()));
return new TcpClientCache<>(cfg.getName(), ch, marsh, transactions,
lsnrsRegistry, log);
}
@@ -307,7 +334,7 @@ public class TcpIgniteClient implements IgniteClient {
return new IgniteClientFutureImpl<>(
ch.requestAsync(ClientOperation.CACHE_CREATE_WITH_CONFIGURATION,
- req -> serDes.cacheConfiguration(cfg, req.out(),
req.clientChannel().protocolCtx()))
+ req -> serDes.cacheConfiguration(cfg, false,
req.out(), req.clientChannel().protocolCtx()))
.thenApply(x -> new TcpClientCache<>(cfg.getName(),
ch, marsh, transactions, lsnrsRegistry, log)));
}
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientBitmaskFeature.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientBitmaskFeature.java
index feef69151b3..f7115d41af3 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientBitmaskFeature.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientBitmaskFeature.java
@@ -21,8 +21,11 @@ import java.util.EnumSet;
import org.apache.ignite.client.ClientCacheConfiguration;
import org.apache.ignite.client.ClientServices;
import org.apache.ignite.cluster.ClusterState;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.internal.ThinProtocolFeature;
import org.apache.ignite.internal.client.thin.TcpClientCache;
+import org.apache.ignite.internal.processors.cache.GridCacheProcessor;
/**
* Defines supported features for thin client.
@@ -94,7 +97,16 @@ public enum ClientBitmaskFeature implements
ThinProtocolFeature {
* @see ClientCacheConfiguration#setStoragePaths(String...)
* @see ClientCacheConfiguration#setIndexPath(String)
*/
- CACHE_STORAGES(20);
+ CACHE_STORAGES(20),
+
+ /**
+ * Internal operation.
+ * Support of specifying {@code sql} flag on cache creation.
+ * When {@code sql} flag is {@code true} Ignite treats cache as created
via SQL DDL: {@code CREATE TABLE}.
+ * Set this flag required when creating caches during dump restoration and
similar processes.
+ * @see GridCacheProcessor#dynamicStartCache(CacheConfiguration, String,
NearCacheConfiguration, boolean, boolean, boolean)
+ */
+ SQL_CACHE_CREATION(21);
/** */
private static final EnumSet<ClientBitmaskFeature>
ALL_FEATURES_AS_ENUM_SET =
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheConfigurationSerializer.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheConfigurationSerializer.java
index 5550d52afd6..f03610aa15d 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheConfigurationSerializer.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheConfigurationSerializer.java
@@ -40,6 +40,8 @@ import
org.apache.ignite.internal.processors.platform.client.ClientBitmaskFeatur
import
org.apache.ignite.internal.processors.platform.client.ClientProtocolContext;
import
org.apache.ignite.internal.processors.platform.client.ClientProtocolVersionFeature;
import
org.apache.ignite.internal.processors.platform.utils.PlatformConfigurationUtils;
+import org.apache.ignite.internal.util.typedef.T2;
+
import static java.util.Optional.ofNullable;
import static
org.apache.ignite.internal.processors.platform.client.ClientProtocolVersionFeature.QUERY_ENTITY_PRECISION_AND_SCALE;
@@ -306,7 +308,9 @@ public class ClientCacheConfigurationSerializer {
* @param protocolCtx Client protocol context.
* @return Configuration.
*/
- static CacheConfiguration read(BinaryRawReader reader,
ClientProtocolContext protocolCtx) {
+ static T2<CacheConfiguration, Boolean> read(BinaryRawReader reader,
ClientProtocolContext protocolCtx) {
+ boolean sql =
protocolCtx.isFeatureSupported(ClientBitmaskFeature.SQL_CACHE_CREATION) &&
reader.readBoolean();
+
reader.readInt(); // Skip length.
short propCnt = reader.readShort();
@@ -473,7 +477,7 @@ public class ClientCacheConfigurationSerializer {
if (cfg.getCacheMode() == null)
throw new ClientException("Unsupported cache mode");
- return cfg;
+ return new T2<>(cfg, sql);
}
/**
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheCreateWithConfigurationRequest.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheCreateWithConfigurationRequest.java
index e1cd446dde3..5ea6906dc2a 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheCreateWithConfigurationRequest.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheCreateWithConfigurationRequest.java
@@ -26,7 +26,10 @@ import
org.apache.ignite.internal.processors.platform.client.ClientRequest;
import org.apache.ignite.internal.processors.platform.client.ClientResponse;
import org.apache.ignite.internal.processors.platform.client.ClientStatus;
import
org.apache.ignite.internal.processors.platform.client.IgniteClientException;
+import org.apache.ignite.internal.util.typedef.T2;
+
import static
org.apache.ignite.internal.processors.platform.client.ClientStatus.CACHE_CONFIG_INVALID;
+import static
org.apache.ignite.internal.processors.platform.client.cache.ClientCacheGetOrCreateWithConfigurationRequest.createSqlCache;
/**
* Cache create with configuration request.
@@ -34,7 +37,7 @@ import static
org.apache.ignite.internal.processors.platform.client.ClientStatus
@SuppressWarnings("unchecked")
public class ClientCacheCreateWithConfigurationRequest extends ClientRequest {
/** Cache configuration. */
- private final CacheConfiguration cacheCfg;
+ private final T2<CacheConfiguration, Boolean> cacheCfg;
/**
* Constructor.
@@ -50,10 +53,16 @@ public class ClientCacheCreateWithConfigurationRequest
extends ClientRequest {
/** {@inheritDoc} */
@Override public ClientResponse process(ClientConnectionContext ctx) {
- checkClientCacheConfiguration(cacheCfg);
+ CacheConfiguration ccfg = cacheCfg.get1();
+ boolean sql = cacheCfg.get2();
+
+ checkClientCacheConfiguration(ccfg);
try {
- ctx.kernalContext().grid().createCache(cacheCfg);
+ if (sql)
+ createSqlCache(ctx, ccfg, true);
+ else
+ ctx.kernalContext().grid().createCache(ccfg);
}
catch (CacheExistsException e) {
throw new IgniteClientException(ClientStatus.CACHE_EXISTS,
e.getMessage());
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetOrCreateWithConfigurationRequest.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetOrCreateWithConfigurationRequest.java
index df80e211d2f..b5bd9a2b803 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetOrCreateWithConfigurationRequest.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCacheGetOrCreateWithConfigurationRequest.java
@@ -20,12 +20,15 @@ package
org.apache.ignite.internal.processors.platform.client.cache;
import org.apache.ignite.binary.BinaryRawReader;
import org.apache.ignite.cache.CacheExistsException;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.processors.cache.CacheType;
import
org.apache.ignite.internal.processors.platform.client.ClientConnectionContext;
import
org.apache.ignite.internal.processors.platform.client.ClientProtocolContext;
import org.apache.ignite.internal.processors.platform.client.ClientRequest;
import org.apache.ignite.internal.processors.platform.client.ClientResponse;
import org.apache.ignite.internal.processors.platform.client.ClientStatus;
import
org.apache.ignite.internal.processors.platform.client.IgniteClientException;
+import org.apache.ignite.internal.util.typedef.T2;
+
import static
org.apache.ignite.internal.processors.platform.client.cache.ClientCacheCreateWithConfigurationRequest.checkClientCacheConfiguration;
/**
@@ -34,7 +37,7 @@ import static
org.apache.ignite.internal.processors.platform.client.cache.Client
@SuppressWarnings("unchecked")
public class ClientCacheGetOrCreateWithConfigurationRequest extends
ClientRequest {
/** Cache configuration. */
- private final CacheConfiguration cacheCfg;
+ private final T2<CacheConfiguration, Boolean> cacheCfg;
/**
* Constructor.
@@ -50,10 +53,16 @@ public class ClientCacheGetOrCreateWithConfigurationRequest
extends ClientReques
/** {@inheritDoc} */
@Override public ClientResponse process(ClientConnectionContext ctx) {
- checkClientCacheConfiguration(cacheCfg);
+ CacheConfiguration ccfg = cacheCfg.get1();
+ boolean sql = cacheCfg.get2();
+
+ checkClientCacheConfiguration(ccfg);
try {
- ctx.kernalContext().grid().getOrCreateCache(cacheCfg);
+ if (sql)
+ createSqlCache(ctx, ccfg, false);
+ else
+ ctx.kernalContext().grid().getOrCreateCache(ccfg);
}
catch (CacheExistsException e) {
throw new IgniteClientException(ClientStatus.CACHE_EXISTS,
e.getMessage());
@@ -61,4 +70,20 @@ public class ClientCacheGetOrCreateWithConfigurationRequest
extends ClientReques
return super.process(ctx);
}
+
+ /**
+ * @param ctx Client connection context.
+ * @param ccfg Cache configuration.
+ * @param failIfExists If {@code True} then don't fail if cache exists,
already.
+ */
+ public static void createSqlCache(ClientConnectionContext ctx,
CacheConfiguration<?, ?> ccfg, boolean failIfExists) {
+ ctx.kernalContext().cache().dynamicStartCache(ccfg,
+ ccfg.getName(),
+ ccfg.getNearConfiguration(),
+ CacheType.USER,
+ true, /* sql. */
+ failIfExists,
+ true, /* fail if not started. */
+ true); /* check thread tx */
+ }
}
diff --git
a/modules/indexing/src/test/java/org/apache/ignite/internal/dump/DumpCacheConfigTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/dump/DumpCacheConfigTest.java
index aceecd83256..1302fb36a6c 100644
---
a/modules/indexing/src/test/java/org/apache/ignite/internal/dump/DumpCacheConfigTest.java
+++
b/modules/indexing/src/test/java/org/apache/ignite/internal/dump/DumpCacheConfigTest.java
@@ -20,20 +20,35 @@ package org.apache.ignite.internal.dump;
import java.io.File;
import java.util.Collection;
import java.util.Iterator;
+import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.ignite.Ignition;
import org.apache.ignite.binary.BinaryObject;
import org.apache.ignite.binary.BinaryType;
import org.apache.ignite.cache.QueryEntity;
+import org.apache.ignite.cdc.TypeMapping;
+import org.apache.ignite.client.ClientCacheConfiguration;
+import org.apache.ignite.client.IgniteClient;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.ClientConfiguration;
+import org.apache.ignite.dump.DumpConsumer;
import org.apache.ignite.dump.DumpEntry;
import org.apache.ignite.dump.DumpReader;
import org.apache.ignite.dump.DumpReaderConfiguration;
import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.binary.BinaryContext;
+import org.apache.ignite.internal.binary.BinaryTypeImpl;
+import org.apache.ignite.internal.cdc.CdcUtils;
+import org.apache.ignite.internal.client.thin.ClientBinary;
+import org.apache.ignite.internal.client.thin.TcpIgniteClient;
import org.apache.ignite.internal.processors.cache.StoredCacheData;
import
org.apache.ignite.internal.processors.cache.persistence.snapshot.dump.AbstractCacheDumpTest.TestDumpConsumer;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.junit.Test;
+import static org.apache.ignite.client.Config.SERVER;
import static org.apache.ignite.internal.cdc.SqlCdcTest.executeSql;
import static
org.apache.ignite.internal.processors.cache.persistence.snapshot.dump.AbstractCacheDumpTest.DMP_NAME;
import static
org.apache.ignite.internal.processors.cache.persistence.snapshot.dump.AbstractCacheDumpTest.KEYS_CNT;
@@ -42,11 +57,92 @@ import static
org.apache.ignite.internal.processors.cache.persistence.snapshot.d
public class DumpCacheConfigTest extends GridCommonAbstractTest {
/** {@inheritDoc} */
@Override protected void beforeTest() throws Exception {
+ stopAllGrids();
+
cleanPersistenceDir();
super.beforeTest();
}
+ /**
+ * Checks that when pass SQL flag to {@link
TcpIgniteClient#createCache(ClientCacheConfiguration, boolean)} table
+ * will be standart SQL table which can be modified and dropped with SQL
DDL.
+ */
+ @Test
+ public void testSQLTableRecreateFromDump() throws Exception {
+ IgniteEx srv = startGrid(1);
+
+ executeSql(srv, "CREATE TABLE T1(ID INT, NAME VARCHAR, PRIMARY KEY
(ID)) WITH \"CACHE_NAME=T1\"");
+
+ for (int i = 0; i < KEYS_CNT; i++)
+ executeSql(srv, "INSERT INTO T1 VALUES(?, ?)", i, "Name-" + i);
+
+ srv.snapshot().createDump(DMP_NAME, null).get(10_000L);
+
+ String cacheName = F.first(srv.cacheNames());
+
+ executeSql(srv, "DROP TABLE T1");
+
+ stopAllGrids();
+ cleanPersistenceDir(true);
+
+ srv = startGrid(1);
+
+ DumpConsumer cnsmr = new DumpConsumer() {
+ /** */
+ IgniteClient thin;
+
+ @Override public void start() {
+ thin = Ignition.startClient(new
ClientConfiguration().setAddresses(SERVER));
+ }
+
+ @Override public void onMappings(Iterator<TypeMapping> mappings) {
+ // No-op.
+ }
+
+ @Override public void onTypes(Iterator<BinaryType> types) {
+ BinaryContext bctx =
((ClientBinary)thin.binary()).binaryContext();
+
+ types.forEachRemaining(t -> CdcUtils.registerBinaryMeta(bctx,
log, ((BinaryTypeImpl)t).metadata()));
+ }
+
+ @Override public void onCacheConfigs(Iterator<StoredCacheData>
caches) {
+ caches.forEachRemaining(d ->
+
((TcpIgniteClient)thin).createCache(clientCacheConfig(d.config(),
d.queryEntities()), d.sql()));
+ }
+
+ @Override public void onPartition(int grp, int part,
Iterator<DumpEntry> data) {
+ while (data.hasNext()) {
+ DumpEntry e = data.next();
+ thin.cache(cacheName).put(e.key(), e.value());
+ }
+ }
+
+ @Override public void stop() {
+ U.closeQuiet(thin);
+ }
+ };
+
+ new DumpReader(
+ new DumpReaderConfiguration(
+ null,
+ new File(sharedFileTree(srv.configuration()).snapshotsRoot(),
DMP_NAME).getAbsolutePath(),
+ null,
+ cnsmr
+ ),
+ log
+ ).run();
+
+ List<List<?>> data = executeSql(srv, "SELECT ID, NAME FROM T1");
+
+ assertEquals(KEYS_CNT, data.size());
+
+ for (List<?> row : data)
+ assertEquals("Name-" + row.get(0), row.get(1));
+
+ executeSql(srv, "DROP TABLE T1");
+ }
+
/** */
@Test
public void testSQLTableDump() throws Exception {
@@ -147,4 +243,28 @@ public class DumpCacheConfigTest extends
GridCommonAbstractTest {
cnsmr.check();
}
+
+ /** */
+ private ClientCacheConfiguration clientCacheConfig(CacheConfiguration<?,
?> ccfg, Collection<QueryEntity> qes) {
+ ClientCacheConfiguration cliCfg = new ClientCacheConfiguration()
+ .setName(ccfg.getName())
+ .setAtomicityMode(ccfg.getAtomicityMode())
+ .setBackups(ccfg.getBackups())
+ .setCacheMode(ccfg.getCacheMode())
+ .setCopyOnRead(ccfg.isCopyOnRead())
+ .setDataRegionName(ccfg.getDataRegionName())
+ .setGroupName(ccfg.getGroupName())
+ .setQueryDetailMetricsSize(ccfg.getQueryDetailMetricsSize())
+ .setQueryParallelism(ccfg.getQueryParallelism())
+ .setSqlEscapeAll(ccfg.isSqlEscapeAll())
+ .setSqlIndexMaxInlineSize(ccfg.getSqlIndexMaxInlineSize())
+ .setSqlSchema(ccfg.getSqlSchema())
+ .setWriteSynchronizationMode(ccfg.getWriteSynchronizationMode())
+ .setKeyConfiguration(ccfg.getKeyConfiguration());
+
+ if (qes != null)
+ cliCfg.setQueryEntities(qes.toArray(new QueryEntity[0]));
+
+ return cliCfg;
+ }
}