You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Alan May <j....@gmail.com> on 2008/12/23 23:01:55 UTC

New User: Question about index locking options

Hi,

First off, as a new user of Solr, I'm extremely impressed with the Solr
service and accompanying admin tool.  Thank you very much to those who have
contributed!

My environment:
Windows 2003 R2 x64 edition server
4gb RAM
Java 6 update 18 - 64 bit
Tomcat 6.0.18
Solr 1.3
Single Index / No replication

I have multiple SolrJ clients that will be sending small update requests but
should be staggered in time to prevent concurrent updates.  However, to add
additional margin of error, I would like to apply the safest locking
mechanism possible to avoid corruption.  We have a single solr server.  From
what I'm reading in the solrconfig.xml, I'm gathering that perhaps the
NativeFSLockFactory would be more appropriate than the default
SingleInstanceLockFactory or the SimpleFSLockFactory.

Questions:
1)  Is NativeFSLockFactory the preferred index locking mechanism in this
scenario?
2)  Does the NativeFSLockFactory work on the windows platforms?
3)  Does the NativeFSLockFactory require any code changes for solrj clients
or is it transparent to that layer?
4)  What is the expected behavior if a client requests an update and there
is a lock from a previous client?  What is the granularity of the lock?

Please let me know if I can clarify anything... thanks for your time.

Kind Regards,
Alan May

Re: New User: Question about index locking options

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
On Wed, Dec 24, 2008 at 3:31 AM, Alan May <j....@gmail.com> wrote:

>
> I have multiple SolrJ clients that will be sending small update requests
> but
> should be staggered in time to prevent concurrent updates.  However, to add
> additional margin of error, I would like to apply the safest locking
> mechanism possible to avoid corruption.  We have a single solr server.
>  From
> what I'm reading in the solrconfig.xml, I'm gathering that perhaps the
> NativeFSLockFactory would be more appropriate than the default
> SingleInstanceLockFactory or the SimpleFSLockFactory.
>

Solr supports query/update requests from multiple threads and there is no
explicit locking per client. You don't need to worry about the lock section
in solrconfig.xml. It is intended to protect the index from external changes
(an external application writing direcly to the index or when multiple Solr
processes are accidentally started on the same index folder).

Go ahead and have your clients query/update Solr. Just note that all changes
to the index will be visible after a commit. So make sure the last client
calls a commit or else use the autoCommit feature.

HTH.

-- 
Regards,
Shalin Shekhar Mangar.