magibney commented on a change in pull request #592: URL: https://github.com/apache/solr/pull/592#discussion_r808455051
########## File path: solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java ########## @@ -854,20 +880,92 @@ private DocSet getAndCacheDocSet(Query query) throws IOException { return filterCache.computeIfAbsent(query, q -> getDocSetNC(q, null)); } - private static Query matchAllDocsQuery = new MatchAllDocsQuery(); - private volatile BitDocSet liveDocs; + private static final MatchAllDocsQuery MATCH_ALL_DOCS_QUERY = new MatchAllDocsQuery(); + + /** + * A naively cached canonical `liveDocs` DocSet. This does not need to be volatile. It may be set multiple times, + * but should always be set to the same value, as all set values should pass through `liveDocsCache.computeIfAbsent` + */ + private BitDocSet liveDocs; + private final IOFunction<MatchAllDocsQuery, BitDocSet> computeLiveDocs = this::computeLiveDocs; + + private static final BitDocSet EMPTY = new BitDocSet(new FixedBitSet(0), 0); + + private BitDocSet computeLiveDocs(Query q) { + assert q == MATCH_ALL_DOCS_QUERY; Review comment: obviated by simplifications related to 14f7ac5434626e5d3a068b8c2489b0d604171daa -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For additional commands, e-mail: issues-h...@solr.apache.org