Skip to content

Commit aa84a39

Browse files
committed
Fix NPE in IndexShard flushStats
Note we cannot use withEngineOrNull because the method can block and cannot be called from cluster state update threads. Fixes #124164
1 parent 71434e6 commit aa84a39

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

server/src/main/java/org/elasticsearch/index/shard/IndexShard.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1366,11 +1366,12 @@ public RefreshStats refreshStats() {
13661366
}
13671367

13681368
public FlushStats flushStats() {
1369+
final Engine engine = getEngineOrNull();
13691370
return new FlushStats(
13701371
flushMetric.count(),
13711372
periodicFlushMetric.count(),
13721373
TimeUnit.NANOSECONDS.toMillis(flushMetric.sum()),
1373-
getEngineOrNull() != null ? getEngineOrNull().getTotalFlushTimeExcludingWaitingOnLockInMillis() : 0L
1374+
engine != null ? engine.getTotalFlushTimeExcludingWaitingOnLockInMillis() : 0L
13741375
);
13751376
}
13761377

0 commit comments

Comments
 (0)