You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by jm <jm...@gmail.com> on 2007/02/20 10:36:55 UTC

2.1 lock file name

Hi,

I updated my code to use 2.1 (IndexWriter deleting docs etc), and when
using native locks I still get a lock like this:
lucene-2361bf484af61abc81e6e7f412ad43af-n-write.lock
and when using SimpleFSLockFactory:
lucene-2361bf484af61abc81e6e7f412ad43af-write.lock

>From the changes.txt:
9. LUCENE-771: The default location of the write lock is now the
    index directory, and is named simply "write.lock" (without a big
    digest prefix).

Not a big deal, just wondering if changes.txt is wrong or it refers to
some other lock file.

thanks for the 2.1 release to all,
javi

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: 2.1 lock file name

Posted by Michael McCandless <lu...@mikemccandless.com>.
On Tue, 20 Feb 2007 10:36:55 +0100, "jm" <jm...@gmail.com> said:

> I updated my code to use 2.1 (IndexWriter deleting docs etc), and when
> using native locks I still get a lock like this:
> lucene-2361bf484af61abc81e6e7f412ad43af-n-write.lock
> and when using SimpleFSLockFactory:
> lucene-2361bf484af61abc81e6e7f412ad43af-write.lock

The defaulting only happens if FSDirectory.getDirectory() is called
without passing your own LockFactory.

If instead you create your own LockFactory and pass that in, then
FSDirectory won't change whichever lockDir you had specified to that
LockFactory.

If you want this same default behavior, but from your own created
LockFactory, you can do something like this:

  LockFactory lf = new NativeFSLockFactory(indexDir);
  Directory d = FSDirectory.getDirectory(indexDir, lf);
  lf.setLockPrefix(null);

That last line tells the lock factory that it's not necessary to use
that large digest prefix to differentiate locks (assuming
no other writer will be storing locks in this directory!).

Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org