Skip to content

Commit bf67e23

Browse files
authored
Fix TranslogDeletionPolicy when assertions are disabled (#116654)
Current code causes a NPE when assertions are disabled: the openTranslogRef is only non-null when assertions are enabled.
1 parent 5b68786 commit bf67e23

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)