29
29
import org .elasticsearch .common .settings .Setting ;
30
30
import org .elasticsearch .common .settings .Settings ;
31
31
import org .elasticsearch .common .unit .ByteSizeUnit ;
32
+ import org .elasticsearch .common .unit .TimeValue ;
32
33
import org .elasticsearch .indices .recovery .RecoverySettings ;
33
34
import org .elasticsearch .test .ESIntegTestCase ;
34
35
import org .junit .After ;
35
36
36
37
import java .util .Arrays ;
37
38
38
- import static org .elasticsearch .cluster .routing .allocation .decider . ThrottlingAllocationDecider . CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_RECOVERIES_SETTING ;
39
+ import static org .elasticsearch .cluster .routing .allocation .DiskThresholdSettings . CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL_SETTING ;
39
40
import static org .elasticsearch .cluster .routing .allocation .decider .ThrottlingAllocationDecider .CLUSTER_ROUTING_ALLOCATION_NODE_INITIAL_PRIMARIES_RECOVERIES_SETTING ;
40
41
import static org .elasticsearch .test .hamcrest .ElasticsearchAssertions .assertAcked ;
41
42
import static org .elasticsearch .test .hamcrest .ElasticsearchAssertions .assertBlocked ;
@@ -69,35 +70,35 @@ public void testClusterNonExistingSettingsUpdate() {
69
70
70
71
public void testDeleteIsAppliedFirst () {
71
72
final Setting <Integer > INITIAL_RECOVERIES = CLUSTER_ROUTING_ALLOCATION_NODE_INITIAL_PRIMARIES_RECOVERIES_SETTING ;
72
- final Setting <Integer > CONCURRENT_RECOVERIES = CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_RECOVERIES_SETTING ;
73
+ final Setting <TimeValue > REROUTE_INTERVAL = CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL_SETTING ;
73
74
74
75
ClusterUpdateSettingsResponse response = client ().admin ().cluster ()
75
76
.prepareUpdateSettings ()
76
77
.setTransientSettings (Settings .builder ()
77
78
.put (INITIAL_RECOVERIES .getKey (), 7 )
78
- .put (CONCURRENT_RECOVERIES .getKey (), 42 ).build ())
79
+ .put (REROUTE_INTERVAL .getKey (), "42s" ).build ())
79
80
.get ();
80
81
81
82
assertAcked (response );
82
83
assertThat (INITIAL_RECOVERIES .get (response .getTransientSettings ()), equalTo (7 ));
83
84
assertThat (clusterService ().getClusterSettings ().get (INITIAL_RECOVERIES ), equalTo (7 ));
84
- assertThat (CONCURRENT_RECOVERIES .get (response .getTransientSettings ()), equalTo (42 ));
85
- assertThat (clusterService ().getClusterSettings ().get (CONCURRENT_RECOVERIES ), equalTo (42 ));
85
+ assertThat (REROUTE_INTERVAL .get (response .getTransientSettings ()), equalTo (TimeValue . timeValueSeconds ( 42 ) ));
86
+ assertThat (clusterService ().getClusterSettings ().get (REROUTE_INTERVAL ), equalTo (TimeValue . timeValueSeconds ( 42 ) ));
86
87
87
88
response = client ().admin ().cluster ()
88
89
.prepareUpdateSettings ()
89
90
.setTransientSettings (Settings .builder ().putNull ((randomBoolean () ? "cluster.routing.*" : "*" ))
90
- .put (CONCURRENT_RECOVERIES .getKey (), 43 ))
91
+ .put (REROUTE_INTERVAL .getKey (), "43s" ))
91
92
.get ();
92
93
assertThat (INITIAL_RECOVERIES .get (response .getTransientSettings ()), equalTo (INITIAL_RECOVERIES .get (Settings .EMPTY )));
93
94
assertThat (clusterService ().getClusterSettings ().get (INITIAL_RECOVERIES ), equalTo (INITIAL_RECOVERIES .get (Settings .EMPTY )));
94
- assertThat (CONCURRENT_RECOVERIES .get (response .getTransientSettings ()), equalTo (43 ));
95
- assertThat (clusterService ().getClusterSettings ().get (CONCURRENT_RECOVERIES ), equalTo (43 ));
95
+ assertThat (REROUTE_INTERVAL .get (response .getTransientSettings ()), equalTo (TimeValue . timeValueSeconds ( 43 ) ));
96
+ assertThat (clusterService ().getClusterSettings ().get (REROUTE_INTERVAL ), equalTo (TimeValue . timeValueSeconds ( 43 ) ));
96
97
}
97
98
98
99
public void testResetClusterSetting () {
99
100
final Setting <Integer > INITIAL_RECOVERIES = CLUSTER_ROUTING_ALLOCATION_NODE_INITIAL_PRIMARIES_RECOVERIES_SETTING ;
100
- final Setting <Integer > CONCURRENT_RECOVIERS = CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_RECOVERIES_SETTING ;
101
+ final Setting <TimeValue > REROUTE_INTERVAL = CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL_SETTING ;
101
102
102
103
ClusterUpdateSettingsResponse response = client ().admin ().cluster ()
103
104
.prepareUpdateSettings ()
@@ -122,23 +123,23 @@ public void testResetClusterSetting() {
122
123
.prepareUpdateSettings ()
123
124
.setTransientSettings (Settings .builder ()
124
125
.put (INITIAL_RECOVERIES .getKey (), 8 )
125
- .put (CONCURRENT_RECOVIERS .getKey (), 43 ).build ())
126
+ .put (REROUTE_INTERVAL .getKey (), "43s" ).build ())
126
127
.get ();
127
128
128
129
assertAcked (response );
129
130
assertThat (INITIAL_RECOVERIES .get (response .getTransientSettings ()), equalTo (8 ));
130
131
assertThat (clusterService ().getClusterSettings ().get (INITIAL_RECOVERIES ), equalTo (8 ));
131
- assertThat (CONCURRENT_RECOVIERS .get (response .getTransientSettings ()), equalTo (43 ));
132
- assertThat (clusterService ().getClusterSettings ().get (CONCURRENT_RECOVIERS ), equalTo (43 ));
132
+ assertThat (REROUTE_INTERVAL .get (response .getTransientSettings ()), equalTo (TimeValue . timeValueSeconds ( 43 ) ));
133
+ assertThat (clusterService ().getClusterSettings ().get (REROUTE_INTERVAL ), equalTo (TimeValue . timeValueSeconds ( 43 ) ));
133
134
response = client ().admin ().cluster ()
134
135
.prepareUpdateSettings ()
135
136
.setTransientSettings (Settings .builder ().putNull ((randomBoolean () ? "cluster.routing.*" : "*" )))
136
137
.get ();
137
138
138
139
assertThat (INITIAL_RECOVERIES .get (response .getTransientSettings ()), equalTo (INITIAL_RECOVERIES .get (Settings .EMPTY )));
139
140
assertThat (clusterService ().getClusterSettings ().get (INITIAL_RECOVERIES ), equalTo (INITIAL_RECOVERIES .get (Settings .EMPTY )));
140
- assertThat (CONCURRENT_RECOVIERS .get (response .getTransientSettings ()), equalTo (CONCURRENT_RECOVIERS .get (Settings .EMPTY )));
141
- assertThat (clusterService ().getClusterSettings ().get (CONCURRENT_RECOVIERS ), equalTo (CONCURRENT_RECOVIERS .get (Settings .EMPTY )));
141
+ assertThat (REROUTE_INTERVAL .get (response .getTransientSettings ()), equalTo (REROUTE_INTERVAL .get (Settings .EMPTY )));
142
+ assertThat (clusterService ().getClusterSettings ().get (REROUTE_INTERVAL ), equalTo (REROUTE_INTERVAL .get (Settings .EMPTY )));
142
143
143
144
// now persistent
144
145
response = client ().admin ().cluster ()
@@ -163,23 +164,23 @@ public void testResetClusterSetting() {
163
164
.prepareUpdateSettings ()
164
165
.setPersistentSettings (Settings .builder ()
165
166
.put (INITIAL_RECOVERIES .getKey (), 10 )
166
- .put (CONCURRENT_RECOVIERS .getKey (), 44 ).build ())
167
+ .put (REROUTE_INTERVAL .getKey (), "44s" ).build ())
167
168
.get ();
168
169
169
170
assertAcked (response );
170
171
assertThat (INITIAL_RECOVERIES .get (response .getPersistentSettings ()), equalTo (10 ));
171
172
assertThat (clusterService ().getClusterSettings ().get (INITIAL_RECOVERIES ), equalTo (10 ));
172
- assertThat (CONCURRENT_RECOVIERS .get (response .getPersistentSettings ()), equalTo (44 ));
173
- assertThat (clusterService ().getClusterSettings ().get (CONCURRENT_RECOVIERS ), equalTo (44 ));
173
+ assertThat (REROUTE_INTERVAL .get (response .getPersistentSettings ()), equalTo (TimeValue . timeValueSeconds ( 44 ) ));
174
+ assertThat (clusterService ().getClusterSettings ().get (REROUTE_INTERVAL ), equalTo (TimeValue . timeValueSeconds ( 44 ) ));
174
175
response = client ().admin ().cluster ()
175
176
.prepareUpdateSettings ()
176
177
.setPersistentSettings (Settings .builder ().putNull ((randomBoolean () ? "cluster.routing.*" : "*" )))
177
178
.get ();
178
179
179
180
assertThat (INITIAL_RECOVERIES .get (response .getPersistentSettings ()), equalTo (INITIAL_RECOVERIES .get (Settings .EMPTY )));
180
181
assertThat (clusterService ().getClusterSettings ().get (INITIAL_RECOVERIES ), equalTo (INITIAL_RECOVERIES .get (Settings .EMPTY )));
181
- assertThat (CONCURRENT_RECOVIERS .get (response .getPersistentSettings ()), equalTo (CONCURRENT_RECOVIERS .get (Settings .EMPTY )));
182
- assertThat (clusterService ().getClusterSettings ().get (CONCURRENT_RECOVIERS ), equalTo (CONCURRENT_RECOVIERS .get (Settings .EMPTY )));
182
+ assertThat (REROUTE_INTERVAL .get (response .getPersistentSettings ()), equalTo (REROUTE_INTERVAL .get (Settings .EMPTY )));
183
+ assertThat (clusterService ().getClusterSettings ().get (REROUTE_INTERVAL ), equalTo (REROUTE_INTERVAL .get (Settings .EMPTY )));
183
184
}
184
185
185
186
public void testClusterSettingsUpdateResponse () {
0 commit comments