From ce32b959fdcdaf5f3a78df9bf2d8039082735940 Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Tue, 12 Jan 2016 14:40:47 -0500 Subject: [PATCH] fix possible concurrency bug in IMC when indexing threads are faster in writing bytes than the status checker is in checking all shards --- .../org/elasticsearch/indices/IndexingMemoryController.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/src/main/java/org/elasticsearch/indices/IndexingMemoryController.java b/core/src/main/java/org/elasticsearch/indices/IndexingMemoryController.java index 35bf4d3b62c..e4f5416ef53 100644 --- a/core/src/main/java/org/elasticsearch/indices/IndexingMemoryController.java +++ b/core/src/main/java/org/elasticsearch/indices/IndexingMemoryController.java @@ -256,6 +256,8 @@ public class IndexingMemoryController extends AbstractComponent implements Index } finally { runLock.unlock(); } + // Could be while we were checking, more bytes arrived: + totalBytes = bytesWrittenSinceCheck.addAndGet(bytes); } else { break; }