Skip to content

Commit

Permalink
Core: do not throttle recovery indexing operations when replaying tra…
Browse files Browse the repository at this point in the history
…nsaction log

Closes #9396

Closes #9394
  • Loading branch information
mikemccand committed Jan 23, 2015
1 parent 725514f commit c549329
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,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;
possibleMergeNeeded = true;
Expand All @@ -413,7 +418,6 @@ public void create(Create create) throws EngineException {
checkVersionMapRefresh();
}


private void innerCreate(Create create, IndexWriter writer) throws IOException {
if (optimizeAutoGenerateId && create.autoGeneratedId() && !create.canHaveDuplicates()) {
// We don't need to lock because this ID cannot be concurrently updated:
Expand Down Expand Up @@ -505,8 +509,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;
possibleMergeNeeded = true;
Expand Down

0 comments on commit c549329

Please sign in to comment.