lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vanlerberghe, Luc" <>
Subject RE: index merging
Date Mon, 06 Feb 2006 07:16:14 GMT
Sorry to contradict you Yonik, but I'm pretty sure the commit lock is
*not* locked during a merge, only while the "segments" file is being

The merge process takes a set of 'old' segment files, writes new segment
files and 'registers' them in the "segments" file when they are ready to
be used.  During an optimize, this proces is repeated until there is
only one segment left.

Every process reading or writing the "segments" file grabs the commit
lock, reads the file, opens any other files it needs and releases the

While an IndexWriter or IndexReader is updating the index, the write
lock will be set though...
If this write lock is kept longer than expected you could assume a merge
is in progress.

A better way might be to check for segments files that are not
'registered' in the "segments" file yet.


-----Original Message-----
From: Yonik Seeley [] 
Sent: donderdag 2 februari 2006 22:25
Subject: Re: index merging

On 2/2/06, Omar Didi <> wrote:
> Thanks Yonik,
> I can't set the merge factor too high because I will end up with the
too many files open problem.

Right.  I meant only for adding a lot of documents.  After a lot of
adds, then you could set the mergefactor back down to a reasonable
level and optimize the index.

> if I change this method to only check for
directory.makeLock(IndexWriter.COMMIT_LOCK_NAME).isLocked(); will this
tell me that a index is merging?

Yes, the commit lock will be locked when merging is going on, but you
will get some false positives because the lock is used for other
purposes.  That may still fit your need though.


To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message