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,9 +339,14 @@ public class InternalEngine implements Engine {
final IndexWriter writer;
try (InternalLock _ = readLock.acquire()) {
writer = currentIndexWriter();
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;
} catch (OutOfMemoryError | IllegalStateException | IOException t) {
@ -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,9 +447,14 @@ public class InternalEngine implements Engine {
final IndexWriter writer;
try (InternalLock _ = readLock.acquire()) {
writer = currentIndexWriter();
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;
} catch (OutOfMemoryError | IllegalStateException | IOException t) {