@@ -49,6 +49,14 @@ public final class CcrSettings {
4949 Setting .byteSizeSetting ("ccr.indices.recovery.max_bytes_per_sec" , new ByteSizeValue (40 , ByteSizeUnit .MB ),
5050 Setting .Property .Dynamic , Setting .Property .NodeScope );
5151
52+ /**
53+ * File chunk size to send during recovery
54+ */
55+ public static final Setting <ByteSizeValue > RECOVERY_CHUNK_SIZE =
56+ Setting .byteSizeSetting ("ccr.indices.recovery.chunk_size" , new ByteSizeValue (1 , ByteSizeUnit .MB ),
57+ new ByteSizeValue (1 , ByteSizeUnit .KB ), new ByteSizeValue (1 , ByteSizeUnit .GB ), Setting .Property .Dynamic ,
58+ Setting .Property .NodeScope );
59+
5260 /**
5361 * The leader must open resources for a ccr recovery. If there is no activity for this interval of time,
5462 * the leader will close the restore session.
@@ -77,22 +85,30 @@ static List<Setting<?>> getSettings() {
7785 INDICES_RECOVERY_ACTION_TIMEOUT_SETTING ,
7886 INDICES_RECOVERY_ACTIVITY_TIMEOUT_SETTING ,
7987 CCR_AUTO_FOLLOW_WAIT_FOR_METADATA_TIMEOUT ,
88+ RECOVERY_CHUNK_SIZE ,
8089 CCR_WAIT_FOR_METADATA_TIMEOUT );
8190 }
8291
8392 private final CombinedRateLimiter ccrRateLimiter ;
8493 private volatile TimeValue recoveryActivityTimeout ;
8594 private volatile TimeValue recoveryActionTimeout ;
95+ private volatile ByteSizeValue chunkSize ;
8696
8797 public CcrSettings (Settings settings , ClusterSettings clusterSettings ) {
8898 this .recoveryActivityTimeout = INDICES_RECOVERY_ACTIVITY_TIMEOUT_SETTING .get (settings );
8999 this .recoveryActionTimeout = INDICES_RECOVERY_ACTION_TIMEOUT_SETTING .get (settings );
90100 this .ccrRateLimiter = new CombinedRateLimiter (RECOVERY_MAX_BYTES_PER_SECOND .get (settings ));
101+ this .chunkSize = RECOVERY_MAX_BYTES_PER_SECOND .get (settings );
91102 clusterSettings .addSettingsUpdateConsumer (RECOVERY_MAX_BYTES_PER_SECOND , this ::setMaxBytesPerSec );
103+ clusterSettings .addSettingsUpdateConsumer (RECOVERY_CHUNK_SIZE , this ::setChunkSize );
92104 clusterSettings .addSettingsUpdateConsumer (INDICES_RECOVERY_ACTIVITY_TIMEOUT_SETTING , this ::setRecoveryActivityTimeout );
93105 clusterSettings .addSettingsUpdateConsumer (INDICES_RECOVERY_ACTION_TIMEOUT_SETTING , this ::setRecoveryActionTimeout );
94106 }
95107
108+ private void setChunkSize (ByteSizeValue chunkSize ) {
109+ this .chunkSize = chunkSize ;
110+ }
111+
96112 private void setMaxBytesPerSec (ByteSizeValue maxBytesPerSec ) {
97113 ccrRateLimiter .setMBPerSec (maxBytesPerSec );
98114 }
@@ -105,6 +121,10 @@ private void setRecoveryActionTimeout(TimeValue recoveryActionTimeout) {
105121 this .recoveryActionTimeout = recoveryActionTimeout ;
106122 }
107123
124+ public ByteSizeValue getChunkSize () {
125+ return chunkSize ;
126+ }
127+
108128 public CombinedRateLimiter getRateLimiter () {
109129 return ccrRateLimiter ;
110130 }
0 commit comments