[ 
https://issues.apache.org/jira/browse/LUCENE-3601?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13158000#comment-13158000
 ] 

Robert Muir commented on LUCENE-3601:
-------------------------------------

{quote}
IW.addIndexes(Dir[]) just copies files over, converting them to 4.0 style CFS 
(_X.cfe and _X.cfs files), if necessary. But the original SI for the added 
segment has "version" still set to 3.1, so when SI.files() is called it thinks 
this segment does not have an _X.cfe file and so that file gets (incorrectly, 
leading to corruption) removed.

Not quite sure how to fix this...
{quote}

This is one way (test then passes), but I'm not sure its the best fix. 
Personally I don't think we should be repackaging things into CFS on addindexes 
here, we should just do a straight copy always.

{noformat}
Index: src/java/org/apache/lucene/index/IndexWriter.java
===================================================================
--- src/java/org/apache/lucene/index/IndexWriter.java   (revision 1206734)
+++ src/java/org/apache/lucene/index/IndexWriter.java   (working copy)
@@ -2397,8 +2397,10 @@
           synchronized (this) { // Guard segmentInfos
             createCFS = !info.getUseCompoundFile()
                 && mergePolicy.useCompoundFile(segmentInfos, info)
-                // optimize case only for segments that don't share doc stores
-                && versionComparator.compare(info.getVersion(), "3.1") >= 0;
+                // optimize case only for segments that don't share doc stores,
+                // also since pre-4.0 segments use a different CFS format, 
don't 
+                // bogusly package them up in a 4.0 format.
+                && versionComparator.compare(info.getVersion(), "4.0") >= 0;
           }
           
           IOContext context = new IOContext(new MergeInfo(info.docCount, 
info.sizeInBytes(), true, -1));
{noformat}

                
> testIWondiskfull unreferenced files failure
> -------------------------------------------
>
>                 Key: LUCENE-3601
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3601
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Robert Muir
>         Attachments: LUCENE-3601.patch
>
>
> NOTE: reproduce with: ant test -Dtestcase=TestIndexWriterOnDiskFull 
> -Dtestmethod=testAddDocumentOnDiskFull 
> -Dtests.seed=aff9b14dd518cfb:4d2f112726e2947f:-2b03094a43a947ee 
> -Dtests.multiplier=3 -Dargs="-Dfile.encoding=ISO8859-1"
> Reproduces some of the time...

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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

Reply via email to