Skip to content

Commit d6b2425

Browse files
tlrxelasticmachine
andauthored
Fix TranslogDeletionPolicy when assertions are disabled (elastic#116654) (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]>
1 parent c441ada commit d6b2425

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

server/src/main/java/org/elasticsearch/index/translog/TranslogDeletionPolicy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public final class TranslogDeletionPolicy {
2424
private final Map<Object, RuntimeException> openTranslogRef;
2525

2626
public void assertNoOpenTranslogRefs() {
27-
if (openTranslogRef.isEmpty() == false) {
27+
if (Assertions.ENABLED && openTranslogRef.isEmpty() == false) {
2828
AssertionError e = new AssertionError("not all translog generations have been released");
2929
openTranslogRef.values().forEach(e::addSuppressed);
3030
throw e;

0 commit comments

Comments
 (0)