lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Goller <>
Subject Re: timestamp
Date Sun, 26 Oct 2003 14:24:43 GMT
I implemented the idea proposed last week concerning
the timestamp problem. Note that this patch does no
longer use touch and lastModified for synchronizing
index changes. It works as follows:

*) The file segments (SegmentInfos) gets an additional
long which counts the number of changes of the index.
It is automatically incremented whenever SegmentInfos
are written (called by IndexWriter).

*) IndexReader now does not compare timestamps in order
to find out whether it is stale. Instead it compares
the number of changes when it was created to the actual
contents of segments.

*) In doClose of SegmentReader instead of touching the
file segments, it is rewritten in order to update number
of changes.

*) In order for the whole idea to work, IndexReader needs
a copy of SegmentInfos, which substitutes the former

*) It would be easy to move the "number of changes" count
from the file segments into a seperate file or as Hani proposed
into the name of a file. The changes would only involve
SegmentInfos. However, I think that my current implementation
is already quite efficient. The changes mean almost no
overhead to IndexWriter, since whenever it changes the index
segments has to be rewritten anyway. There is also not much
overhead to IndexReader. Only one additional file has to be read
once in case of delete. There is some overhead to
SegmentReader.doClose. If deletedDocsDirty == true segments
has to be rewritten. However, in this case deletedDocs has to be
written too and it is probably much bigger in most of the cases.

*) I tested my patch and all unit tests are ok including
TestIndexReader for which I get failures without my patch.

*) My patch has two parts. The 1st one is applied to
the 2nd one to
(small changes necessary doe to constructor changes for

I am looking forward to feedback,


View raw message