lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jason Rutherglen" <>
Subject Re: Deleting first IndexCommit
Date Thu, 03 Jul 2008 15:25:03 GMT
It's for recovery, a commit to an index may have occurred but other commits
as part of a global commit failed, so it's for rollback in the event of

Are you saying the delete does not immediately happen when
IndexCommit.delete is called using IndexDeletionPolicy?

I don't mind using IndexWriter, I am just looking for a more straightforward
API for managing the index generations than using a callback class like

On Thu, Jul 3, 2008 at 11:09 AM, Michael McCandless <> wrote:

> Actually you'd need to open an IndexWriter to do the delete, unless you
> open a reader, make a change, then close the reader (on closing the reader,
> which makes a new commit, your deletion policy gets a chance to delete
> commits).
> One question: why are you needing to delete the most recent commit?  (Just
> curious about the use case behind this...).
> "Normally", deletion of commits happens when a new commit is created, but I
> agree that being able to spontaneous delete commits could be nice and would
> be more straightforward, for Ocean at least.  You're sort of out in new
> territory here (not too many people juggle so many commits in their index)!
> To do this we'd have to grab the write lock, create an IndexFileDeleter,
> delete the commit, close the IndexFileDeleter and release the write lock.
>  But I'm not sure we want to go down that road vs. having IndexWriter be the
> thing you open to make changes (including deletion of commits) to an index?
>  Maybe, instead, you open a writer, then we expose a
> deleteCommit(IndexCommit) method...
> Mike
> Jason Rutherglen wrote:
>  For Ocean I need to be able to delete the latest commit, however currently
>> using IndexCommit commit, IndexDeletionPolicy
>> deletionPolicy) I need to open the IndexReader that represents the latest
>> commit, presumably in IndexDeletionPolicy.onInit delete the IndexCommit,
>> then close the IndexReader and start over.  Wouldn't this be cleaner to call
>> IndexReader.listCommits and then delete the first one (assuming they are in
>> generation descending order).
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View raw message