Reenable CreateIndexIT#testCreateAndDeleteIndexConcurrently

Since #16442 is merged we should be able to reenable this test as a followup
of #15853 - all issues blocking it have been resolved I guess.
This commit is contained in:
Simon Willnauer 2016-03-15 09:31:13 +01:00
parent 345e988bbc
commit 29268f100b
2 changed files with 13 additions and 4 deletions

View File

@ -202,8 +202,12 @@ public class InternalClusterService extends AbstractLifecycleComponent<ClusterSe
@Override @Override
synchronized protected void doStop() { synchronized protected void doStop() {
for (NotifyTimeout onGoingTimeout : onGoingTimeouts) { for (NotifyTimeout onGoingTimeout : onGoingTimeouts) {
try {
onGoingTimeout.cancel(); onGoingTimeout.cancel();
onGoingTimeout.listener.onClose(); onGoingTimeout.listener.onClose();
} catch (Exception ex) {
logger.debug("failed to notify listeners on shutdown", ex);
}
} }
ThreadPool.terminate(updateTasksExecutor, 10, TimeUnit.SECONDS); ThreadPool.terminate(updateTasksExecutor, 10, TimeUnit.SECONDS);
remove(localNodeMasterListeners); remove(localNodeMasterListeners);

View File

@ -20,6 +20,7 @@
package org.elasticsearch.action.admin.indices.create; package org.elasticsearch.action.admin.indices.create;
import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.UnavailableShardsException;
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse; import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse; import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse;
import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchResponse;
@ -29,6 +30,7 @@ import org.elasticsearch.cluster.metadata.IndexMetaData;
import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.cluster.metadata.MetaData;
import org.elasticsearch.common.collect.ImmutableOpenMap; import org.elasticsearch.common.collect.ImmutableOpenMap;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.index.IndexNotFoundException; import org.elasticsearch.index.IndexNotFoundException;
import org.elasticsearch.index.mapper.MapperParsingException; import org.elasticsearch.index.mapper.MapperParsingException;
import org.elasticsearch.index.query.RangeQueryBuilder; import org.elasticsearch.index.query.RangeQueryBuilder;
@ -179,7 +181,6 @@ public class CreateIndexIT extends ESIntegTestCase {
} }
} }
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/14932,https://github.com/elastic/elasticsearch/pull/15853" )
public void testCreateAndDeleteIndexConcurrently() throws InterruptedException { public void testCreateAndDeleteIndexConcurrently() throws InterruptedException {
createIndex("test"); createIndex("test");
final AtomicInteger indexVersion = new AtomicInteger(0); final AtomicInteger indexVersion = new AtomicInteger(0);
@ -224,10 +225,14 @@ public class CreateIndexIT extends ESIntegTestCase {
for (int i = 0; i < numDocs; i++) { for (int i = 0; i < numDocs; i++) {
try { try {
synchronized (indexVersionLock) { synchronized (indexVersionLock) {
client().prepareIndex("test", "test").setSource("index_version", indexVersion.get()).get(); client().prepareIndex("test", "test").setSource("index_version", indexVersion.get())
.setTimeout(TimeValue.timeValueSeconds(10)).get();
} }
} catch (IndexNotFoundException inf) { } catch (IndexNotFoundException inf) {
// fine // fine
} catch (UnavailableShardsException ex) {
assertEquals(ex.getCause().getClass(), IndexNotFoundException.class);
// fine we run into a delete index while retrying
} }
} }
latch.await(); latch.await();