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 @@ -1632,6 +1632,13 @@ public synchronized void stopRandomNode(final Predicate<Settings> filter) throws
1632
1632
ensureOpen ();
1633
1633
NodeAndClient nodeAndClient = getRandomNodeAndClient (nc -> filter .test (nc .node .settings ()));
1634
1634
if (nodeAndClient != null ) {
1635
+ if (nodeAndClient .nodeAndClientId () < sharedNodesSeeds .length && nodeAndClient .isMasterEligible () && autoManageMasterNodes
1636
+ && nodes .values ().stream ()
1637
+ .filter (NodeAndClient ::isMasterEligible )
1638
+ .filter (n -> n .nodeAndClientId () < sharedNodesSeeds .length )
1639
+ .count () == 1 ) {
1640
+ throw new AssertionError ("Tried to stop the only master eligible shared node" );
1641
+ }
1635
1642
logger .info ("Closing filtered random node [{}] " , nodeAndClient .name );
1636
1643
stopNodesAndClient (nodeAndClient );
1637
1644
}
You can’t perform that action at this time.
0 commit comments