lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject Re: Urgent! Forgot to close IndexWriter after adding Documents to the index.
Date Wed, 23 Mar 2011 00:09:48 GMT

: I like Uwe's idea. As for Hoss's original suggestion, my initial
: reaction is that if a user understands the need to set the option
: in the first place, they're also more likely to understand the need
: for close().

my intention was that if the user used a "novice" type API for getting an 
IndexWriter, it would default to "true" but any of hte non-trivial 
constructors where default to false.

: > I am against all finalizer stuff, because it also lead to problems and is
: > unreliable - we already removed all finalizer stuff in Lucene left over from

generally i agree with you, you shouldn't *expect* finalizers to be 
called, but i'm not aware of any problems that can happen by using the 
finalizer as a safety net ... rmuir mentioned it could cause a JRE crash 
but i don't understand how that would happen.

: > A comparison is relational databases with autocommit off. If I crash my app
: > or don't correctly commit my stuff, it's also reverted on loose of
: > connection or foreful shutdown of JDBC driver! Where is the difference?

the difference is a lot of DBs do default to autocommit, and we not only 
don't have "autocommit" (or "autoclose" as i'm suggestion) as a 
defualt, we don't even offer it as an option.

it just seems like the kind of thing that could easily bite someone in the 
ass that we could help prevent.

not just in the caes of a person who writes their first Lucene app and 
doesn't know to call "close()" or "commit()" at all, but in the case of 
someone who has an app that works fine 90% of the time, but doesn't 
realize they have a stray code path where they aren't committing/closing 
properly ... so *most* of hte time their app works fine and all of their 
data is there, but sometimesfor reasons they can't understand, data is 
missing when they do searches (even though their indexing code logs that 
it was added successfully)


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message