beagle r4522 - in branches/beagle-lucene2_1/beagled/Lucene.Net: Index upstream-changes
- From: dbera svn gnome org
- To: svn-commits-list gnome org
- Subject: beagle r4522 - in branches/beagle-lucene2_1/beagled/Lucene.Net: Index upstream-changes
- Date: Sat, 23 Feb 2008 02:58:11 +0000 (GMT)
Author: dbera
Date: Sat Feb 23 02:58:11 2008
New Revision: 4522
URL: http://svn.gnome.org/viewvc/beagle?rev=4522&view=rev
Log:
Fix an incorrect change made by 'patch'. Update the list of allowed files in the index directories. Make sure the names match that in IndexFileNames.
Added:
branches/beagle-lucene2_1/beagled/Lucene.Net/upstream-changes/13_delete-stale-files-fix.patch
Modified:
branches/beagle-lucene2_1/beagled/Lucene.Net/Index/IndexWriter.cs
branches/beagle-lucene2_1/beagled/Lucene.Net/Index/SegmentInfos.cs
Modified: branches/beagle-lucene2_1/beagled/Lucene.Net/Index/IndexWriter.cs
==============================================================================
--- branches/beagle-lucene2_1/beagled/Lucene.Net/Index/IndexWriter.cs (original)
+++ branches/beagle-lucene2_1/beagled/Lucene.Net/Index/IndexWriter.cs Sat Feb 23 02:58:11 2008
@@ -711,8 +711,6 @@
writeLock.Release(); // release write lock
writeLock = null;
}
-
- segmentInfos.Optimize (directory);
}
finally
{
@@ -1070,6 +1068,8 @@
int minSegment = segmentInfos.Count - mergeFactor;
MergeSegments(segmentInfos, minSegment < 0?0:minSegment, segmentInfos.Count);
}
+
+ segmentInfos.Optimize (directory);
}
}
Modified: branches/beagle-lucene2_1/beagled/Lucene.Net/Index/SegmentInfos.cs
==============================================================================
--- branches/beagle-lucene2_1/beagled/Lucene.Net/Index/SegmentInfos.cs (original)
+++ branches/beagle-lucene2_1/beagled/Lucene.Net/Index/SegmentInfos.cs Sat Feb 23 02:58:11 2008
@@ -740,6 +740,7 @@
string[] files = directory.List();
System.Collections.ArrayList segment_names = new System.Collections.ArrayList();
+
foreach (SegmentInfo si in this)
segment_names.Add (si.name);
@@ -748,11 +749,14 @@
if (segment_names.Contains (basename))
continue;
- if (basename == IndexFileNames.DELETABLE || basename == IndexFileNames.SEGMENTS)
+ // Allowed files deletable, segments, segments.gen, segments_N
+ if (basename == IndexFileNames.DELETABLE || basename.StartsWith (IndexFileNames.SEGMENTS))
continue;
Console.WriteLine ("WARNING! Deleting stale data {0}", file);
- directory.DeleteFile (file);
+ try {
+ directory.DeleteFile (file);
+ } catch { /* Could be already deleted. */ }
}
}
}
Added: branches/beagle-lucene2_1/beagled/Lucene.Net/upstream-changes/13_delete-stale-files-fix.patch
==============================================================================
--- (empty file)
+++ branches/beagle-lucene2_1/beagled/Lucene.Net/upstream-changes/13_delete-stale-files-fix.patch Sat Feb 23 02:58:11 2008
@@ -0,0 +1,55 @@
+Fix an incorrect change made by 'patch'. Update the list of allowed files in the index directories. Make sure the names match that in IndexFileNames.
+
+From: D Bera <dbera web gmail com>
+
+Index: Index/SegmentInfos.cs
+===================================================================
+--- Index/SegmentInfos.cs (revision 4520)
++++ Index/SegmentInfos.cs (working copy)
+@@ -740,6 +740,7 @@
+ string[] files = directory.List();
+
+ System.Collections.ArrayList segment_names = new System.Collections.ArrayList();
++
+ foreach (SegmentInfo si in this)
+ segment_names.Add (si.name);
+
+@@ -748,11 +749,14 @@
+ if (segment_names.Contains (basename))
+ continue;
+
+- if (basename == IndexFileNames.DELETABLE || basename == IndexFileNames.SEGMENTS)
++ // Allowed files deletable, segments, segments.gen, segments_N
++ if (basename == IndexFileNames.DELETABLE || basename.StartsWith (IndexFileNames.SEGMENTS))
+ continue;
+
+ Console.WriteLine ("WARNING! Deleting stale data {0}", file);
+- directory.DeleteFile (file);
++ try {
++ directory.DeleteFile (file);
++ } catch { /* Could be already deleted. */ }
+ }
+ }
+ }
+Index: Index/IndexWriter.cs
+===================================================================
+--- Index/IndexWriter.cs (revision 4520)
++++ Index/IndexWriter.cs (working copy)
+@@ -711,8 +711,6 @@
+ writeLock.Release(); // release write lock
+ writeLock = null;
+ }
+-
+- segmentInfos.Optimize (directory);
+ }
+ finally
+ {
+@@ -1070,6 +1068,8 @@
+ int minSegment = segmentInfos.Count - mergeFactor;
+ MergeSegments(segmentInfos, minSegment < 0?0:minSegment, segmentInfos.Count);
+ }
++
++ segmentInfos.Optimize (directory);
+ }
+ }
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]