Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allocate to data-only nodes in ReopenWhileClosingIT #42560

Merged
merged 1 commit into from
May 27, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.elasticsearch.common.Glob;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.lease.Releasable;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.concurrent.RunOnce;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.ESIntegTestCase;
Expand All @@ -50,7 +51,7 @@
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;

@ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST, minNumDataNodes = 2)
@ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST)
public class ReopenWhileClosingIT extends ESIntegTestCase {

@Override
Expand All @@ -64,8 +65,9 @@ protected int minimumNumberOfShards() {
}

public void testReopenDuringClose() throws Exception {
List<String> dataOnlyNodes = internalCluster().startDataOnlyNodes(randomIntBetween(2, 3));
final String indexName = "test";
createIndexWithDocs(indexName);
createIndexWithDocs(indexName, dataOnlyNodes);

ensureYellowAndNoInitializingShards(indexName);

Expand All @@ -84,12 +86,12 @@ public void testReopenDuringClose() throws Exception {
assertIndexIsOpened(indexName);
}

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/39757")
public void testReopenDuringCloseOnMultipleIndices() throws Exception {
List<String> dataOnlyNodes = internalCluster().startDataOnlyNodes(randomIntBetween(2, 3));
final List<String> indices = new ArrayList<>();
for (int i = 0; i < randomIntBetween(2, 10); i++) {
indices.add("index-" + i);
createIndexWithDocs(indices.get(i));
createIndexWithDocs(indices.get(i), dataOnlyNodes);
}

ensureYellowAndNoInitializingShards(indices.toArray(Strings.EMPTY_ARRAY));
Expand Down Expand Up @@ -117,8 +119,9 @@ public void testReopenDuringCloseOnMultipleIndices() throws Exception {
});
}

private void createIndexWithDocs(final String indexName) {
createIndex(indexName);
private void createIndexWithDocs(final String indexName, final Collection<String> dataOnlyNodes) {
createIndex(indexName,
Settings.builder().put(indexSettings()).put("index.routing.allocation.include._name", String.join(",", dataOnlyNodes)).build());
final int nbDocs = scaledRandomIntBetween(1, 100);
for (int i = 0; i < nbDocs; i++) {
index(indexName, "_doc", String.valueOf(i), "num", i);
Expand Down