[hibernate-dev] Hibernate Search: configure the LockingFactory

Sanne Grinovero sanne.grinovero at gmail.com
Mon Feb 16 09:06:27 EST 2009


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.

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.
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

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?

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.

Sanne



More information about the hibernate-dev mailing list