From 51d96e99241a310f6b7fc95828b00cafebe88ea9 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 5dccbab4927ad..c2eba6130c1dc 100644 --- a/src/main/java/org/elasticsearch/index/engine/internal/InternalEngine.java +++ b/src/main/java/org/elasticsearch/index/engine/internal/InternalEngine.java @@ -348,8 +348,13 @@ public void create(Create create) throws EngineException { 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; @@ -360,7 +365,6 @@ public void create(Create create) throws EngineException { 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: @@ -452,8 +456,13 @@ public void index(Index index) throws EngineException { 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;