You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by yo...@apache.org on 2017/02/03 02:49:41 UTC

lucene-solr:branch_6x: SOLR-9764: change getLiveDocs to do a single volatile read

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_6x 1c7ae87f0 -> 64b1d2481


SOLR-9764: change getLiveDocs to do a single volatile read


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/64b1d248
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/64b1d248
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/64b1d248

Branch: refs/heads/branch_6x
Commit: 64b1d24819371a4e51fb525a4564905b155f41f1
Parents: 1c7ae87
Author: yonik <yo...@apache.org>
Authored: Thu Feb 2 21:49:09 2017 -0500
Committer: yonik <yo...@apache.org>
Committed: Thu Feb 2 21:49:32 2017 -0500

----------------------------------------------------------------------
 .../src/java/org/apache/solr/search/SolrIndexSearcher.java  | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/64b1d248/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java b/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
index 3c14774..dcaa6db 100644
--- a/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
+++ b/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
@@ -1095,11 +1095,12 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
   public BitDocSet getLiveDocs() throws IOException {
     // Going through the filter cache will provide thread safety here if we only had getLiveDocs,
     // but the addition of setLiveDocs means we needed to add volatile to "liveDocs".
-    if (liveDocs == null) {
-      liveDocs = getDocSetBits(matchAllDocsQuery);
+    BitDocSet docs = liveDocs;
+    if (docs == null) {
+      liveDocs = docs = getDocSetBits(matchAllDocsQuery);
     }
-    assert liveDocs.size() == numDocs();
-    return liveDocs;
+    assert docs.size() == numDocs();
+    return docs;
   }
 
   /** @lucene.internal */