[hibernate-dev] Hibernate Search: configure the LockingFactory

Emmanuel Bernard emmanuel at hibernate.org
Wed Feb 18 05:21:31 EST 2009


On  Feb 16, 2009, at 15:06, Sanne Grinovero wrote:

> Hi all,
> to solve HSEARCH-284 (Lucene locks left around in application  
> restart/crash)
> I am investigating the differences in all Lucene's LockFactory  
> implementations;
> some of them are interesting and I would like to add a configuration  
> option to
> replace the default one in Hibernate Search.
>
> 1) property name:
> I'm naming the property key "locking_strategy", scoped for each
> DirectoryProvider.

sounds good

>
>
> 2) values:
> At first I was planning to use the usual design to be able to specify
> any implementation
> by specifying the qualified class name, but actually only 4
> implementations make sense
> and if someone really needed the flexibility to implement their own
> they can define
> their own DirectoryProvider and use whatever they want.

hum, does that makes our codebase more complex to support custom  
LockFactories? I would like this flexibility/

>
> Also 2 of the base Lucene implementations are missing a public no-args
> constructor,
> so I would use only simple names:
>
> simple -> org.apache.lucene.store.SimpleFSLockFactory
> native  -> org.apache.lucene.store.NativeFSLockFactory
> single  -> org.apache.lucene.store.SingleInstanceLockFactory
> none   -> org.apache.lucene.store.NoLockFactory

yes, simple names for those that make sense and fqcn for the others.  
We might also support a "factory" so that impl wo no-arg constructor  
can be used, but that's an enhancement we can do later if needed.

>
>
> 3) support for "none":
> I don't think we should let the user select something which is not  
> compatible
> with H.Searche's design, so I am still trying to figure out if the  
> NoLockFactory
> could be an option in case Search is the only process accessing the  
> index.
> Currently inside search the IndexReaders/Searchers are read-only,  
> and at most
> one IndexWriter is using the DP, so the locking strategy could be set
> to "none" IMHO.
> opinions?

that sounds reasonable but how does that differ from  
SingleInstanceLockFactory?

>
>
> 4) default:
> The current default is "simple", which has the problem as reported in
> HSEARCH-284,
> so I was puzzled by the idea to define the "native" as the default  
> one to have
> Search beginners avoid the locking problem, but I am hitting some
> problems under load testing,
> so I think the default should stay to "simple" at least for now.

OK




More information about the hibernate-dev mailing list