lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael McCandless (JIRA)" <>
Subject [jira] Commented: (LUCENE-1449) IndexDeletionPolicy.delete behaves incorrectly when deleting latest generation
Date Tue, 11 Nov 2008 16:14:44 GMT


Michael McCandless commented on LUCENE-1449:


There is indeed a bug here, but once we fix it, you won't be able to
do rollback by opening the latest commit point.

But, LUCENE-1411 (recently committed to 2.9) will work: it lets you
open IndexWriter on an arbitrary commit point.

Your deletion policy then gets to decide what to do with the now
future commit points (ie, you can keep them around), and when you next
commit, it's written to the segments_N after all future commit points.
Ie, it's like using svn to revert a bunch of changes: the changes
still live in prior commit points; it's just that your next commit has
removed those changes.

Conceptually, when IndexWriter opens and loads a commit point, either
one you explicitly specified, or, the most recent one by default, it
holds open a private in-memory-only commit point which you can't
delete.  You can delete the commit points on disk, but the one in
memory is private to IndexWriter and moves forward as segments are
flushed, merged, etc.  When IndexWriter commits, it makes a new
on-disk commit point that's a copy of the in-memory one.

This bug is happening because when IndexWriter commits (during close),
it thinks there are no pending changes and so does nothing.  But,
there was a change (you removed the last commit point), and so I think
we should mark doing so as a real change.  What this will mean is
IndexWriter will simply write the next segments_N file which is a copy
of the one you had just deleted.

> IndexDeletionPolicy.delete behaves incorrectly when deleting latest generation 
> -------------------------------------------------------------------------------
>                 Key: LUCENE-1449
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 2.9
>            Reporter: Mark Harwood
>            Assignee: Michael McCandless
>            Priority: Minor
>         Attachments:
> I have been looking to provide the ability to rollback committed transactions and encountered
some issues.
> I appreciate IndexDeletionPolicy's main motivation is to handle cleaning away OLD commit
points but it does not explicitly state that it can or cannot be used to clean NEW commit
> If this is not supported then the documentation should ideally state this. If the intention
is to support this behaviour then read on .......
> There seem to be 2 issues so far:
> 1) The first attempt to call IndexCommit.delete on the latest commit point fails to remove
any contents. The subsequent call succeeds however
> 2) Deleting the latest commit point fails to update the segments.gen file to point to
segments_N-1. New IndexReaders that are opened are then misdirected to open segments_N which
has been deleted
> Junit test to follow...

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