lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Otis Gospodnetic <otis_gospodne...@yahoo.com>
Subject Re: Multi process writer access to an index
Date Tue, 25 Mar 2008 01:47:41 GMT
I didn't see the answer to this question.  This is Windows-specific.  I'm not a Windows user,
so I never had this problem, but I believe we've had code to work around this issue in Java
Lucene for years now.  It could be that Lucene.Net doesn't have that.  In any case, it would
be best to check on the Lucene.Net list.

Otis
--
Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch

----- Original Message ----
From: Eran Sevi <eransevi@gmail.com>
To: java-user@lucene.apache.org
Sent: Wednesday, March 19, 2008 10:10:46 AM
Subject: Re: Multi process writer access to an index

Sorry for any duplicate posts.

Actually I'm using the latest "final" Lucene.Net and I hope this problem is
not unique to this version.
The OS is windows, FS - NTFS.


Here's an example of what I do in each process (which may reside on a
different computer):



            writer = new IndexWriter(fi, new StandardAnalyzer(
threadData.stopwords), true);



            while (currentFile < threadData.files.Length)

            {

                //Add document

                AddDocument(threadData.files[currentFile], writer);



               writer.Close();



               currentFile++;

            }

The error I get is (each time it's a different file):

"The process cannot access the file
'D:\\Temp\\xml\\Lucene\\R3MTIndex\\_1.fdt' because it is being used by
another process."
"   at System.IO.__Error.WinIOError(Int32 errorCode, String
maybeFullPath)\r\n   at System.IO.File.Delete(String path)\r\n   at
Lucene.Net.Store.FSDirectory.CreateOutput(String name)\r\n   at
Lucene.Net.Index.FieldsWriter..ctor(Directory d, String segment, FieldInfos
fn)\r\n   at Lucene.Net.Index.SegmentMerger.MergeFields()\r\n   at
Lucene.Net.Index.SegmentMerger.Merge()\r\n   at
Lucene.Net.Index.IndexWriter.MergeSegments(Int32 minSegment, Int32
end)\r\n   at Lucene.Net.Index.IndexWriter.MergeSegments(Int32
minSegment)\r\n   at Lucene.Net.Index.IndexWriter.FlushRamSegments()\r\n
at Lucene.Net.Index.IndexWriter.Close()\r\n   at AAIndexer.RunThread(Object
data) in D:\\LuceneWrapper\\AAIndexer.cs:line 169\r\n   at
System.Threading.ThreadHelper.ThreadStart_Context(Object state)\r\n   at
System.Threading.ExecutionContext.Run(ExecutionContext executionContext,
ContextCallback callback, Object state)\r\n   at
System.Threading.ThreadHelper.ThreadStart(Object obj)"

Thanks.


=============================================
You'll get more meaningful answers if you provide some details:

Things that come to mind:



op system (windows? *nix?)



file system (NFS? local? NTFS?)



An example of the error you receive (a stack trace would be good).



The code you're executing when you get the error.



Imagine you're trying to advise someone else and think about what you'd find
useful and try to provide that, please.



Best

Erick





On Wed, Mar 19, 2008 at 9:54 AM, Eran Sevi <eransevi@gmail.com> wrote:



> Hi,

>

>

> I'm trying to write to a specific index from several different

> processes and encounter problems with locked files (deletable for

> example).

>

> I don't perform any specific locking because as I understand it there

> should be file-specific locking mechanism used by lucene API. This

> doesn't seem to be working as I am able to instantiate an IndexWriter

> on the same index simultaneously, but I encounter problems when I try

> to close/optimize it .

>

>

>

> Please help me understand if lucene doesn't support this kind of

> access, and what's the proper way to write to the same index from two

> or more different processes/computers.

>

>

>

> Thanks,

>

> Eran S.

>




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


Mime
View raw message