Core: don't block shard stats when phase 3 of recovery is running
Today, shard stats are blocked while phase 3 of recovery (replay xlog) is running; this change removes the engine readLock from shard stats so it's not blocked. Closes #8910
This commit is contained in:
parent
bb6e539bc7
commit
c9d63d3482
|
@ -332,7 +332,7 @@ public class InternalEngine implements Engine {
|
|||
|
||||
@Override
|
||||
public TimeValue defaultRefreshInterval() {
|
||||
return InternalEngineHolder.DEFAULT_REFRESH_ITERVAL;
|
||||
return InternalEngineHolder.DEFAULT_REFRESH_INTERVAL;
|
||||
}
|
||||
|
||||
/** return the current indexing buffer size setting * */
|
||||
|
@ -1231,9 +1231,12 @@ public class InternalEngine implements Engine {
|
|||
|
||||
@Override
|
||||
public SegmentsStats segmentsStats() {
|
||||
try (InternalLock _ = readLock.acquire()) {
|
||||
ensureOpen();
|
||||
try (final Searcher searcher = acquireSearcher("segments_stats")) {
|
||||
|
||||
// Does ensureOpen for us:
|
||||
final IndexWriter indexWriter = currentIndexWriter();
|
||||
assert indexWriter != null;
|
||||
|
||||
try (final Searcher searcher = acquireSearcher("segments_stats")) {
|
||||
SegmentsStats stats = new SegmentsStats();
|
||||
for (LeafReaderContext reader : searcher.reader().leaves()) {
|
||||
final SegmentReader segmentReader = segmentReader(reader.reader());
|
||||
|
@ -1248,7 +1251,6 @@ public class InternalEngine implements Engine {
|
|||
stats.addIndexWriterMemoryInBytes(indexWriter.ramBytesUsed());
|
||||
stats.addIndexWriterMaxMemoryInBytes((long) (indexWriter.getConfig().getRAMBufferSizeMB() * 1024 * 1024));
|
||||
return stats;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ public class InternalEngineHolder extends AbstractIndexShardComponent implements
|
|||
public static final String INDEX_FAIL_ON_MERGE_FAILURE = "index.fail_on_merge_failure";
|
||||
public static final String INDEX_FAIL_ON_CORRUPTION = "index.fail_on_corruption";
|
||||
|
||||
public static final TimeValue DEFAULT_REFRESH_ITERVAL = new TimeValue(1, TimeUnit.SECONDS);
|
||||
public static final TimeValue DEFAULT_REFRESH_INTERVAL = new TimeValue(1, TimeUnit.SECONDS);
|
||||
|
||||
private final CopyOnWriteArrayList<FailedEngineListener> failedEngineListeners = new CopyOnWriteArrayList<>();
|
||||
|
||||
|
@ -150,7 +150,7 @@ public class InternalEngineHolder extends AbstractIndexShardComponent implements
|
|||
|
||||
@Override
|
||||
public TimeValue defaultRefreshInterval() {
|
||||
return DEFAULT_REFRESH_ITERVAL;
|
||||
return DEFAULT_REFRESH_INTERVAL;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue