Core: do not throttle recovery indexing operations when replaying transaction log

Closes #9396

Closes #9394
This commit is contained in:
Michael McCandless 2015-01-23 17:41:37 -05:00 committed by mikemccand
parent dfc2c9f3a1
commit 50e9108305
1 changed files with 12 additions and 3 deletions

View File

@ -339,8 +339,13 @@ public class InternalEngine implements Engine {
final IndexWriter writer; final IndexWriter writer;
try (InternalLock _ = readLock.acquire()) { try (InternalLock _ = readLock.acquire()) {
writer = currentIndexWriter(); writer = currentIndexWriter();
try (Releasable r = throttle.acquireThrottle()) { if (create.origin() == Operation.Origin.RECOVERY) {
// Don't throttle recovery operations
innerCreate(create, writer); innerCreate(create, writer);
} else {
try (Releasable r = throttle.acquireThrottle()) {
innerCreate(create, writer);
}
} }
dirty = true; dirty = true;
flushNeeded = true; flushNeeded = true;
@ -351,7 +356,6 @@ public class InternalEngine implements Engine {
checkVersionMapRefresh(); checkVersionMapRefresh();
} }
private void innerCreate(Create create, IndexWriter writer) throws IOException { private void innerCreate(Create create, IndexWriter writer) throws IOException {
if (engineConfig.isOptimizeAutoGenerateId() && create.autoGeneratedId() && !create.canHaveDuplicates()) { if (engineConfig.isOptimizeAutoGenerateId() && create.autoGeneratedId() && !create.canHaveDuplicates()) {
// We don't need to lock because this ID cannot be concurrently updated: // 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; final IndexWriter writer;
try (InternalLock _ = readLock.acquire()) { try (InternalLock _ = readLock.acquire()) {
writer = currentIndexWriter(); writer = currentIndexWriter();
try (Releasable r = throttle.acquireThrottle()) { if (index.origin() == Operation.Origin.RECOVERY) {
// Don't throttle recovery operations
innerIndex(index, writer); innerIndex(index, writer);
} else {
try (Releasable r = throttle.acquireThrottle()) {
innerIndex(index, writer);
}
} }
dirty = true; dirty = true;
flushNeeded = true; flushNeeded = true;