@@ -177,7 +177,14 @@ public class RecoverySettings {
177
177
);
178
178
179
179
// choose 512KB-16B to ensure that the resulting byte[] is not a humongous allocation in G1.
180
- public static final ByteSizeValue DEFAULT_CHUNK_SIZE = new ByteSizeValue (512 * 1024 - 16 , ByteSizeUnit .BYTES );
180
+ public static final Setting <ByteSizeValue > INDICES_RECOVERY_CHUNK_SIZE_SETTING = Setting .byteSizeSetting (
181
+ "indices.recovery.chunk_size" ,
182
+ new ByteSizeValue (512 * 1024 - 16 , ByteSizeUnit .BYTES ),
183
+ new ByteSizeValue (0 , ByteSizeUnit .BYTES ),
184
+ new ByteSizeValue (100 * 1024 * 1024 , ByteSizeUnit .BYTES ),
185
+ Property .Dynamic ,
186
+ Property .NodeScope
187
+ );
181
188
182
189
private volatile ByteSizeValue recoveryMaxBytesPerSec ;
183
190
private volatile ByteSizeValue replicationMaxBytesPerSec ;
@@ -193,7 +200,7 @@ public class RecoverySettings {
193
200
private volatile TimeValue internalActionRetryTimeout ;
194
201
private volatile TimeValue internalActionLongTimeout ;
195
202
196
- private volatile ByteSizeValue chunkSize = DEFAULT_CHUNK_SIZE ;
203
+ private volatile ByteSizeValue chunkSize ;
197
204
private volatile TimeValue internalRemoteUploadTimeout ;
198
205
199
206
public RecoverySettings (Settings settings , ClusterSettings clusterSettings ) {
@@ -221,6 +228,7 @@ public RecoverySettings(Settings settings, ClusterSettings clusterSettings) {
221
228
222
229
logger .debug ("using recovery max_bytes_per_sec[{}]" , recoveryMaxBytesPerSec );
223
230
this .internalRemoteUploadTimeout = INDICES_INTERNAL_REMOTE_UPLOAD_TIMEOUT .get (settings );
231
+ this .chunkSize = INDICES_RECOVERY_CHUNK_SIZE_SETTING .get (settings );
224
232
225
233
clusterSettings .addSettingsUpdateConsumer (INDICES_RECOVERY_MAX_BYTES_PER_SEC_SETTING , this ::setRecoveryMaxBytesPerSec );
226
234
clusterSettings .addSettingsUpdateConsumer (INDICES_REPLICATION_MAX_BYTES_PER_SEC_SETTING , this ::setReplicationMaxBytesPerSec );
@@ -239,7 +247,7 @@ public RecoverySettings(Settings settings, ClusterSettings clusterSettings) {
239
247
);
240
248
clusterSettings .addSettingsUpdateConsumer (INDICES_RECOVERY_ACTIVITY_TIMEOUT_SETTING , this ::setActivityTimeout );
241
249
clusterSettings .addSettingsUpdateConsumer (INDICES_INTERNAL_REMOTE_UPLOAD_TIMEOUT , this ::setInternalRemoteUploadTimeout );
242
-
250
+ clusterSettings . addSettingsUpdateConsumer ( INDICES_RECOVERY_CHUNK_SIZE_SETTING , this :: setChunkSize );
243
251
}
244
252
245
253
public RateLimiter recoveryRateLimiter () {
@@ -282,10 +290,7 @@ public ByteSizeValue getChunkSize() {
282
290
return chunkSize ;
283
291
}
284
292
285
- public void setChunkSize (ByteSizeValue chunkSize ) { // only settable for tests
286
- if (chunkSize .bytesAsInt () <= 0 ) {
287
- throw new IllegalArgumentException ("chunkSize must be > 0" );
288
- }
293
+ public void setChunkSize (ByteSizeValue chunkSize ) {
289
294
this .chunkSize = chunkSize ;
290
295
}
291
296
0 commit comments