Skip to content

Commit e3004e4

Browse files
committed
Add some logging related to retention lease syncing (#39066)
When the background retention lease sync fires, we check an see if any retention leases are expired. If any did expire, we execute a full retention lease sync (write action). Since this is happening on a background thread, we do not block that thread waiting for success (it will simply try again when the timer elapses). However, we were swallowing exceptions that indicate failure. This commit addresses that by logging the failures. Additionally, we add some trace logging to the execution of syncing retention leases.
1 parent 987ddcb commit e3004e4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

server/src/main/java/org/elasticsearch/index/shard/IndexShard.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -2010,8 +2010,13 @@ public void syncRetentionLeases() {
20102010
verifyNotClosed();
20112011
final Tuple<Boolean, RetentionLeases> retentionLeases = getRetentionLeases(true);
20122012
if (retentionLeases.v1()) {
2013-
retentionLeaseSyncer.sync(shardId, retentionLeases.v2(), ActionListener.wrap(() -> {}));
2013+
logger.trace("syncing retention leases [{}] after expiration check", retentionLeases.v2());
2014+
retentionLeaseSyncer.sync(
2015+
shardId,
2016+
retentionLeases.v2(),
2017+
ActionListener.wrap(r -> {}, e -> logger.warn("failed to sync retention leases after expiration check", e)));
20142018
} else {
2019+
logger.trace("background syncing retention leases [{}] after expiration check", retentionLeases.v2());
20152020
retentionLeaseSyncer.backgroundSync(shardId, retentionLeases.v2());
20162021
}
20172022
}

0 commit comments

Comments
 (0)