File tree 2 files changed +9
-4
lines changed
server/src/test/java/org/elasticsearch/action/admin/indices/create
test/framework/src/main/java/org/elasticsearch/test 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 75
75
import static org .hamcrest .Matchers .equalTo ;
76
76
import static org .hamcrest .Matchers .greaterThanOrEqualTo ;
77
77
78
- @ ESIntegTestCase .AwaitsFix (bugUrl = "https://github.com/elastic/elasticsearch/issues/44164" )
79
78
public class ShrinkIndexIT extends ESIntegTestCase {
80
79
81
80
@ Override
@@ -559,16 +558,15 @@ public void testShrinkCommitsMergeOnIdle() throws Exception {
559
558
}
560
559
561
560
public void testShrinkThenSplitWithFailedNode () throws Exception {
562
- internalCluster ().ensureAtLeastNumDataNodes (3 );
561
+ internalCluster ().ensureAtLeastNumDataNodes (2 );
562
+ final String shrinkNode = internalCluster ().startDataOnlyNode ();
563
563
564
564
final int shardCount = between (2 , 5 );
565
565
prepareCreate ("original" ).setSettings (Settings .builder ().put (indexSettings ())
566
566
.put (IndexMetaData .SETTING_NUMBER_OF_REPLICAS , 0 )
567
567
.put (IndexMetaData .SETTING_NUMBER_OF_SHARDS , shardCount )).get ();
568
568
client ().admin ().indices ().prepareFlush ("original" ).get ();
569
569
ensureGreen ();
570
- final String shrinkNode
571
- = client ().admin ().cluster ().prepareNodesInfo ("data:true" ).clear ().get ().getNodes ().get (0 ).getNode ().getName ();
572
570
client ().admin ().indices ().prepareUpdateSettings ("original" )
573
571
.setSettings (Settings .builder ()
574
572
.put (IndexMetaData .INDEX_ROUTING_REQUIRE_GROUP_SETTING .getConcreteSettingForNamespace ("_name" ).getKey (), shrinkNode )
Original file line number Diff line number Diff line change @@ -1485,6 +1485,13 @@ public synchronized void stopRandomNode(final Predicate<Settings> filter) throws
1485
1485
ensureOpen ();
1486
1486
NodeAndClient nodeAndClient = getRandomNodeAndClient (nc -> filter .test (nc .node .settings ()));
1487
1487
if (nodeAndClient != null ) {
1488
+ if (nodeAndClient .nodeAndClientId () < sharedNodesSeeds .length && nodeAndClient .isMasterEligible () && autoManageMasterNodes
1489
+ && nodes .values ().stream ()
1490
+ .filter (NodeAndClient ::isMasterEligible )
1491
+ .filter (n -> n .nodeAndClientId () < sharedNodesSeeds .length )
1492
+ .count () == 1 ) {
1493
+ throw new AssertionError ("Tried to stop the only master eligible shared node" );
1494
+ }
1488
1495
logger .info ("Closing filtered random node [{}] " , nodeAndClient .name );
1489
1496
stopNodesAndClient (nodeAndClient );
1490
1497
}
You can’t perform that action at this time.
0 commit comments