24
24
import org .elasticsearch .ElasticsearchException ;
25
25
import org .elasticsearch .action .NoShardAvailableActionException ;
26
26
import org .elasticsearch .action .get .GetResponse ;
27
- import org .elasticsearch .action .index .IndexRequestBuilder ;
28
27
import org .elasticsearch .action .index .IndexResponse ;
29
28
import org .elasticsearch .client .Client ;
30
29
import org .elasticsearch .cluster .ClusterState ;
36
35
import org .elasticsearch .common .settings .Settings ;
37
36
import org .elasticsearch .common .unit .TimeValue ;
38
37
import org .elasticsearch .common .xcontent .XContentType ;
39
- import org .elasticsearch .indices .store .IndicesStoreIntegrationIT ;
40
- import org .elasticsearch .test .ESIntegTestCase .ClusterScope ;
41
- import org .elasticsearch .test .ESIntegTestCase .Scope ;
38
+ import org .elasticsearch .test .ESIntegTestCase ;
42
39
import org .elasticsearch .test .InternalTestCluster ;
43
40
import org .elasticsearch .test .disruption .NetworkDisruption ;
44
41
import org .elasticsearch .test .disruption .NetworkDisruption .Bridge ;
72
69
/**
73
70
* Tests various cluster operations (e.g., indexing) during disruptions.
74
71
*/
75
- @ ClusterScope (scope = Scope .TEST , numDataNodes = 0 , transportClientRatio = 0 , autoMinMasterNodes = false )
76
72
@ TestLogging ("_root:DEBUG,org.elasticsearch.cluster.service:TRACE" )
73
+ @ ESIntegTestCase .ClusterScope (scope = ESIntegTestCase .Scope .TEST , numDataNodes = 0 , transportClientRatio = 0 )
77
74
public class ClusterDisruptionIT extends AbstractDisruptionTestCase {
78
75
79
76
/**
@@ -289,7 +286,7 @@ public void testRejoinDocumentExistsInAllShardCopies() throws Exception {
289
286
290
287
// simulate handling of sending shard failure during an isolation
291
288
public void testSendingShardFailure () throws Exception {
292
- List <String > nodes = startCluster (3 , 2 );
289
+ List <String > nodes = startCluster (3 );
293
290
String masterNode = internalCluster ().getMasterName ();
294
291
List <String > nonMasterNodes = nodes .stream ().filter (node -> !node .equals (masterNode )).collect (Collectors .toList ());
295
292
String nonMasterNode = randomFrom (nonMasterNodes );
@@ -357,43 +354,10 @@ public void onFailure(Exception e) {
357
354
}
358
355
}
359
356
360
- /**
361
- * This test creates a scenario where a primary shard (0 replicas) relocates and is in POST_RECOVERY on the target
362
- * node but already deleted on the source node. Search request should still work.
363
- */
364
- public void testSearchWithRelocationAndSlowClusterStateProcessing () throws Exception {
365
- // don't use DEFAULT settings (which can cause node disconnects on a slow CI machine)
366
- configureCluster (Settings .EMPTY , 3 , 1 );
367
- internalCluster ().startMasterOnlyNode ();
368
- final String node_1 = internalCluster ().startDataOnlyNode ();
369
-
370
- logger .info ("--> creating index [test] with one shard and on replica" );
371
- assertAcked (prepareCreate ("test" ).setSettings (
372
- Settings .builder ().put (indexSettings ())
373
- .put (IndexMetaData .SETTING_NUMBER_OF_SHARDS , 1 )
374
- .put (IndexMetaData .SETTING_NUMBER_OF_REPLICAS , 0 ))
375
- );
376
- ensureGreen ("test" );
377
-
378
- final String node_2 = internalCluster ().startDataOnlyNode ();
379
- List <IndexRequestBuilder > indexRequestBuilderList = new ArrayList <>();
380
- for (int i = 0 ; i < 100 ; i ++) {
381
- indexRequestBuilderList .add (client ().prepareIndex ().setIndex ("test" ).setType ("_doc" )
382
- .setSource ("{\" int_field\" :1}" , XContentType .JSON ));
383
- }
384
- indexRandom (true , indexRequestBuilderList );
385
-
386
- IndicesStoreIntegrationIT .relocateAndBlockCompletion (logger , "test" , 0 , node_1 , node_2 );
387
- // now search for the documents and see if we get a reply
388
- assertThat (client ().prepareSearch ().setSize (0 ).get ().getHits ().getTotalHits (), equalTo (100L ));
389
- }
390
-
391
357
public void testIndexImportedFromDataOnlyNodesIfMasterLostDataFolder () throws Exception {
392
358
// test for https://github.com/elastic/elasticsearch/issues/8823
393
- configureCluster (2 , 1 );
394
359
String masterNode = internalCluster ().startMasterOnlyNode (Settings .EMPTY );
395
360
internalCluster ().startDataOnlyNode (Settings .EMPTY );
396
-
397
361
ensureStableCluster (2 );
398
362
assertAcked (prepareCreate ("index" ).setSettings (Settings .builder ().put ("index.number_of_replicas" , 0 )));
399
363
index ("index" , "_doc" , "1" , jsonBuilder ().startObject ().field ("text" , "some text" ).endObject ());
@@ -416,14 +380,12 @@ public boolean clearData(String nodeName) {
416
380
*/
417
381
public void testIndicesDeleted () throws Exception {
418
382
final Settings settings = Settings .builder ()
419
- .put (DEFAULT_SETTINGS )
420
383
.put (DiscoverySettings .PUBLISH_TIMEOUT_SETTING .getKey (), "0s" ) // don't wait on isolated data node
421
384
.put (DiscoverySettings .COMMIT_TIMEOUT_SETTING .getKey (), "30s" ) // wait till cluster state is committed
422
385
.build ();
423
386
final String idxName = "test" ;
424
- configureCluster (settings , 3 , 2 );
425
- final List <String > allMasterEligibleNodes = internalCluster ().startMasterOnlyNodes (2 );
426
- final String dataNode = internalCluster ().startDataOnlyNode ();
387
+ final List <String > allMasterEligibleNodes = internalCluster ().startMasterOnlyNodes (2 , settings );
388
+ final String dataNode = internalCluster ().startDataOnlyNode (settings );
427
389
ensureStableCluster (3 );
428
390
assertAcked (prepareCreate ("test" ));
429
391
0 commit comments