fix refresh logic after the change to not do it under write lock
This commit is contained in:
parent
23fad52498
commit
ed8d6bbcd3
|
@ -581,7 +581,7 @@ public class RobinEngine extends AbstractIndexShardComponent implements Engine {
|
|||
|
||||
@Override public Searcher searcher() throws EngineException {
|
||||
AcquirableResource<ReaderSearcherHolder> holder;
|
||||
for (; ;) {
|
||||
for (; ; ) {
|
||||
holder = this.nrtResource;
|
||||
if (holder.acquire()) {
|
||||
break;
|
||||
|
@ -709,8 +709,8 @@ public class RobinEngine extends AbstractIndexShardComponent implements Engine {
|
|||
// we need to refresh in order to clear older version values
|
||||
long time = threadPool.estimatedTimeInMillis(); // mark time here, before we refresh, and then delete all older values
|
||||
refresh(new Refresh(true).force(true));
|
||||
if (indexingSearcher.get() != null) {
|
||||
indexingSearcher.get().release();
|
||||
Searcher searcher = indexingSearcher.get();
|
||||
if (searcher != null) {
|
||||
indexingSearcher.set(null);
|
||||
}
|
||||
for (Map.Entry<String, VersionValue> entry : versionMap.entrySet()) {
|
||||
|
@ -732,6 +732,9 @@ public class RobinEngine extends AbstractIndexShardComponent implements Engine {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (searcher != null) {
|
||||
searcher.release();
|
||||
}
|
||||
} finally {
|
||||
flushing.set(false);
|
||||
}
|
||||
|
|
|
@ -496,15 +496,14 @@ public class InternalIndexShard extends AbstractIndexShardComponent implements I
|
|||
if (withFlush) {
|
||||
engine.flush(new Engine.Flush());
|
||||
}
|
||||
// clear unreferenced files
|
||||
translog.clearUnreferenced();
|
||||
engine.refresh(new Engine.Refresh(true));
|
||||
synchronized (mutex) {
|
||||
logger.debug("state: [{}]->[{}], reason [post recovery]", state, IndexShardState.STARTED);
|
||||
state = IndexShardState.STARTED;
|
||||
}
|
||||
startScheduledTasksIfNeeded();
|
||||
engine.refresh(new Engine.Refresh(true));
|
||||
|
||||
// clear unreferenced files
|
||||
translog.clearUnreferenced();
|
||||
indicesLifecycle.afterIndexShardStarted(this);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue