lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shai Erera (JIRA)" <>
Subject [jira] Commented: (LUCENE-2386) IndexWriter commits unnecessarily on fresh Directory
Date Fri, 09 Apr 2010 03:49:50 GMT


Shai Erera commented on LUCENE-2386:

bq. Maybe change testImmediateDiskFull to set max allowed size to max(1, current-usage)?

Good idea ! Did it and it works.

Now ... one thing I haven't mentioned is the bw break. This is a behavioral bw break, which
specifically I'm not so sure we should care about, because I wonder how many apps out there
rely on being able to open a reader before they ever commited on a fresh new index. So what
do you think - do this change anyway, OR ... utilize Version to our aid? I.e., if the Version
that was passed to IWC is before LUCENE_31, we keep the initial commit, otherwise we don't
do it? Pros is that I won't need to change many of the tests because they still use the LUCENE_30
version (but that is not a strong argument), so it's a weak Pro. Cons is that IW will keep
having that doCommit handling in its ctor, only now w/ added comments on why this is being
kept around etc.

What do you think?

> IndexWriter commits unnecessarily on fresh Directory
> ----------------------------------------------------
>                 Key: LUCENE-2386
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>            Reporter: Shai Erera
>            Assignee: Shai Erera
>             Fix For: 3.1
>         Attachments: LUCENE-2386.patch
> I've noticed IndexWriter's ctor commits a first commit (empty one) if a fresh Directory
is passed, w/ OpenMode.CREATE or CREATE_OR_APPEND. This seems unnecessarily, and kind of brings
back an autoCommit mode, in a strange way ... why do we need that commit? Do we really expect
people to open an IndexReader on an empty Directory which they just passed to an IW w/ create=true?
If they want, they can simply call commit() right away on the IW they created.
> I ran into this when writing a test which committed N times, then compared the number
of commits (via IndexReader.listCommits) and was surprised to see N+1 commits.
> Tried to change doCommit to false in IW ctor, but it got IndexFileDeleter jumping on
me .. so the change might not be that simple. But I think it's manageable, so I'll try to
attack it (and IFD specifically !) back :).

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:
For additional commands, e-mail:

View raw message