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:17 UTC
lucene-solr:master: SOLR-9764: change getLiveDocs to do a single
volatile read
Repository: lucene-solr
Updated Branches:
refs/heads/master 52b1ae33a -> 98d1dabcd
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/98d1dabc
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/98d1dabc
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/98d1dabc
Branch: refs/heads/master
Commit: 98d1dabcd8c851be507bc374c565a41a829e2c72
Parents: 52b1ae3
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:09 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/98d1dabc/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 ff7054b..de6950b 100644
--- a/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
+++ b/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
@@ -1153,11 +1153,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 */