On Tue, Aug 28, 2012 at 10:06 PM, Chris Hostetter
<[email protected]> wrote:
> On the Solr side of things, i think we should even want to consider
> automaticly running IndexUpgrader on startup if we detect that the
> Lucene3xCodec is in use to simplify things -- we can't even suggest running
> "optimize" as a quick/easy way to force and index format upgrade because if
> the 3x index as already optimized then it's a no-op and the index stays in
> the 3x format.
>

By the way: i don't really agree with that. If we want to be able to
make deletes against 3.x segments, thats a trivial patch (hint:
uncomment out the UOE)

But we just need to decide thats what we want to do (and if should set
any precedent for future backwards compat).

Personally I wouldn't be against it here because of how we do sneaky
stuff for 3.x segments on commit already (e.g. 'upgrade the SI'), so
we
already support 2 codecs (preflex and preflex-upgraded). this wouldn't
make the situation any worse.

Index: 
lucene/test-framework/src/java/org/apache/lucene/codecs/lucene3x/PreFlexRWCodec.java
===================================================================
--- 
lucene/test-framework/src/java/org/apache/lucene/codecs/lucene3x/PreFlexRWCodec.java
        (revision
1378430)
+++ 
lucene/test-framework/src/java/org/apache/lucene/codecs/lucene3x/PreFlexRWCodec.java
        (working
copy)
@@ -38,8 +38,6 @@
   private final TermVectorsFormat termVectors = new
PreFlexRWTermVectorsFormat();
   private final SegmentInfoFormat segmentInfos = new
PreFlexRWSegmentInfoFormat();
   private final StoredFieldsFormat storedFields = new
PreFlexRWStoredFieldsFormat();
-  // TODO: this should really be a different impl
-  private final LiveDocsFormat liveDocs = new Lucene40LiveDocsFormat();

   @Override
   public PostingsFormat postingsFormat() {
@@ -87,15 +85,6 @@
   }

   @Override
-  public LiveDocsFormat liveDocsFormat() {
-    if (LuceneTestCase.PREFLEX_IMPERSONATION_IS_ACTIVE) {
-      return liveDocs;
-    } else {
-      return super.liveDocsFormat();
-    }
-  }
-
-  @Override
   public StoredFieldsFormat storedFieldsFormat() {
     if (LuceneTestCase.PREFLEX_IMPERSONATION_IS_ACTIVE) {
       return storedFields;
Index: 
lucene/core/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
===================================================================
--- 
lucene/core/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java    
    (revision
1378430)
+++ 
lucene/core/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java    
    (working
copy)
@@ -301,6 +301,22 @@
       dir.close();
     }
   }
+
+  public void testDeleteOldIndex() throws IOException {
+    for (String name : oldNames) {
+      if (VERBOSE) {
+        System.out.println("TEST: oldName=" + name);
+      }
+      Directory dir = newDirectory(oldIndexDirs.get(name));
+      IndexWriter iw = new IndexWriter(dir, new
IndexWriterConfig(TEST_VERSION_CURRENT, null));
+      iw.deleteDocuments(new Term("id", "3"));
+      iw.close();
+      IndexReader ir = DirectoryReader.open(dir);
+      assertEquals(34, ir.numDocs());
+      ir.close();
+      dir.close();
+    }
+  }

   private void doTestHits(ScoreDoc[] hits, int expectedCount,
IndexReader reader) throws IOException {
     final int hitCount = hits.length;
Index: lucene/core/src/java/org/apache/lucene/codecs/lucene3x/Lucene3xCodec.java
===================================================================
--- lucene/core/src/java/org/apache/lucene/codecs/lucene3x/Lucene3xCodec.java   
(revision
1378430)
+++ lucene/core/src/java/org/apache/lucene/codecs/lucene3x/Lucene3xCodec.java   
(working
copy)
@@ -68,12 +68,7 @@
   static final String COMPOUND_FILE_STORE_EXTENSION = "cfx";

   // TODO: this should really be a different impl
-  private final LiveDocsFormat liveDocsFormat = new Lucene40LiveDocsFormat() {
-    @Override
-    public void writeLiveDocs(MutableBits bits, Directory dir,
SegmentInfoPerCommit info, int newDelCount, IOContext context) throws
IOException {
-      throw new UnsupportedOperationException("this codec can only be
used for reading");
-    }
-  };
+  private final LiveDocsFormat liveDocsFormat = new Lucene40LiveDocsFormat();

   // 3.x doesn't support docvalues
   private final DocValuesFormat docValuesFormat = new DocValuesFormat() {

-- 
lucidworks.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to