28
28
import org .elasticsearch .common .Glob ;
29
29
import org .elasticsearch .common .Strings ;
30
30
import org .elasticsearch .common .lease .Releasable ;
31
+ import org .elasticsearch .common .settings .Settings ;
31
32
import org .elasticsearch .common .util .concurrent .RunOnce ;
32
33
import org .elasticsearch .plugins .Plugin ;
33
34
import org .elasticsearch .test .ESIntegTestCase ;
50
51
import static org .hamcrest .Matchers .is ;
51
52
import static org .hamcrest .Matchers .notNullValue ;
52
53
53
- @ ESIntegTestCase .ClusterScope (scope = ESIntegTestCase .Scope .TEST , minNumDataNodes = 2 )
54
+ @ ESIntegTestCase .ClusterScope (scope = ESIntegTestCase .Scope .TEST )
54
55
public class ReopenWhileClosingIT extends ESIntegTestCase {
55
56
56
57
@ Override
@@ -64,8 +65,9 @@ protected int minimumNumberOfShards() {
64
65
}
65
66
66
67
public void testReopenDuringClose () throws Exception {
68
+ List <String > dataOnlyNodes = internalCluster ().startDataOnlyNodes (randomIntBetween (2 , 3 ));
67
69
final String indexName = "test" ;
68
- createIndexWithDocs (indexName );
70
+ createIndexWithDocs (indexName , dataOnlyNodes );
69
71
70
72
ensureYellowAndNoInitializingShards (indexName );
71
73
@@ -84,12 +86,12 @@ public void testReopenDuringClose() throws Exception {
84
86
assertIndexIsOpened (indexName );
85
87
}
86
88
87
- @ AwaitsFix (bugUrl = "https://github.com/elastic/elasticsearch/issues/39757" )
88
89
public void testReopenDuringCloseOnMultipleIndices () throws Exception {
90
+ List <String > dataOnlyNodes = internalCluster ().startDataOnlyNodes (randomIntBetween (2 , 3 ));
89
91
final List <String > indices = new ArrayList <>();
90
92
for (int i = 0 ; i < randomIntBetween (2 , 10 ); i ++) {
91
93
indices .add ("index-" + i );
92
- createIndexWithDocs (indices .get (i ));
94
+ createIndexWithDocs (indices .get (i ), dataOnlyNodes );
93
95
}
94
96
95
97
ensureYellowAndNoInitializingShards (indices .toArray (Strings .EMPTY_ARRAY ));
@@ -117,8 +119,9 @@ public void testReopenDuringCloseOnMultipleIndices() throws Exception {
117
119
});
118
120
}
119
121
120
- private void createIndexWithDocs (final String indexName ) {
121
- createIndex (indexName );
122
+ private void createIndexWithDocs (final String indexName , final Collection <String > dataOnlyNodes ) {
123
+ createIndex (indexName ,
124
+ Settings .builder ().put (indexSettings ()).put ("index.routing.allocation.include._name" , String .join ("," , dataOnlyNodes )).build ());
122
125
final int nbDocs = scaledRandomIntBetween (1 , 100 );
123
126
for (int i = 0 ; i < nbDocs ; i ++) {
124
127
index (indexName , "_doc" , String .valueOf (i ), "num" , i );
0 commit comments