@@ -49,6 +49,14 @@ public final class CcrSettings {
49
49
Setting .byteSizeSetting ("ccr.indices.recovery.max_bytes_per_sec" , new ByteSizeValue (40 , ByteSizeUnit .MB ),
50
50
Setting .Property .Dynamic , Setting .Property .NodeScope );
51
51
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
+
52
60
/**
53
61
* The leader must open resources for a ccr recovery. If there is no activity for this interval of time,
54
62
* the leader will close the restore session.
@@ -77,22 +85,30 @@ static List<Setting<?>> getSettings() {
77
85
INDICES_RECOVERY_ACTION_TIMEOUT_SETTING ,
78
86
INDICES_RECOVERY_ACTIVITY_TIMEOUT_SETTING ,
79
87
CCR_AUTO_FOLLOW_WAIT_FOR_METADATA_TIMEOUT ,
88
+ RECOVERY_CHUNK_SIZE ,
80
89
CCR_WAIT_FOR_METADATA_TIMEOUT );
81
90
}
82
91
83
92
private final CombinedRateLimiter ccrRateLimiter ;
84
93
private volatile TimeValue recoveryActivityTimeout ;
85
94
private volatile TimeValue recoveryActionTimeout ;
95
+ private volatile ByteSizeValue chunkSize ;
86
96
87
97
public CcrSettings (Settings settings , ClusterSettings clusterSettings ) {
88
98
this .recoveryActivityTimeout = INDICES_RECOVERY_ACTIVITY_TIMEOUT_SETTING .get (settings );
89
99
this .recoveryActionTimeout = INDICES_RECOVERY_ACTION_TIMEOUT_SETTING .get (settings );
90
100
this .ccrRateLimiter = new CombinedRateLimiter (RECOVERY_MAX_BYTES_PER_SECOND .get (settings ));
101
+ this .chunkSize = RECOVERY_MAX_BYTES_PER_SECOND .get (settings );
91
102
clusterSettings .addSettingsUpdateConsumer (RECOVERY_MAX_BYTES_PER_SECOND , this ::setMaxBytesPerSec );
103
+ clusterSettings .addSettingsUpdateConsumer (RECOVERY_CHUNK_SIZE , this ::setChunkSize );
92
104
clusterSettings .addSettingsUpdateConsumer (INDICES_RECOVERY_ACTIVITY_TIMEOUT_SETTING , this ::setRecoveryActivityTimeout );
93
105
clusterSettings .addSettingsUpdateConsumer (INDICES_RECOVERY_ACTION_TIMEOUT_SETTING , this ::setRecoveryActionTimeout );
94
106
}
95
107
108
+ private void setChunkSize (ByteSizeValue chunkSize ) {
109
+ this .chunkSize = chunkSize ;
110
+ }
111
+
96
112
private void setMaxBytesPerSec (ByteSizeValue maxBytesPerSec ) {
97
113
ccrRateLimiter .setMBPerSec (maxBytesPerSec );
98
114
}
@@ -105,6 +121,10 @@ private void setRecoveryActionTimeout(TimeValue recoveryActionTimeout) {
105
121
this .recoveryActionTimeout = recoveryActionTimeout ;
106
122
}
107
123
124
+ public ByteSizeValue getChunkSize () {
125
+ return chunkSize ;
126
+ }
127
+
108
128
public CombinedRateLimiter getRateLimiter () {
109
129
return ccrRateLimiter ;
110
130
}
0 commit comments