Skip to content

Don't mark shard as refreshPending on stats fetching #40458

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -947,9 +947,7 @@ public FlushStats flushStats() {

public DocsStats docStats() {
readAllowed();
DocsStats docsStats = getEngine().docStats();
markSearcherAccessed();
return docsStats;
return getEngine().docStats();
}

/**
Expand Down Expand Up @@ -1028,11 +1026,7 @@ public TranslogStats translogStats() {
public CompletionStats completionStats(String... fields) {
readAllowed();
try {
CompletionStats stats = getEngine().completionStats(fields);
// we don't wait for a pending refreshes here since it's a stats call instead we mark it as accessed only which will cause
// the next scheduled refresh to go through and refresh the stats as well
markSearcherAccessed();
return stats;
return getEngine().completionStats(fields);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2763,7 +2763,7 @@ public void testCompletionStatsMarksSearcherAccessed() throws Exception {
});
long prevAccessTime = shard.getLastSearcherAccess();
indexShard.completionStats();
assertThat("searcher was not marked as accessed", shard.getLastSearcherAccess(), greaterThan(prevAccessTime));
assertThat("searcher was marked as accessed", shard.getLastSearcherAccess(), equalTo(prevAccessTime));
} finally {
closeShards(indexShard);
}
Expand Down Expand Up @@ -2793,7 +2793,7 @@ public void testDocStats() throws Exception {
});
long prevAccessTime = shard.getLastSearcherAccess();
final DocsStats docsStats = indexShard.docStats();
assertThat("searcher was not marked as accessed", shard.getLastSearcherAccess(), greaterThan(prevAccessTime));
assertThat("searcher was marked as accessed", shard.getLastSearcherAccess(), equalTo(prevAccessTime));
assertThat(docsStats.getCount(), equalTo(numDocs));
try (Engine.Searcher searcher = indexShard.acquireSearcher("test")) {
assertTrue(searcher.reader().numDocs() <= docsStats.getCount());
Expand Down