Fix possible assertion failure in IndicesQueryCache.close
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
Backport of
@@ -206,7 +206,7 @@ public class IndicesQueryCache implements QueryCache, Closeable {
}
private static class StatsAndCount {
- int count;
+ volatile int count;
final Stats stats;
StatsAndCount(Stats stats) {
