Skip to content

Commit a68ff32

Browse files
DaveCTurnerdnhatn
authored andcommitted
Default to zero translog retention
Now that elastic#45136 means we perform recoveries from the index rather than the translog (if soft deletes are enabled) there is no need to retain extra translog for performing peer recoveries. This commit reduces the default translog retention to zero so that it can be discarded more quickly.
1 parent 009020f commit a68ff32

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

server/src/main/java/org/elasticsearch/index/IndexSettings.java

+17-18
Original file line numberDiff line numberDiff line change
@@ -195,24 +195,6 @@ public final class IndexSettings {
195195
new ByteSizeValue(Long.MAX_VALUE, ByteSizeUnit.BYTES),
196196
Property.Dynamic, Property.IndexScope);
197197

198-
/**
199-
* Controls how long translog files that are no longer needed for persistence reasons
200-
* will be kept around before being deleted. A longer retention policy is useful to increase
201-
* the chance of ops based recoveries.
202-
**/
203-
public static final Setting<TimeValue> INDEX_TRANSLOG_RETENTION_AGE_SETTING =
204-
Setting.timeSetting("index.translog.retention.age", TimeValue.timeValueHours(12), TimeValue.timeValueMillis(-1),
205-
Property.Dynamic, Property.IndexScope);
206-
207-
/**
208-
* Controls how many translog files that are no longer needed for persistence reasons
209-
* will be kept around before being deleted. Keeping more files is useful to increase
210-
* the chance of ops based recoveries.
211-
**/
212-
public static final Setting<ByteSizeValue> INDEX_TRANSLOG_RETENTION_SIZE_SETTING =
213-
Setting.byteSizeSetting("index.translog.retention.size", new ByteSizeValue(512, ByteSizeUnit.MB), Property.Dynamic,
214-
Property.IndexScope);
215-
216198
/**
217199
* The maximum size of a translog generation. This is independent of the maximum size of
218200
* translog operations that have not been flushed.
@@ -258,6 +240,23 @@ public final class IndexSettings {
258240
Setting.longSetting("index.soft_deletes.retention.operations", 0, 0,
259241
Property.IndexScope, Property.Dynamic);
260242

243+
/**
244+
* Controls how long translog files that are no longer needed for persistence reasons
245+
* will be kept around before being deleted.
246+
**/
247+
public static final Setting<TimeValue> INDEX_TRANSLOG_RETENTION_AGE_SETTING =
248+
Setting.timeSetting("index.translog.retention.age",
249+
settings -> INDEX_SOFT_DELETES_SETTING.get(settings) ? TimeValue.ZERO : TimeValue.timeValueHours(12), TimeValue.MINUS_ONE,
250+
Property.Dynamic, Property.IndexScope);
251+
252+
/**
253+
* Controls how many translog files that are no longer needed for persistence reasons
254+
* will be kept around before being deleted.
255+
**/
256+
public static final Setting<ByteSizeValue> INDEX_TRANSLOG_RETENTION_SIZE_SETTING =
257+
Setting.byteSizeSetting("index.translog.retention.size", settings -> INDEX_SOFT_DELETES_SETTING.get(settings) ? "0b" : "512mb",
258+
Property.Dynamic, Property.IndexScope);
259+
261260
/**
262261
* Controls the maximum length of time since a retention lease is created or renewed before it is considered expired.
263262
*/

0 commit comments

Comments
 (0)