[ 
https://issues.apache.org/jira/browse/LUCENENET-561?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15747742#comment-15747742
 ] 

Andy Pook commented on LUCENENET-561:
-------------------------------------

I'm going to make an assumption here, so apologies if you're not doing things 
this way. But it seems like a common mistake.

Sounds like you might be creating a new IndexWriter for each update. As the 
index gets bigger it will take a little longer to open the index. So you are 
probably starting to get overlap. The lock file is there specifically to 
prevent multiple IWs operating on the same index.

If you are doing updates to an existing index the best practice is to maintain 
a singleton IW (ie create one at startup). Then all write operations go through 
this instance (it is designed to be threadsafe). For searching you'd create 
IndexReaders from that IW instance.

Treat the IW like the database server. You'd only ever run one DB server 
against your DB files, right? It is responsible for maintaining the safety and 
consistency of the index directory.

Hope that helps.

> After certain size, write.lock file takes time to delete automayically 
> (Lucene Indexes)
> ---------------------------------------------------------------------------------------
>
>                 Key: LUCENENET-561
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-561
>             Project: Lucene.Net
>          Issue Type: Bug
>         Environment: Asp.Net mvc
>            Reporter: Gaurav Bhardwaj
>            Priority: Critical
>
> We are using the lucene indexes to save the image thumbnail. Its working fine 
> but recently after running 6-7 months its started throwing error for 
> write.lock file in lucene indexes.
> When I went through the error I got to know that:
> 1) After creating thumbnail image when we save that in lucene indexes then 
> one write.lock file gets created and then meanwhile(when its storing in 
> lucene indexes) if I create the thumbnail image for the another image and 
> store in lucene index then Lucene index throws error.
> Reason:- After completing the storing operation write.lock file should be 
> deleted automatically but in the mean time user click on another image and 
> then second operation of storing thumbnail image in lucene index starts. 
> That's why the first write.lock file does not get deleted and it throws error.
> Note:-
> 1) My lucene index size is around 1 GB and that's why it's taking time to 
> delete the write.lock file.
> What I did to resolve this issue:-
> 1) I deleted the lucene indexes and recreated those from scratch and this 
> resolved my error. When lucene indexes creat from scratch then write.lock 
> file does not take time to delete.
> I want to know If there any file size limit for the lucene indexes?
> If I need to delete the lucene index after certain file size limit?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to