Mailing List Archive

write.lock is not removed
Hello,

i am trying to index a file (Lucene 4.10.3) – in my opinion in the correct
way – will say:

get the IndexWriter, Index the Doc and add them, prepare commit, commit and
finally{ close}.





My writer is generated like so:



private IndexWriter getDataIndexWriter() throws CorruptIndexException,
LockObtainFailedException, IOException {

if (dataWriter == null) {

File f = new
File(„C:/temp/index“);

if (!f.exists()) {

f.mkdirs();

}

Directory indexDir =
MMapDirectory.open(f);

KeywordAnalyzer analyzer =
AnalyzerFactory.getDataAnalyzer();

IndexWriterConfig config =
new IndexWriterConfig(AnalyzerFactory.LUCENE_VERSION, analyzer);

dataWriter = new
IndexWriter(indexDir, config);

}

return dataWriter;

}



Finally i check if static!=null and close the static (dataWriter).



My problem is, the write.lock file just wont be deleted and i cant figure
out why.

Is there any way i can debug this further?

Is there any possible way to see if processes are still accessing the file?

Am i entirely missing something?


Kind Regards and thank you in advance



Matthias
Re: write.lock is not removed [ In reply to ]
It should not be deleted. Just don't mess with it.

On Mon, Feb 23, 2015 at 7:57 AM, Just Spam <schlibospam@gmail.com> wrote:
> Hello,
>
> i am trying to index a file (Lucene 4.10.3) – in my opinion in the correct
> way – will say:
>
> get the IndexWriter, Index the Doc and add them, prepare commit, commit and
> finally{ close}.
>
>
>
>
>
> My writer is generated like so:
>
>
>
> private IndexWriter getDataIndexWriter() throws CorruptIndexException,
> LockObtainFailedException, IOException {
>
> if (dataWriter == null) {
>
> File f = new
> File(„C:/temp/index“);
>
> if (!f.exists()) {
>
> f.mkdirs();
>
> }
>
> Directory indexDir =
> MMapDirectory.open(f);
>
> KeywordAnalyzer analyzer =
> AnalyzerFactory.getDataAnalyzer();
>
> IndexWriterConfig config =
> new IndexWriterConfig(AnalyzerFactory.LUCENE_VERSION, analyzer);
>
> dataWriter = new
> IndexWriter(indexDir, config);
>
> }
>
> return dataWriter;
>
> }
>
>
>
> Finally i check if static!=null and close the static (dataWriter).
>
>
>
> My problem is, the write.lock file just wont be deleted and i cant figure
> out why.
>
> Is there any way i can debug this further?
>
> Is there any possible way to see if processes are still accessing the file?
>
> Am i entirely missing something?
>
>
> Kind Regards and thank you in advance
>
>
>
> Matthias

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: write.lock is not removed [ In reply to ]
Any reason?
I remember in 3.6 the lock was removed/deleted?


2015-02-23 14:13 GMT+01:00 Robert Muir <rcmuir@gmail.com>:

> It should not be deleted. Just don't mess with it.
>
> On Mon, Feb 23, 2015 at 7:57 AM, Just Spam <schlibospam@gmail.com> wrote:
> > Hello,
> >
> > i am trying to index a file (Lucene 4.10.3) – in my opinion in the
> correct
> > way – will say:
> >
> > get the IndexWriter, Index the Doc and add them, prepare commit, commit
> and
> > finally{ close}.
> >
> >
> >
> >
> >
> > My writer is generated like so:
> >
> >
> >
> > private IndexWriter getDataIndexWriter() throws CorruptIndexException,
> > LockObtainFailedException, IOException {
> >
> > if (dataWriter == null) {
> >
> > File f = new
> > File(„C:/temp/index“);
> >
> > if (!f.exists()) {
> >
> >
> f.mkdirs();
> >
> > }
> >
> > Directory indexDir =
> > MMapDirectory.open(f);
> >
> > KeywordAnalyzer analyzer =
> > AnalyzerFactory.getDataAnalyzer();
> >
> > IndexWriterConfig config =
> > new IndexWriterConfig(AnalyzerFactory.LUCENE_VERSION, analyzer);
> >
> > dataWriter = new
> > IndexWriter(indexDir, config);
> >
> > }
> >
> > return dataWriter;
> >
> > }
> >
> >
> >
> > Finally i check if static!=null and close the static (dataWriter).
> >
> >
> >
> > My problem is, the write.lock file just wont be deleted and i cant figure
> > out why.
> >
> > Is there any way i can debug this further?
> >
> > Is there any possible way to see if processes are still accessing the
> file?
> >
> > Am i entirely missing something?
> >
> >
> > Kind Regards and thank you in advance
> >
> >
> >
> > Matthias
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
Re: write.lock is not removed [ In reply to ]
Thats why locking didnt work correctly back then.

On Mon, Feb 23, 2015 at 8:18 AM, Just Spam <schlibospam@gmail.com> wrote:
> Any reason?
> I remember in 3.6 the lock was removed/deleted?
>
>
> 2015-02-23 14:13 GMT+01:00 Robert Muir <rcmuir@gmail.com>:
>
>> It should not be deleted. Just don't mess with it.
>>
>> On Mon, Feb 23, 2015 at 7:57 AM, Just Spam <schlibospam@gmail.com> wrote:
>> > Hello,
>> >
>> > i am trying to index a file (Lucene 4.10.3) – in my opinion in the
>> correct
>> > way – will say:
>> >
>> > get the IndexWriter, Index the Doc and add them, prepare commit, commit
>> and
>> > finally{ close}.
>> >
>> >
>> >
>> >
>> >
>> > My writer is generated like so:
>> >
>> >
>> >
>> > private IndexWriter getDataIndexWriter() throws CorruptIndexException,
>> > LockObtainFailedException, IOException {
>> >
>> > if (dataWriter == null) {
>> >
>> > File f = new
>> > File(„C:/temp/index“);
>> >
>> > if (!f.exists()) {
>> >
>> >
>> f.mkdirs();
>> >
>> > }
>> >
>> > Directory indexDir =
>> > MMapDirectory.open(f);
>> >
>> > KeywordAnalyzer analyzer =
>> > AnalyzerFactory.getDataAnalyzer();
>> >
>> > IndexWriterConfig config =
>> > new IndexWriterConfig(AnalyzerFactory.LUCENE_VERSION, analyzer);
>> >
>> > dataWriter = new
>> > IndexWriter(indexDir, config);
>> >
>> > }
>> >
>> > return dataWriter;
>> >
>> > }
>> >
>> >
>> >
>> > Finally i check if static!=null and close the static (dataWriter).
>> >
>> >
>> >
>> > My problem is, the write.lock file just wont be deleted and i cant figure
>> > out why.
>> >
>> > Is there any way i can debug this further?
>> >
>> > Is there any possible way to see if processes are still accessing the
>> file?
>> >
>> > Am i entirely missing something?
>> >
>> >
>> > Kind Regards and thank you in advance
>> >
>> >
>> >
>> > Matthias
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
RE: write.lock is not removed [ In reply to ]
Hi,

The existence of the write.lock file has nothing to do with actual locking. The lock file is just a placeholder file (0 bytes) on which the lock during indexing is applied (the actual locking is done on this file using a fnctl). When indexing finishes, the lock is removed from this file, but the file stays alive. This was different in Lucene 3, where the lock was also removed. But this caused problems because of non-atomic file operations. Lock factory only checks the "lock on the file", not "the existence of the file as a lock".

Uwe

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de


> -----Original Message-----
> From: matzschmanski@gmail.com [mailto:matzschmanski@gmail.com] On
> Behalf Of Just Spam
> Sent: Monday, February 23, 2015 1:58 PM
> To: java-user@lucene.apache.org
> Subject: write.lock is not removed
>
> Hello,
>
> i am trying to index a file (Lucene 4.10.3) – in my opinion in the correct way –
> will say:
>
> get the IndexWriter, Index the Doc and add them, prepare commit, commit
> and finally{ close}.
>
>
>
>
>
> My writer is generated like so:
>
>
>
> private IndexWriter getDataIndexWriter() throws CorruptIndexException,
> LockObtainFailedException, IOException {
>
> if (dataWriter == null) {
>
> File f = new File(„C:/temp/index“);
>
> if (!f.exists()) {
>
> f.mkdirs();
>
> }
>
> Directory indexDir = MMapDirectory.open(f);
>
> KeywordAnalyzer analyzer =
> AnalyzerFactory.getDataAnalyzer();
>
> IndexWriterConfig config = new
> IndexWriterConfig(AnalyzerFactory.LUCENE_VERSION, analyzer);
>
> dataWriter = new IndexWriter(indexDir, config);
>
> }
>
> return dataWriter;
>
> }
>
>
>
> Finally i check if static!=null and close the static (dataWriter).
>
>
>
> My problem is, the write.lock file just wont be deleted and i cant figure out
> why.
>
> Is there any way i can debug this further?
>
> Is there any possible way to see if processes are still accessing the file?
>
> Am i entirely missing something?
>
>
> Kind Regards and thank you in advance
>
>
>
> Matthias


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