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 ddafd55 commit 51d96e9
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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:
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 51d96e9

Please sign in to comment.