Skip to content

Commit

Permalink
Fix TranslogDeletionPolicy when assertions are disabled (elastic#116654
Browse files Browse the repository at this point in the history
…) (elastic#116714)

Current code causes a NPE when assertions are disabled: the 
openTranslogRef is only non-null when assertions are enabled.

Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
tlrx and elasticmachine authored Nov 13, 2024
1 parent c441ada commit d6b2425
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public final class TranslogDeletionPolicy {
private final Map<Object, RuntimeException> openTranslogRef;

public void assertNoOpenTranslogRefs() {
if (openTranslogRef.isEmpty() == false) {
if (Assertions.ENABLED && openTranslogRef.isEmpty() == false) {
AssertionError e = new AssertionError("not all translog generations have been released");
openTranslogRef.values().forEach(e::addSuppressed);
throw e;
Expand Down

0 comments on commit d6b2425

Please sign in to comment.