lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r1099937 - in /lucene/dev/branches/branch_3x: ./ lucene/ lucene/backwards/ lucene/src/java/org/apache/lucene/index/ solr/
Date Thu, 05 May 2011 19:40:51 GMT
Author: mikemccand
Date: Thu May  5 19:40:51 2011
New Revision: 1099937

URL: http://svn.apache.org/viewvc?rev=1099937&view=rev
Log:
fix minor concurrency issue on SegmentReader; fix false test failure (merged from trunk)

Modified:
    lucene/dev/branches/branch_3x/   (props changed)
    lucene/dev/branches/branch_3x/lucene/   (props changed)
    lucene/dev/branches/branch_3x/lucene/backwards/   (props changed)
    lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/IndexReader.java
    lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/IndexWriter.java
    lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/SegmentMerger.java
    lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/SegmentReader.java
    lucene/dev/branches/branch_3x/solr/   (props changed)

Modified: lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/IndexReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/IndexReader.java?rev=1099937&r1=1099936&r2=1099937&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/IndexReader.java
(original)
+++ lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/IndexReader.java
Thu May  5 19:40:51 2011
@@ -892,7 +892,8 @@ public abstract class IndexReader implem
   }
 
   /** Returns the byte-encoded normalization factor for the named field of
-   * every document.  This is used by the search code to score documents.
+   *  every document.  This is used by the search code to score documents.
+   *  Returns null if norms were not indexed for this field.
    *
    * @see org.apache.lucene.document.Field#setBoost(float)
    */

Modified: lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/IndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/IndexWriter.java?rev=1099937&r1=1099936&r2=1099937&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/IndexWriter.java
(original)
+++ lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/IndexWriter.java
Thu May  5 19:40:51 2011
@@ -4047,7 +4047,7 @@ public class IndexWriter implements Clos
         message("merge store matchedCount=" + merger.getMatchedSubReaderCount() + " vs "
+ merge.readers.size());
       }
 
-      anyNonBulkMerges |= merger.getMatchedSubReaderCount() != merge.readers.size();
+      anyNonBulkMerges |= merger.getAnyNonBulkMerges();
       
       assert mergedDocCount == totDocCount: "mergedDocCount=" + mergedDocCount + " vs " +
totDocCount;
 

Modified: lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/SegmentMerger.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/SegmentMerger.java?rev=1099937&r1=1099936&r2=1099937&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/SegmentMerger.java
(original)
+++ lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/SegmentMerger.java
Thu May  5 19:40:51 2011
@@ -609,6 +609,11 @@ final class SegmentMerger {
     return df;
   }
 
+  public boolean getAnyNonBulkMerges() {
+    assert matchedCount <= readers.size();
+    return matchedCount != readers.size();
+  }
+
   private void mergeNorms() throws IOException {
     // get needed buffer size by finding the largest segment
     int bufferSize = 0;

Modified: lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/SegmentReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/SegmentReader.java?rev=1099937&r1=1099936&r2=1099937&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/SegmentReader.java
(original)
+++ lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/SegmentReader.java
Thu May  5 19:40:51 2011
@@ -784,7 +784,7 @@ public class SegmentReader extends Index
     }
   }
 
-  private void commitChanges(Map<String,String> commitUserData) throws IOException
{
+  private synchronized void commitChanges(Map<String,String> commitUserData) throws
IOException {
     if (deletedDocsDirty) {               // re-write deleted
       si.advanceDelGen();
 
@@ -1036,26 +1036,21 @@ public class SegmentReader extends Index
     return fieldSet;
   }
 
-
   @Override
-  public synchronized boolean hasNorms(String field) {
+  public boolean hasNorms(String field) {
     ensureOpen();
     return norms.containsKey(field);
   }
 
-  // can return null if norms aren't stored
-  protected synchronized byte[] getNorms(String field) throws IOException {
-    Norm norm = norms.get(field);
-    if (norm == null) return null;  // not indexed, or norms not stored
-    return norm.bytes();
-  }
-
-  // returns fake norms if norms aren't available
   @Override
-  public synchronized byte[] norms(String field) throws IOException {
+  public byte[] norms(String field) throws IOException {
     ensureOpen();
-    byte[] bytes = getNorms(field);
-    return bytes;
+    final Norm norm = norms.get(field);
+    if (norm == null) {
+      // not indexed, or norms not stored
+      return null;  
+    }
+    return norm.bytes();
   }
 
   @Override



Mime
View raw message