Skip to content

Commit

Permalink
Bugfix: remove assert on non-empty translog reader list (opensearch-p…
Browse files Browse the repository at this point in the history
…roject#9458)

---------

Signed-off-by: Sachin Kale <[email protected]>
Co-authored-by: Sachin Kale <[email protected]>
  • Loading branch information
sachinpkale and Sachin Kale authored Aug 22, 2023
1 parent 61c5f17 commit 48d4087
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 48d4087

Please sign in to comment.