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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to