Skip to content

Commit

Permalink
Bugfix: remove assert on non-empty translog reader list (#9458) (#9472)
Browse files Browse the repository at this point in the history
(cherry picked from commit 48d4087)
Signed-off-by: Sachin Kale <kalsac@amazon.com>
  • Loading branch information
opensearch-trigger-bot[bot] authored Aug 22, 2023
1 parent 98c5d3b commit 2ef3e4d
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,11 @@ private void deleteStaleRemotePrimaryTerms() {
// are older files that are no longer needed and should be cleaned up. In here, we delete all files that are part
// of older primary term.
if (olderPrimaryCleaned.trySet(Boolean.TRUE)) {
if (readers.isEmpty()) {
logger.trace("Translog reader list is empty, returning from deleteStaleRemotePrimaryTerms");
return;
}
// First we delete all stale primary terms folders from remote store
assert readers.isEmpty() == false : shardId + " Expected non-empty readers";
long minimumReferencedPrimaryTerm = readers.stream().map(BaseTranslogReader::getPrimaryTerm).min(Long::compare).get();
translogTransferManager.deletePrimaryTermsAsync(minimumReferencedPrimaryTerm);
}
Expand Down

0 comments on commit 2ef3e4d

Please sign in to comment.