Revert "IGNITE-5789 Fix for case server was restarted, client doesn't create caches defined in client's configuration. - Fixes #3905."
This reverts commit d821d09
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index 4cda72a..f693c09 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@ -43,9 +43,7 @@
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.CacheRebalanceMode;
import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.events.DiscoveryEvent;
import org.apache.ignite.internal.IgniteClientDisconnectedCheckedException;
@@ -74,18 +72,17 @@
import org.apache.ignite.internal.processors.cache.ExchangeDiscoveryEvents;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate;
-import org.apache.ignite.internal.processors.cache.GridCacheProcessor;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.LocalJoinCachesContext;
import org.apache.ignite.internal.processors.cache.StateChangeRequest;
import org.apache.ignite.internal.processors.cache.WalStateAbstractMessage;
-import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.latch.Latch;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridClientPartitionTopology;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionTopology;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionsStateValidator;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTopologyFutureAdapter;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.latch.Latch;
import org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotDiscoveryMessage;
import org.apache.ignite.internal.processors.cache.transactions.IgniteTxKey;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
@@ -800,27 +797,6 @@
}
cctx.cache().startCachesOnLocalJoin(locJoinCtx, initialVersion());
-
- ensureClientCachesStarted();
- }
-
- /**
- * Start client caches if absent.
- */
- private void ensureClientCachesStarted() {
- GridCacheProcessor cacheProcessor = cctx.cache();
-
- Set<String> cacheNames = new HashSet<>(cacheProcessor.cacheNames());
-
- List<CacheConfiguration> notStartedCacheConfigs = new ArrayList<>();
-
- for (CacheConfiguration cCfg : cctx.gridConfig().getCacheConfiguration()) {
- if (!cacheNames.contains(cCfg.getName()))
- notStartedCacheConfigs.add(cCfg);
- }
-
- if (!notStartedCacheConfigs.isEmpty())
- cacheProcessor.dynamicStartCaches(notStartedCacheConfigs, false, false, false);
}
/**
@@ -3878,7 +3854,6 @@
/** */
NONE
}
-
/**
*
*/
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ClientReconnectAfterClusterRestartTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ClientReconnectAfterClusterRestartTest.java
index 85bad0f..357445e 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ClientReconnectAfterClusterRestartTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ClientReconnectAfterClusterRestartTest.java
@@ -18,9 +18,6 @@
package org.apache.ignite.internal.processors.cache;
import javax.cache.CacheException;
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteClientDisconnectedException;
@@ -36,21 +33,23 @@
import org.apache.ignite.events.Event;
import org.apache.ignite.events.EventType;
import org.apache.ignite.internal.binary.BinaryMarshaller;
+import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.lang.IgnitePredicate;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.jetbrains.annotations.NotNull;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+
/**
*/
public class ClientReconnectAfterClusterRestartTest extends GridCommonAbstractTest {
- /** Server id. */
- private static final int SERVER_ID = 0;
-
/** Client id. */
- private static final int CLIENT_ID = 1;
+ public static final int CLIENT_ID = 1;
/** Cache params. */
- private static final String CACHE_PARAMS = "PPRB_PARAMS";
+ public static final String CACHE_PARAMS = "PPRB_PARAMS";
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
@@ -59,9 +58,9 @@
cfg.setMarshaller(new BinaryMarshaller());
cfg.setIncludeEventTypes(EventType.EVTS_CACHE);
- if (getTestIgniteInstanceName(CLIENT_ID).equals(igniteInstanceName)) {
+ if (getTestIgniteInstanceName(CLIENT_ID).equals(igniteInstanceName))
cfg.setClientMode(true);
-
+ else {
CacheConfiguration ccfg = getCacheConfiguration();
cfg.setCacheConfiguration(ccfg);
@@ -89,7 +88,7 @@
LinkedHashMap<String, String> fields = new LinkedHashMap<>();
- fields.put("ID", "java.lang.Long");
+ fields.put("ID", "java.lang.Long" );
fields.put("PARTITIONID", "java.lang.Long");
fields.put("CLIENTID", "java.lang.Long");
fields.put("PARAMETRCODE", "java.lang.Long");
@@ -115,9 +114,9 @@
/** */
public void testReconnectClient() throws Exception {
try {
- startGrid(SERVER_ID);
+ startGrid(0);
- Ignite client = startGrid(CLIENT_ID);
+ Ignite client = startGrid(1);
checkTopology(2);
IgniteCache<Long, BinaryObject> cache = client.getOrCreateCache(CACHE_PARAMS).withKeepBinary();
@@ -162,7 +161,7 @@
Thread.sleep(2_000);
- startGrid(SERVER_ID);
+ startGrid(0);
try {
assertNull(cache.get(1L));
@@ -185,7 +184,6 @@
streamer.perNodeBufferSize(10000);
streamer.perNodeParallelOperations(100);
- IgniteCache<Long, BinaryObject> cache = client.getOrCreateCache(CACHE_PARAMS).withKeepBinary();
builder = client.binary().builder("PARAMS");
builder.setField("ID", 2L);