You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by an...@apache.org on 2015/03/27 22:01:54 UTC
svn commit: r1669687 - in /lucene/dev/branches/branch_5x: ./ solr/
solr/core/ solr/core/src/test/org/apache/solr/cloud/
solr/core/src/test/org/apache/solr/cloud/hdfs/ solr/test-framework/
solr/test-framework/src/java/org/apache/solr/ solr/test-framewor...
Author: andyetitmoves
Date: Fri Mar 27 21:01:54 2015
New Revision: 1669687
URL: http://svn.apache.org/r1669687
Log:
SOLR-7291: Test indexing on ZK disconnect with ChaosMonkey tests
Added:
lucene/dev/branches/branch_5x/solr/test-framework/src/java/org/apache/solr/cloud/StoppableIndexingThread.java
- copied unchanged from r1669026, lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/StoppableIndexingThread.java
lucene/dev/branches/branch_5x/solr/test-framework/src/java/org/apache/solr/cloud/StoppableSearchThread.java
- copied unchanged from r1669026, lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/StoppableSearchThread.java
Removed:
lucene/dev/branches/branch_5x/solr/test-framework/src/java/org/apache/solr/cloud/StopableIndexingThread.java
Modified:
lucene/dev/branches/branch_5x/ (props changed)
lucene/dev/branches/branch_5x/solr/ (props changed)
lucene/dev/branches/branch_5x/solr/CHANGES.txt (contents, props changed)
lucene/dev/branches/branch_5x/solr/core/ (props changed)
lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java
lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderTest.java
lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/RecoveryZkTest.java
lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsWriteToMultipleCollectionsTest.java
lucene/dev/branches/branch_5x/solr/test-framework/ (props changed)
lucene/dev/branches/branch_5x/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java
lucene/dev/branches/branch_5x/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java
lucene/dev/branches/branch_5x/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java
Modified: lucene/dev/branches/branch_5x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/CHANGES.txt?rev=1669687&r1=1669686&r2=1669687&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_5x/solr/CHANGES.txt Fri Mar 27 21:01:54 2015
@@ -374,6 +374,8 @@ Other Changes
* SOLR-6673: MDC based logging of collection, shard, replica, core
(Ishan Chattopadhyaya , Noble Paul)
+* SOLR-7291: Test indexing on ZK disconnect with ChaosMonkey tests (Ramkumar Aiyengar)
+
* SOLR-7203: Remove buggy no-op retry code in HttpSolrClient (Alan Woodward,
Mark Miller, Greg Solovyev)
@@ -382,7 +384,7 @@ Other Changes
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
NOTE: Solr 5.0 only supports creating and removing SolrCloud collections through
- the collections API, unlike previous versions. While not using the
+ the collections API, unlike previous versions. While not using the
collections API may still work in 5.0, it is unsupported, not recommended,
and the behavior will change in a 5.x release.
Modified: lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java?rev=1669687&r1=1669686&r2=1669687&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java Fri Mar 27 21:01:54 2015
@@ -115,11 +115,15 @@ public class ChaosMonkeyNothingIsSafeTes
numShards = sliceCount + random().nextInt(TEST_NIGHTLY ? 12 : 2) + 1;
}
fixShardCount(numShards);
+
+ // None of the operations used here are particularly costly, so this should work.
+ // Using this low timeout will also help us catch index stalling.
+ clientSoTimeout = 5000;
}
@Test
public void test() throws Exception {
- boolean testsSuccesful = false;
+ boolean testSuccessful = false;
try {
handle.clear();
handle.put("timestamp", SKIPVAL);
@@ -133,14 +137,14 @@ public class ChaosMonkeyNothingIsSafeTes
// we cannot do delete by query
// as it's not supported for recovery
- del("*:*");
+ del("*:*");
- List<StopableThread> threads = new ArrayList<>();
- List<StopableIndexingThread> indexTreads = new ArrayList<>();
+ List<StoppableThread> threads = new ArrayList<>();
+ List<StoppableIndexingThread> indexTreads = new ArrayList<>();
int threadCount = TEST_NIGHTLY ? 3 : 1;
int i = 0;
for (i = 0; i < threadCount; i++) {
- StopableIndexingThread indexThread = new StopableIndexingThread(controlClient, cloudClient, Integer.toString(i), true);
+ StoppableIndexingThread indexThread = new StoppableIndexingThread(controlClient, cloudClient, Integer.toString(i), true);
threads.add(indexThread);
indexTreads.add(indexThread);
indexThread.start();
@@ -149,7 +153,7 @@ public class ChaosMonkeyNothingIsSafeTes
threadCount = 1;
i = 0;
for (i = 0; i < threadCount; i++) {
- StopableSearchThread searchThread = new StopableSearchThread();
+ StoppableSearchThread searchThread = new StoppableSearchThread(cloudClient);
threads.add(searchThread);
searchThread.start();
}
@@ -158,7 +162,7 @@ public class ChaosMonkeyNothingIsSafeTes
// it's currently hard to know what requests failed when using ConcurrentSolrUpdateServer
boolean runFullThrottle = random().nextBoolean();
if (runFullThrottle) {
- FullThrottleStopableIndexingThread ftIndexThread = new FullThrottleStopableIndexingThread(
+ FullThrottleStoppableIndexingThread ftIndexThread = new FullThrottleStoppableIndexingThread(
clients, "ft1", true);
threads.add(ftIndexThread);
ftIndexThread.start();
@@ -184,15 +188,18 @@ public class ChaosMonkeyNothingIsSafeTes
} finally {
chaosMonkey.stopTheMonkey();
}
-
- for (StopableThread indexThread : threads) {
+
+ // ideally this should go into chaosMonkey
+ restartZk(1000 * (5 + random().nextInt(4)));
+
+ for (StoppableThread indexThread : threads) {
indexThread.safeStop();
}
// start any downed jetties to be sure we still will end up with a leader per shard...
// wait for stop...
- for (StopableThread indexThread : threads) {
+ for (StoppableThread indexThread : threads) {
indexThread.join();
}
@@ -217,9 +224,11 @@ public class ChaosMonkeyNothingIsSafeTes
// we expect full throttle fails, but cloud client should not easily fail
- for (StopableThread indexThread : threads) {
- if (indexThread instanceof StopableIndexingThread && !(indexThread instanceof FullThrottleStopableIndexingThread)) {
- assertFalse("There were too many update fails - we expect it can happen, but shouldn't easily", ((StopableIndexingThread) indexThread).getFailCount() > FAIL_TOLERANCE);
+ for (StoppableThread indexThread : threads) {
+ if (indexThread instanceof StoppableIndexingThread && !(indexThread instanceof FullThrottleStoppableIndexingThread)) {
+ int failCount = ((StoppableIndexingThread) indexThread).getFailCount();
+ assertFalse("There were too many update fails (" + failCount + " > " + FAIL_TOLERANCE
+ + ") - we expect it can happen, but shouldn't easily", failCount > FAIL_TOLERANCE);
}
}
@@ -247,11 +256,8 @@ public class ChaosMonkeyNothingIsSafeTes
// sometimes we restart zookeeper as well
if (random().nextBoolean()) {
- zkServer.shutdown();
- zkServer = new ZkTestServer(zkServer.getZkDir(), zkServer.getPort());
- zkServer.run();
+ restartZk(1000 * (5 + random().nextInt(4)));
}
-
try (CloudSolrClient client = createCloudClient("collection1")) {
createCollection(null, "testcollection",
@@ -263,31 +269,31 @@ public class ChaosMonkeyNothingIsSafeTes
numShardsNumReplicas.add(1);
checkForCollection("testcollection", numShardsNumReplicas, null);
- testsSuccesful = true;
+ testSuccessful = true;
} finally {
- if (!testsSuccesful) {
+ if (!testSuccessful) {
printLayout();
}
}
}
- private Set<String> getAddFails(List<StopableIndexingThread> threads) {
+ private Set<String> getAddFails(List<StoppableIndexingThread> threads) {
Set<String> addFails = new HashSet<String>();
- for (StopableIndexingThread thread : threads) {
+ for (StoppableIndexingThread thread : threads) {
addFails.addAll(thread.getAddFails());
}
return addFails;
}
- private Set<String> getDeleteFails(List<StopableIndexingThread> threads) {
+ private Set<String> getDeleteFails(List<StoppableIndexingThread> threads) {
Set<String> deleteFails = new HashSet<String>();
- for (StopableIndexingThread thread : threads) {
+ for (StoppableIndexingThread thread : threads) {
deleteFails.addAll(thread.getDeleteFails());
}
return deleteFails;
}
- class FullThrottleStopableIndexingThread extends StopableIndexingThread {
+ class FullThrottleStoppableIndexingThread extends StoppableIndexingThread {
private CloseableHttpClient httpClient = HttpClientUtil.createClient(null);
private volatile boolean stop = false;
int clientIndex = 0;
@@ -295,14 +301,14 @@ public class ChaosMonkeyNothingIsSafeTes
private List<SolrClient> clients;
private AtomicInteger fails = new AtomicInteger();
- public FullThrottleStopableIndexingThread(List<SolrClient> clients,
- String id, boolean doDeletes) {
+ public FullThrottleStoppableIndexingThread(List<SolrClient> clients,
+ String id, boolean doDeletes) {
super(controlClient, cloudClient, id, doDeletes);
setName("FullThrottleStopableIndexingThread");
setDaemon(true);
this.clients = clients;
- HttpClientUtil.setConnectionTimeout(httpClient, 15000);
- HttpClientUtil.setSoTimeout(httpClient, 15000);
+ HttpClientUtil.setConnectionTimeout(httpClient, clientConnectionTimeout);
+ HttpClientUtil.setSoTimeout(httpClient, clientSoTimeout);
cusc = new ConcurrentUpdateSolrClient(
((HttpSolrClient) clients.get(0)).getBaseURL(), httpClient, 8,
2) {
Modified: lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderTest.java?rev=1669687&r1=1669686&r2=1669687&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderTest.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderTest.java Fri Mar 27 21:01:54 2015
@@ -110,7 +110,7 @@ public class ChaosMonkeySafeLeaderTest e
tryDelete();
- List<StopableIndexingThread> threads = new ArrayList<>();
+ List<StoppableIndexingThread> threads = new ArrayList<>();
int threadCount = 2;
int batchSize = 1;
if (random().nextBoolean()) {
@@ -126,7 +126,7 @@ public class ChaosMonkeySafeLeaderTest e
}
for (int i = 0; i < threadCount; i++) {
- StopableIndexingThread indexThread = new StopableIndexingThread(controlClient, cloudClient, Integer.toString(i), true, maxUpdates, batchSize, pauseBetweenUpdates); // random().nextInt(999) + 1
+ StoppableIndexingThread indexThread = new StoppableIndexingThread(controlClient, cloudClient, Integer.toString(i), true, maxUpdates, batchSize, pauseBetweenUpdates); // random().nextInt(999) + 1
threads.add(indexThread);
indexThread.start();
}
@@ -152,16 +152,16 @@ public class ChaosMonkeySafeLeaderTest e
chaosMonkey.stopTheMonkey();
}
- for (StopableIndexingThread indexThread : threads) {
+ for (StoppableIndexingThread indexThread : threads) {
indexThread.safeStop();
}
// wait for stop...
- for (StopableIndexingThread indexThread : threads) {
+ for (StoppableIndexingThread indexThread : threads) {
indexThread.join();
}
- for (StopableIndexingThread indexThread : threads) {
+ for (StoppableIndexingThread indexThread : threads) {
assertEquals(0, indexThread.getFailCount());
}
Modified: lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/RecoveryZkTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/RecoveryZkTest.java?rev=1669687&r1=1669686&r2=1669687&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/RecoveryZkTest.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/RecoveryZkTest.java Fri Mar 27 21:01:54 2015
@@ -34,8 +34,8 @@ public class RecoveryZkTest extends Abst
//private static final String DISTRIB_UPDATE_CHAIN = "distrib-update-chain";
private static Logger log = LoggerFactory.getLogger(RecoveryZkTest.class);
- private StopableIndexingThread indexThread;
- private StopableIndexingThread indexThread2;
+ private StoppableIndexingThread indexThread;
+ private StoppableIndexingThread indexThread2;
public RecoveryZkTest() {
super();
@@ -72,11 +72,11 @@ public class RecoveryZkTest extends Abst
maxDoc = maxDocNightlyList[random().nextInt(maxDocList.length - 1)];
}
- indexThread = new StopableIndexingThread(controlClient, cloudClient, "1", true, maxDoc, 1, true);
+ indexThread = new StoppableIndexingThread(controlClient, cloudClient, "1", true, maxDoc, 1, true);
indexThread.start();
- indexThread2 = new StopableIndexingThread(controlClient, cloudClient, "2", true, maxDoc, 1, true);
-
+ indexThread2 = new StoppableIndexingThread(controlClient, cloudClient, "2", true, maxDoc, 1, true);
+
indexThread2.start();
// give some time to index...
Modified: lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsWriteToMultipleCollectionsTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsWriteToMultipleCollectionsTest.java?rev=1669687&r1=1669686&r2=1669687&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsWriteToMultipleCollectionsTest.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/hdfs/HdfsWriteToMultipleCollectionsTest.java Fri Mar 27 21:01:54 2015
@@ -29,7 +29,7 @@ import org.apache.solr.client.solrj.Solr
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
import org.apache.solr.client.solrj.impl.CloudSolrClient;
import org.apache.solr.cloud.BasicDistributedZkTest;
-import org.apache.solr.cloud.StopableIndexingThread;
+import org.apache.solr.cloud.StoppableIndexingThread;
import org.apache.solr.core.CoreContainer;
import org.apache.solr.core.HdfsDirectoryFactory;
import org.apache.solr.core.SolrCore;
@@ -97,18 +97,18 @@ public class HdfsWriteToMultipleCollecti
waitForRecoveriesToFinish(ACOLLECTION + i, false);
}
List<CloudSolrClient> cloudClients = new ArrayList<>();
- List<StopableIndexingThread> threads = new ArrayList<>();
+ List<StoppableIndexingThread> threads = new ArrayList<>();
for (int i = 0; i < cnt; i++) {
CloudSolrClient client = new CloudSolrClient(zkServer.getZkAddress());
client.setDefaultCollection(ACOLLECTION + i);
cloudClients.add(client);
- StopableIndexingThread indexThread = new StopableIndexingThread(null, client, "1", true, docCount, 1, true);
+ StoppableIndexingThread indexThread = new StoppableIndexingThread(null, client, "1", true, docCount, 1, true);
threads.add(indexThread);
indexThread.start();
}
int addCnt = 0;
- for (StopableIndexingThread thread : threads) {
+ for (StoppableIndexingThread thread : threads) {
thread.join();
addCnt += thread.getNumAdds() - thread.getNumDeletes();
}
Modified: lucene/dev/branches/branch_5x/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java?rev=1669687&r1=1669686&r2=1669687&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java (original)
+++ lucene/dev/branches/branch_5x/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java Fri Mar 27 21:01:54 2015
@@ -230,6 +230,8 @@ public abstract class BaseDistributedSea
protected boolean verifyStress = true;
protected int nThreads = 3;
+ protected int clientConnectionTimeout = DEFAULT_CONNECTION_TIMEOUT;
+ protected int clientSoTimeout = 90000;
public static int ORDERED = 1;
public static int SKIP = 2;
@@ -435,8 +437,8 @@ public abstract class BaseDistributedSea
try {
// setup the client...
HttpSolrClient client = new HttpSolrClient(buildUrl(port) + "/" + DEFAULT_TEST_CORENAME);
- client.setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT);
- client.setSoTimeout(90000);
+ client.setConnectionTimeout(clientConnectionTimeout);
+ client.setSoTimeout(clientSoTimeout);
client.setDefaultMaxConnectionsPerHost(100);
client.setMaxTotalConnections(100);
return client;
Modified: lucene/dev/branches/branch_5x/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java?rev=1669687&r1=1669686&r2=1669687&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java (original)
+++ lucene/dev/branches/branch_5x/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java Fri Mar 27 21:01:54 2015
@@ -232,4 +232,13 @@ public abstract class AbstractDistribZkT
zkClient.printLayoutToStdOut();
zkClient.close();
}
+
+ protected void restartZk(int pauseMillis) throws Exception {
+ log.info("Restarting ZK with a pause of {}ms in between", pauseMillis);
+ zkServer.shutdown();
+ // disconnect enough to test stalling, if things stall, then clientSoTimeout w""ill be hit
+ Thread.sleep(pauseMillis);
+ zkServer = new ZkTestServer(zkServer.getZkDir(), zkServer.getPort());
+ zkServer.run();
+ }
}
Modified: lucene/dev/branches/branch_5x/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java?rev=1669687&r1=1669686&r2=1669687&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java (original)
+++ lucene/dev/branches/branch_5x/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java Fri Mar 27 21:01:54 2015
@@ -35,7 +35,6 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
-import java.util.Random;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
@@ -123,7 +122,7 @@ public abstract class AbstractFullDistri
protected boolean checkCreatedVsState;
protected boolean useJettyDataDir = true;
- protected Map<URI,SocketProxy> proxies = new HashMap<URI,SocketProxy>();
+ protected Map<URI,SocketProxy> proxies = new HashMap<>();
public static class CloudJettyRunner {
public JettySolrRunner jetty;
@@ -202,14 +201,11 @@ public abstract class AbstractFullDistri
if (isSSLMode()) {
System.clearProperty("urlScheme");
- ZkStateReader zkStateReader = new ZkStateReader(zkServer.getZkAddress(),
- AbstractZkTestCase.TIMEOUT, AbstractZkTestCase.TIMEOUT);
- try {
+ try (ZkStateReader zkStateReader = new ZkStateReader(zkServer.getZkAddress(),
+ AbstractZkTestCase.TIMEOUT, AbstractZkTestCase.TIMEOUT)) {
zkStateReader.getZkClient().create(ZkStateReader.CLUSTER_PROPS,
- ZkStateReader.toJSON(Collections.singletonMap("urlScheme","https")),
- CreateMode.PERSISTENT, true);
- } finally {
- zkStateReader.close();
+ ZkStateReader.toJSON(Collections.singletonMap("urlScheme", "https")),
+ CreateMode.PERSISTENT, true);
}
}
}
@@ -1374,16 +1370,13 @@ public abstract class AbstractFullDistri
.getNumFound();
// do some really inefficient mapping...
- ZkStateReader zk = new ZkStateReader(zkServer.getZkAddress(), 10000,
- AbstractZkTestCase.TIMEOUT);
Map<String,Slice> slices = null;
ClusterState clusterState;
- try {
+ try (ZkStateReader zk = new ZkStateReader(zkServer.getZkAddress(), 10000,
+ AbstractZkTestCase.TIMEOUT)) {
zk.createClusterStateWatchersAndUpdate();
clusterState = zk.getClusterState();
slices = clusterState.getSlicesMap(DEFAULT_COLLECTION);
- } finally {
- zk.close();
}
if (slices == null) {
@@ -1433,67 +1426,16 @@ public abstract class AbstractFullDistri
if (r.nextBoolean()) params.set("collection", DEFAULT_COLLECTION);
- QueryResponse rsp = cloudClient.query(params);
- return rsp;
+ return cloudClient.query(params);
}
- static abstract class StopableThread extends Thread {
- public StopableThread(String name) {
+ static abstract class StoppableThread extends Thread {
+ public StoppableThread(String name) {
super(name);
}
public abstract void safeStop();
}
- class StopableSearchThread extends StopableThread {
- private volatile boolean stop = false;
- protected final AtomicInteger queryFails = new AtomicInteger();
- private String[] QUERIES = new String[] {"to come","their country","aid","co*"};
-
- public StopableSearchThread() {
- super("StopableSearchThread");
- setDaemon(true);
- }
-
- @Override
- public void run() {
- Random random = random();
- int numSearches = 0;
-
- while (true && !stop) {
- numSearches++;
- try {
- //to come to the aid of their country.
- cloudClient.query(new SolrQuery(QUERIES[random.nextInt(QUERIES.length)]));
- } catch (Exception e) {
- System.err.println("QUERY REQUEST FAILED:");
- e.printStackTrace();
- if (e instanceof SolrServerException) {
- System.err.println("ROOT CAUSE:");
- ((SolrServerException) e).getRootCause().printStackTrace();
- }
- queryFails.incrementAndGet();
- }
- try {
- Thread.sleep(random.nextInt(4000) + 300);
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- }
- }
-
- log.info("num searches done:" + numSearches + " with " + queryFails + " fails");
- }
-
- @Override
- public void safeStop() {
- stop = true;
- }
-
- public int getFails() {
- return queryFails.get();
- }
-
- };
-
public void waitForThingsToLevelOut(int waitForRecTimeSeconds) throws Exception {
log.info("Wait for recoveries to finish - wait " + waitForRecTimeSeconds + " for each attempt");
int cnt = 0;
@@ -1922,14 +1864,14 @@ public abstract class AbstractFullDistri
REPLICATION_FACTOR, replicationFactor,
MAX_SHARDS_PER_NODE, maxShardsPerNode,
NUM_SLICES, numShards);
- Map<String,List<Integer>> collectionInfos = new HashMap<String,List<Integer>>();
+ Map<String,List<Integer>> collectionInfos = new HashMap<>();
createCollection(collectionInfos, collName, props, client);
}
protected List<Replica> ensureAllReplicasAreActive(String testCollectionName, String shardId, int shards, int rf, int maxWaitSecs) throws Exception {
long startMs = System.currentTimeMillis();
- Map<String,Replica> notLeaders = new HashMap<String,Replica>();
+ Map<String,Replica> notLeaders = new HashMap<>();
ZkStateReader zkr = cloudClient.getZkStateReader();
zkr.updateClusterState(true); // force the state to be fresh
@@ -1989,7 +1931,7 @@ public abstract class AbstractFullDistri
long diffMs = (System.currentTimeMillis() - startMs);
log.info("Took " + diffMs + " ms to see all replicas become active.");
- List<Replica> replicas = new ArrayList<Replica>();
+ List<Replica> replicas = new ArrayList<>();
replicas.addAll(notLeaders.values());
return replicas;
}
@@ -2005,7 +1947,7 @@ public abstract class AbstractFullDistri
if (collection != null) {
cs = clusterState.getCollection(collection).toString();
} else {
- Map<String,DocCollection> map = new HashMap<String,DocCollection>();
+ Map<String,DocCollection> map = new HashMap<>();
for (String coll : clusterState.getCollections())
map.put(coll, clusterState.getCollection(coll));
CharArr out = new CharArr();