Skip to content

Commit 3ef1721

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 ceb8ef7 commit 3ef1721

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2047,8 +2047,13 @@ public void syncRetentionLeases() {
20472047
verifyNotClosed();
20482048
final Tuple<Boolean, RetentionLeases> retentionLeases = getRetentionLeases(true);
20492049
if (retentionLeases.v1()) {
2050-
retentionLeaseSyncer.sync(shardId, retentionLeases.v2(), ActionListener.wrap(() -> {}));
2050+
logger.trace("syncing retention leases [{}] after expiration check", retentionLeases.v2());
2051+
retentionLeaseSyncer.sync(
2052+
shardId,
2053+
retentionLeases.v2(),
2054+
ActionListener.wrap(r -> {}, e -> logger.warn("failed to sync retention leases after expiration check", e)));
20512055
} else {
2056+
logger.trace("background syncing retention leases [{}] after expiration check", retentionLeases.v2());
20522057
retentionLeaseSyncer.backgroundSync(shardId, retentionLeases.v2());
20532058
}
20542059
}

0 commit comments

Comments
 (0)