You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Nadav Har'El <ny...@math.technion.ac.il> on 2009/03/18 09:45:08 UTC

Re: IndexWriter.rollback() logic

On Mon, Feb 23, 2009, Jason Rutherglen wrote about "Re: IndexWriter.rollback() logic":
> Howdy An,
> 
> Commit means the changes are committed, there's no rollback at that point.
> 
> Also in the futuer please post your questions to java-dev@lucene.apache.org

Actually, An does make a good point that need to be corrected (by developers,
not by users ;-)) - the javadoc is a bit misleading. rollback's javadoc says

  Close the IndexWriter without committing any of the changes that have
  occurred since it was opened. This removes any temporary files that had
  been created, after which the state of the index will be the same as it
  was when this writer was first opened. 

But, this isn't exactly true - it doesn't always revert to the state of the
open(), but rather to the last commit() if such was done. For most intents
and purposes (including this one), commit() is equivalent to a close()
followed by a new open(), but a person reading this javadoc wouldn't know that.

-- 
Nadav Har'El                        |     Wednesday, Mar 18 2009, 22 Adar 5769
IBM Haifa Research Lab              |-----------------------------------------
                                    |Hi! I'm a signature virus! Copy me into
http://nadav.harel.org.il           |your signature to help me spread!

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Re: IndexWriter.rollback() logic

Posted by Michael McCandless <lu...@mikemccandless.com>.
Nadav Har'El wrote:

> On Mon, Feb 23, 2009, Jason Rutherglen wrote about "Re:  
> IndexWriter.rollback() logic":
>> Howdy An,
>>
>> Commit means the changes are committed, there's no rollback at that  
>> point.
>>
>> Also in the futuer please post your questions to java-dev@lucene.apache.org
>
> Actually, An does make a good point that need to be corrected (by  
> developers,
> not by users ;-)) - the javadoc is a bit misleading. rollback's  
> javadoc says
>
>  Close the IndexWriter without committing any of the changes that have
>  occurred since it was opened. This removes any temporary files that  
> had
>  been created, after which the state of the index will be the same  
> as it
>  was when this writer was first opened.
>
> But, this isn't exactly true - it doesn't always revert to the state  
> of the
> open(), but rather to the last commit() if such was done. For most  
> intents
> and purposes (including this one), commit() is equivalent to a close()
> followed by a new open(), but a person reading this javadoc wouldn't  
> know that.


Thanks Nadav; I'll fix the javadocs.

Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Re: IndexWriter.rollback() logic

Posted by Michael McCandless <lu...@mikemccandless.com>.
Also, rollback is still possible after a commit as long as you're using
a deletion policy that keeps more than one commit around, by
opening the IndexWriter on a prior commit point.

Mike

Nadav Har'El wrote:

> On Mon, Feb 23, 2009, Jason Rutherglen wrote about "Re:  
> IndexWriter.rollback() logic":
>> Howdy An,
>>
>> Commit means the changes are committed, there's no rollback at that  
>> point.
>>
>> Also in the futuer please post your questions to java-dev@lucene.apache.org
>
> Actually, An does make a good point that need to be corrected (by  
> developers,
> not by users ;-)) - the javadoc is a bit misleading. rollback's  
> javadoc says
>
>  Close the IndexWriter without committing any of the changes that have
>  occurred since it was opened. This removes any temporary files that  
> had
>  been created, after which the state of the index will be the same  
> as it
>  was when this writer was first opened.
>
> But, this isn't exactly true - it doesn't always revert to the state  
> of the
> open(), but rather to the last commit() if such was done. For most  
> intents
> and purposes (including this one), commit() is equivalent to a close()
> followed by a new open(), but a person reading this javadoc wouldn't  
> know that.
>
> -- 
> Nadav Har'El                        |     Wednesday, Mar 18 2009, 22  
> Adar 5769
> IBM Haifa Research Lab               
> |-----------------------------------------
>                                    |Hi! I'm a signature virus! Copy  
> me into
> http://nadav.harel.org.il           |your signature to help me spread!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org