@@ -864,6 +864,10 @@ public ClusterHealthStatus ensureGreen(TimeValue timeout, String... indices) {
864
864
return ensureColor (ClusterHealthStatus .GREEN , timeout , false , indices );
865
865
}
866
866
867
+ public ClusterHealthStatus ensureGreen (TimeValue timeout , boolean waitForNoRelocatingShards , String ... indices ) {
868
+ return ensureColor (ClusterHealthStatus .GREEN , timeout , waitForNoRelocatingShards , false , indices );
869
+ }
870
+
867
871
/**
868
872
* Ensures the cluster has a yellow state via the cluster health API.
869
873
*/
@@ -891,6 +895,16 @@ private ClusterHealthStatus ensureColor(
891
895
TimeValue timeout ,
892
896
boolean waitForNoInitializingShards ,
893
897
String ... indices
898
+ ) {
899
+ return ensureColor (clusterHealthStatus , timeout , true , waitForNoInitializingShards , indices );
900
+ }
901
+
902
+ private ClusterHealthStatus ensureColor (
903
+ ClusterHealthStatus clusterHealthStatus ,
904
+ TimeValue timeout ,
905
+ boolean waitForNoRelocatingShards ,
906
+ boolean waitForNoInitializingShards ,
907
+ String ... indices
894
908
) {
895
909
String color = clusterHealthStatus .name ().toLowerCase (Locale .ROOT );
896
910
String method = "ensure" + Strings .capitalize (color );
@@ -899,7 +913,7 @@ private ClusterHealthStatus ensureColor(
899
913
.timeout (timeout )
900
914
.waitForStatus (clusterHealthStatus )
901
915
.waitForEvents (Priority .LANGUID )
902
- .waitForNoRelocatingShards (true )
916
+ .waitForNoRelocatingShards (waitForNoRelocatingShards )
903
917
.waitForNoInitializingShards (waitForNoInitializingShards )
904
918
// We currently often use ensureGreen or ensureYellow to check whether the cluster is back in a good state after shutting down
905
919
// a node. If the node that is stopped is the cluster-manager node, another node will become cluster-manager and publish a
0 commit comments