lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r527299 - /lucene/java/trunk/src/test/org/apache/lucene/index/TestDeletionPolicy.java
Date Tue, 10 Apr 2007 21:09:33 GMT
Author: mikemccand
Date: Tue Apr 10 14:09:32 2007
New Revision: 527299

URL: http://svn.apache.org/viewvc?view=rev&rev=527299
Log:
LUCENE-710: fix false-positive failure case of 'delete by time' deletion policy test case

Modified:
    lucene/java/trunk/src/test/org/apache/lucene/index/TestDeletionPolicy.java

Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestDeletionPolicy.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestDeletionPolicy.java?view=diff&rev=527299&r1=527298&r2=527299
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestDeletionPolicy.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestDeletionPolicy.java Tue Apr 10
14:09:32 2007
@@ -191,7 +191,11 @@
     writer.setUseCompoundFile(useCompoundFile);
     writer.close();
 
+    long lastDeleteTime = 0;
     for(int i=0;i<7;i++) {
+      // Record last time when writer performed deletes of
+      // past commits
+      lastDeleteTime = System.currentTimeMillis();
       writer = new IndexWriter(dir, autoCommit, new WhitespaceAnalyzer(), false, policy);
       writer.setUseCompoundFile(useCompoundFile);
       for(int j=0;j<17;j++) {
@@ -216,8 +220,6 @@
     String fileName = IndexFileNames.fileNameFromGeneration(IndexFileNames.SEGMENTS,
                                                             "",
                                                             gen);
-    long newestModTime = dir.fileModified(fileName);
-      
     while(gen > 0) {
       try {
         IndexReader reader = IndexReader.open(dir);
@@ -226,7 +228,7 @@
                                                          "",
                                                          gen);
         long modTime = dir.fileModified(fileName);
-        assertTrue("commit point was older than " + SECONDS + " seconds but did not get deleted",
newestModTime - modTime < (SECONDS*1000));
+        assertTrue("commit point was older than " + SECONDS + " seconds but did not get deleted",
lastDeleteTime - modTime < (SECONDS*1000));
       } catch (IOException e) {
         // OK
         break;



Mime
View raw message