ElasticTestUtil: Wait until indexes are deleted
The cleanup of the Elasticsearch tests deletes and recreates all indexes. If we don't wait until the deletion is done the recreation can fail because the old index still exists. This decreases the chance of hitting [1] but doesn't fix it completely. [1] [accounts_0007] IndexAlreadyExistsException[already exists] at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService.validateIndexName(MetaDataCreateIndexService.java:136) at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService.validate(MetaDataCreateIndexService.java:431) at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService.access$100(MetaDataCreateIndexService.java:95) at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService$1.execute(MetaDataCreateIndexService.java:190) at org.elasticsearch.cluster.ClusterStateUpdateTask.execute(ClusterStateUpdateTask.java:45) at org.elasticsearch.cluster.service.InternalClusterService.runTasksForExecutor(InternalClusterService.java:480) at org.elasticsearch.cluster.service.InternalClusterService$UpdateTask.run(InternalClusterService.java:784) at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.runAndClean(PrioritizedEsThreadPoolExecutor.java:231) at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:194) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) ... Change-Id: I7b20a0cee6570c07ac93add51c80fcf74df941b2 Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
		@@ -110,7 +110,7 @@ final class ElasticTestUtils {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  static void deleteAllIndexes(ElasticNodeInfo nodeInfo) {
 | 
			
		||||
    nodeInfo.node.client().admin().indices().prepareDelete("_all").execute();
 | 
			
		||||
    nodeInfo.node.client().admin().indices().prepareDelete("_all").execute().actionGet();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  static class NodeInfo {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user