[ https://issues.apache.org/jira/browse/LUCENE-1076?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12736141#action_12736141 ]
Michael McCandless commented on LUCENE-1076: -------------------------------------------- bq. I added commit() after cms.sync() and it never failed again. I think you are right! Since we try to read the dir (sis.read), if we don't commit then the changes won't be present since IndexWriter is opened w/ autoCommit false. Another simple check would be to call getReader().getSequentialSubReaders() and check how many segments there are, instead of having to go through the Directory to check it. bq. BTW, the second sync() call comes after optimize(), which is redundant as far as I understand I agree. bq. I wonder then if it won't be useful to have a commit(doWait=true), which won't require calling sync() or waitForMerges()? I think we can leave this separate (ie you should call waitForMerges() if you need to), because commit normally has nothing to do w/ merging, since merging doesn't change any docs in the index. Commit only ensure that changes to the index are pushed to stable storage. Whereas eg optimize is all about doing merges so it makes sense for it to have a doWait? > Allow MergePolicy to select non-contiguous merges > ------------------------------------------------- > > Key: LUCENE-1076 > URL: https://issues.apache.org/jira/browse/LUCENE-1076 > Project: Lucene - Java > Issue Type: Improvement > Components: Index > Affects Versions: 2.3 > Reporter: Michael McCandless > Priority: Minor > Attachments: LUCENE-1076.patch > > > I started work on this but with LUCENE-1044 I won't make much progress > on it for a while, so I want to checkpoint my current state/patch. > For backwards compatibility we must leave the default MergePolicy as > selecting contiguous merges. This is necessary because some > applications rely on "temporal monotonicity" of doc IDs, which means > even though merges can re-number documents, the renumbering will > always reflect the order in which the documents were added to the > index. > Still, for those apps that do not rely on this, we should offer a > MergePolicy that is free to select the best merges regardless of > whether they are continuguous. This requires fixing IndexWriter to > accept such a merge, and, fixing LogMergePolicy to optionally allow > it the freedom to do so. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscr...@lucene.apache.org For additional commands, e-mail: java-dev-h...@lucene.apache.org