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 Rakhi Khatwani <rk...@gmail.com> on 2009/11/25 10:35:32 UTC

locks in solr

Hi,
      Is there any article which explains the locks in solr??
there is some info on solrconfig.txt which says that you can set the lock
type to none(NoLockFactory), single(SingleInstanceLockFactory),
NativeFSLockFactory and simple(SimpleFSLockFactory) which locks everytime we
create a new file.
suppose my index dir has the following files:
_2s.fdt, _2t.fnm, _2u.nrm, _2v.tii, _2x.fdt, _2y.fnm, _2z.nrm, _30.tii,
_2s.fdx, _2t.frq, _2u.prx, _2v.tis _2x.fdx, _2y.frq _2z.prx, _30.tis,
_2s.fnm, _2t.nrm, _2u.tii, _2w.fdt _2x.fnm, _2y.nrm _2z.tii, segments_2s,
_2s.frq, _2t.prx, _2u.tis, _2w.fdx _2x.frq, _2y.prx _2z.tis, segments.gen

1.)   I assume for each of these files there is a lock. please correct me if
i am wrong.
2.) what are the different lock types in terms of read/write/updates?
3.) Can we have a document level locking scheme?
4.) we would like to know the best way to handle multiple simulataneous
writes to the index
Thanks a ton,
Raakhi

Re: locks in solr

Posted by Chris Hostetter <ho...@fucit.org>.
:       Is there any article which explains the locks in solr??
: there is some info on solrconfig.txt which says that you can set the lock
: type to none(NoLockFactory), single(SingleInstanceLockFactory),
: NativeFSLockFactory and simple(SimpleFSLockFactory) which locks everytime we
: create a new file.

FYI: That's not at all what the SimpleFSLockFactory does.

Index locking is a pretty low level Level concept -- there isn't really 
anything Solr specific about it.  90% of all Solr users shouldn't need to 
worry about it, ever.  The only time it becomes an issue is if you are 
planning on doing something extremeley advanced dealing with the Lucene 
index files directly.

if that's the case: your best bet is to read the Locking code and APIs in 
Lucene, and ask your questions on the java-users@lucene mailing list.



-Hoss


Re: locks in solr

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
On Wed, Nov 25, 2009 at 3:05 PM, Rakhi Khatwani <rk...@gmail.com> wrote:

> Hi,
>      Is there any article which explains the locks in solr??
> there is some info on solrconfig.txt which says that you can set the lock
> type to none(NoLockFactory), single(SingleInstanceLockFactory),
> NativeFSLockFactory and simple(SimpleFSLockFactory) which locks everytime
> we
> create a new file.
> suppose my index dir has the following files:
> _2s.fdt, _2t.fnm, _2u.nrm, _2v.tii, _2x.fdt, _2y.fnm, _2z.nrm, _30.tii,
> _2s.fdx, _2t.frq, _2u.prx, _2v.tis _2x.fdx, _2y.frq _2z.prx, _30.tis,
> _2s.fnm, _2t.nrm, _2u.tii, _2w.fdt _2x.fnm, _2y.nrm _2z.tii, segments_2s,
> _2s.frq, _2t.prx, _2u.tis, _2w.fdx _2x.frq, _2y.prx _2z.tis, segments.gen
>
> 1.)   I assume for each of these files there is a lock. please correct me
> if
> i am wrong.
>

No. The index directory has one lock. Individual files are not locked
separately.


> 2.) what are the different lock types in terms of read/write/updates?
>

Locks are only used for preventing more than one IndexWriters (or Solr
instances/cores) writing to the same index. They do not prevent reads. They
also do not prevent multiple writes from the same Solr core (there is some
synchronization but it has nothing to do with these locks)


> 3.) Can we have a document level locking scheme?
>

No. I think you have grossly misunderstood the purpose of locks in Solr.


> 4.) we would like to know the best way to handle multiple simulataneous
> writes to the index
>

With one Solr instance, you can do writes concurrently without a problem.

-- 
Regards,
Shalin Shekhar Mangar.