Fix possible assertion failure in IndicesQueryCache.close (#38731)

The assertion that the stats2 map is empty in
IndicesQueryCache.close has been observed to
fail very occasionally in internal cluster tests.

The likely cause is a cross-thread visibility
problem for a count variable.  This change
makes that count volatile.

Relates #37117
Backport of #38714
This commit is contained in:
David Roberts 2019-02-11 17:33:20 +00:00 committed by GitHub
parent dc212de822
commit d1848b96fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -206,7 +206,7 @@ public class IndicesQueryCache implements QueryCache, Closeable {
} }
private static class StatsAndCount { private static class StatsAndCount {
int count; volatile int count;
final Stats stats; final Stats stats;
StatsAndCount(Stats stats) { StatsAndCount(Stats stats) {