From 50e91083051bc315aad61123657a39646311411e Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Fri, 23 Jan 2015 17:41:37 -0500 Subject: [PATCH] Core: do not throttle recovery indexing operations when replaying transaction log Closes #9396 Closes #9394 --- .../index/engine/internal/InternalEngine.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/elasticsearch/index/engine/internal/InternalEngine.java b/src/main/java/org/elasticsearch/index/engine/internal/InternalEngine.java index f661f5a4ca8..02860063115 100644 --- a/src/main/java/org/elasticsearch/index/engine/internal/InternalEngine.java +++ b/src/main/java/org/elasticsearch/index/engine/internal/InternalEngine.java @@ -339,8 +339,13 @@ public class InternalEngine implements Engine { final IndexWriter writer; try (InternalLock _ = readLock.acquire()) { writer = currentIndexWriter(); - try (Releasable r = throttle.acquireThrottle()) { + if (create.origin() == Operation.Origin.RECOVERY) { + // Don't throttle recovery operations innerCreate(create, writer); + } else { + try (Releasable r = throttle.acquireThrottle()) { + innerCreate(create, writer); + } } dirty = true; flushNeeded = true; @@ -351,7 +356,6 @@ public class InternalEngine implements Engine { checkVersionMapRefresh(); } - private void innerCreate(Create create, IndexWriter writer) throws IOException { if (engineConfig.isOptimizeAutoGenerateId() && create.autoGeneratedId() && !create.canHaveDuplicates()) { // We don't need to lock because this ID cannot be concurrently updated: @@ -443,8 +447,13 @@ public class InternalEngine implements Engine { final IndexWriter writer; try (InternalLock _ = readLock.acquire()) { writer = currentIndexWriter(); - try (Releasable r = throttle.acquireThrottle()) { + if (index.origin() == Operation.Origin.RECOVERY) { + // Don't throttle recovery operations innerIndex(index, writer); + } else { + try (Releasable r = throttle.acquireThrottle()) { + innerIndex(index, writer); + } } dirty = true; flushNeeded = true;