lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael McCandless (JIRA)" <>
Subject [jira] Commented: (LUCENE-2386) IndexWriter commits unnecessarily on fresh Directory
Date Fri, 09 Apr 2010 10:07:51 GMT


Michael McCandless commented on LUCENE-2386:

bq. 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.

I'm inclined to just break it (w/o a version switch) -- really this is almost a bug, in that
autoCommit is false and so IW should make no commits to the index unless you ask it to.

We should try to contain the amount of switching we do based on Version.XXX, only using it
to match behavior in cases where it can do alot of harm (eg the change alters what's indexed).
 This change doesn't fit that, ie, all the app has to do (if it really cares) is call IW.commit()
immediately on creating the index.

bq. However, IndexReader.listCommits fails w/ the following exception

I think we should catch the exception in DirReader.listCommits (where it tries to load latest)
and simply return empty collection?

> 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