Skip to content

Commit 659e82b

Browse files
authored
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 de8ba77 commit 659e82b

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
@@ -2011,8 +2011,13 @@ public void syncRetentionLeases() {
20112011
verifyNotClosed();
20122012
final Tuple<Boolean, RetentionLeases> retentionLeases = getRetentionLeases(true);
20132013
if (retentionLeases.v1()) {
2014-
retentionLeaseSyncer.sync(shardId, retentionLeases.v2(), ActionListener.wrap(() -> {}));
2014+
logger.trace("syncing retention leases [{}] after expiration check", retentionLeases.v2());
2015+
retentionLeaseSyncer.sync(
2016+
shardId,
2017+
retentionLeases.v2(),
2018+
ActionListener.wrap(r -> {}, e -> logger.warn("failed to sync retention leases after expiration check", e)));
20152019
} else {
2020+
logger.trace("background syncing retention leases [{}] after expiration check", retentionLeases.v2());
20162021
retentionLeaseSyncer.backgroundSync(shardId, retentionLeases.v2());
20172022
}
20182023
}

0 commit comments

Comments
 (0)