lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Goller <gol...@detego-software.de>
Subject Re: File timestamps
Date Mon, 20 Oct 2003 17:27:44 GMT
I looked into the timestamps discussion, and Hani´s patch.
I am not completely satisfied with the proposed solution and
others also expressed similar doubts about having timestamps
pointing into the future .....

The perfect solution would be to circumvent the Java (OS) file timestamps
and to implement something ourselves. However, this would be quite an
effort. What about living the file timestamps as they are and using
an additional file per index that contains nothing but a counter (type long)
which gets incremented everytime the index is changed (SegmentReader and
IndexWriter). I could implement this.

Christoph

Hani Suleiman schrieb:
> I guessed (wild, wild guess not based on reality or any sort of 
> investigation) that it's theorically possible for some weird rounding 
> issues to result in that value still not causing a timestamp change.
> 
> Either way, 1000 is just as good ;)
> 
> Doug Cutting wrote:
> 
>> I think I'm okay with this one now.  +1
>>
>> Why 1500 and not 1000?
>>
>> Doug
>>
>> Hani Suleiman wrote:
>>
>>> Hrm, my attachment got chewed up, so I'm putting it inline:
>>>
>>> Index: src/java/org/apache/lucene/index/IndexWriter.java
>>> ===================================================================
>>> RCS file: 
>>> /home/cvspublic/jakarta-lucene/src/java/org/apache/lucene/index/IndexW
>>> riter.java,v
>>> retrieving revision 1.16
>>> diff -u -r1.16 IndexWriter.java
>>> --- src/java/org/apache/lucene/index/IndexWriter.java   25 Sep 2003 
>>> 22:01:51 -00
>>> 00      1.16
>>> +++ src/java/org/apache/lucene/index/IndexWriter.java   6 Oct 2003 
>>> 05:19:47 -000
>>> 0
>>> @@ -296,7 +296,8 @@
>>>                segmentInfos.info(0).dir != directory))) {
>>>        int minSegment = segmentInfos.size() - mergeFactor;
>>>        mergeSegments(minSegment < 0 ? 0 : minSegment);
>>> -    }
>>> +    }
>>> +    directory.touchFile("segments");
>>>    }
>>>
>>>    /** Merges all segments from an array of indexes into this index.
>>> Index: src/java/org/apache/lucene/store/FSDirectory.java
>>> ===================================================================
>>> RCS file: 
>>> /home/cvspublic/jakarta-lucene/src/java/org/apache/lucene/store/FSDire
>>> ctory.java,v
>>> retrieving revision 1.21
>>> diff -u -r1.21 FSDirectory.java
>>> --- src/java/org/apache/lucene/store/FSDirectory.java   25 Sep 2003 
>>> 21:50:11 -00
>>> 00      1.21
>>> +++ src/java/org/apache/lucene/store/FSDirectory.java   6 Oct 2003 
>>> 05:19:47 -000
>>> 0
>>> @@ -205,7 +205,10 @@
>>>    /** Set the modified time of an existing file to now. */
>>>    public void touchFile(String name) throws IOException {
>>>      File file = new File(directory, name);
>>> -    file.setLastModified(System.currentTimeMillis());
>>> +    long oldModified = file.lastModified();
>>> +    long now = System.currentTimeMillis();
>>> +    long latest = oldModified > now ? oldModified : now;
>>> +    file.setLastModified(latest + 1500);
>>>    }
>>>
>>>    /** Returns the length in bytes of a file in the directory. */
>>>
>>> On Monday, October 6, 2003, at 01:21 AM, Hani Suleiman wrote:
>>>
>>>> This conversation seems to have stalled a bit. So for those having 
>>>> the problem, my proposed patch is included. Please do test and let 
>>>> me know you still have problems with lock files not going away or 
>>>> any other reader/writer conflicts.
>>>>
>>>> This handles the situation by always incrementing the timestamp, 
>>>> with the disadvantage that you might end up with files (the segments 
>>>> file, in practice) sometimes having a timestamp in the future. The 
>>>> testsuite on OSX consistently passes with this patch applied.
>>>>
>>>> What's the verdict on this being committed?
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
> 
> 

-- 
*************************************************************
* Dr. Christoph Goller     Tel. : +49 89 203 45734          *
* Managing Director        Email: goller@detego-software.de *
* Detego Software GmbH     Mail : Keuslinstr. 13,           *
*                                 80798 München, Germany    *
*************************************************************


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


Mime
View raw message