beagle r4555 - in branches/beagle-lucene2_1/beagled: . Lucene.Net/Store Lucene.Net/upstream-changes
- From: dbera svn gnome org
- To: svn-commits-list gnome org
- Subject: beagle r4555 - in branches/beagle-lucene2_1/beagled: . Lucene.Net/Store Lucene.Net/upstream-changes
- Date: Thu, 28 Feb 2008 14:13:15 +0000 (GMT)
Author: dbera
Date: Thu Feb 28 14:13:15 2008
New Revision: 4555
URL: http://svn.gnome.org/viewvc/beagle?rev=4555&view=rev
Log:
Fix lock obtain timeouts in the startup: use separate LockFactor()s for primary and secondary stores since the lockfactories store the store information in them (leading to an undocumented duplication of information which is susecptible to over-writing).
Add a FIXME mentioning what else can go wrong when lock obtain time out happens, namely the IndexWriters will stay unclosed and leak (and may cause future lock timeouts).
The 04_lock-obtain-maxtimeout patch was wrong (the comment in the patch describes the intention). Fix that.
Add a compile time target to NoiseFilter for quick standalone testing.
Modified:
branches/beagle-lucene2_1/beagled/Lucene.Net/Store/Lock.cs
branches/beagle-lucene2_1/beagled/Lucene.Net/upstream-changes/04_lock-obtain-maxtimeout.patch
branches/beagle-lucene2_1/beagled/LuceneCommon.cs
branches/beagle-lucene2_1/beagled/LuceneIndexingDriver.cs
branches/beagle-lucene2_1/beagled/NoiseFilter.cs
Modified: branches/beagle-lucene2_1/beagled/Lucene.Net/Store/Lock.cs
==============================================================================
--- branches/beagle-lucene2_1/beagled/Lucene.Net/Store/Lock.cs (original)
+++ branches/beagle-lucene2_1/beagled/Lucene.Net/Store/Lock.cs Thu Feb 28 14:13:15 2008
@@ -67,7 +67,7 @@
failureReason = null;
int maxSleepCount = (int) (lockWaitTimeout / LOCK_POLL_INTERVAL);
int sleepCount = 0;
- maxSleepCount = System.Math.Max (maxSleepCount, 1);
+ maxSleepCount = System.Math.Min (maxSleepCount, 1);
SimpleFSLock.Log ("Lock.Obtain timeout={0} maxsleepcount={1}", lockWaitTimeout, maxSleepCount);
bool locked = Obtain();
while (!locked)
Modified: branches/beagle-lucene2_1/beagled/Lucene.Net/upstream-changes/04_lock-obtain-maxtimeout.patch
==============================================================================
--- branches/beagle-lucene2_1/beagled/Lucene.Net/upstream-changes/04_lock-obtain-maxtimeout.patch (original)
+++ branches/beagle-lucene2_1/beagled/Lucene.Net/upstream-changes/04_lock-obtain-maxtimeout.patch Thu Feb 28 14:13:15 2008
@@ -11,7 +11,7 @@
bool locked = Obtain();
int maxSleepCount = (int) (lockWaitTimeout / LOCK_POLL_INTERVAL);
int sleepCount = 0;
-+ maxSleepCount = System.Math.Max (maxSleepCount, 1);
++ maxSleepCount = System.Math.Min (maxSleepCount, 1);
while (!locked)
{
if (sleepCount++ == maxSleepCount)
Modified: branches/beagle-lucene2_1/beagled/LuceneCommon.cs
==============================================================================
--- branches/beagle-lucene2_1/beagled/LuceneCommon.cs (original)
+++ branches/beagle-lucene2_1/beagled/LuceneCommon.cs Thu Feb 28 14:13:15 2008
@@ -436,15 +436,15 @@
fingerprint = reader.ReadLine ();
reader.Close ();
- Lucene.Net.Store.LockFactory lock_factory;
- if (read_only_mode)
- lock_factory = Lucene.Net.Store.NoLockFactory.GetNoLockFactory ();
- else
- lock_factory = new Lucene.Net.Store.SimpleFSLockFactory (LockDirectory);
-
// Create stores for our indexes.
- primary_store = Lucene.Net.Store.FSDirectory.GetDirectory (PrimaryIndexDirectory, lock_factory);
- secondary_store = Lucene.Net.Store.FSDirectory.GetDirectory (SecondaryIndexDirectory, lock_factory);
+ // Use separate lock factories since each lock factory is tied to the index directory
+ if (read_only_mode) {
+ primary_store = Lucene.Net.Store.FSDirectory.GetDirectory (PrimaryIndexDirectory, Lucene.Net.Store.NoLockFactory.GetNoLockFactory ());
+ secondary_store = Lucene.Net.Store.FSDirectory.GetDirectory (SecondaryIndexDirectory, Lucene.Net.Store.NoLockFactory.GetNoLockFactory ());
+ } else {
+ primary_store = Lucene.Net.Store.FSDirectory.GetDirectory (PrimaryIndexDirectory, new Lucene.Net.Store.SimpleFSLockFactory (LockDirectory));
+ secondary_store = Lucene.Net.Store.FSDirectory.GetDirectory (SecondaryIndexDirectory, new Lucene.Net.Store.SimpleFSLockFactory (LockDirectory));
+ }
}
////////////////////////////////////////////////////////////////
Modified: branches/beagle-lucene2_1/beagled/LuceneIndexingDriver.cs
==============================================================================
--- branches/beagle-lucene2_1/beagled/LuceneIndexingDriver.cs (original)
+++ branches/beagle-lucene2_1/beagled/LuceneIndexingDriver.cs Thu Feb 28 14:13:15 2008
@@ -266,6 +266,10 @@
text_cache.BeginTransaction ();
IndexWriter primary_writer, secondary_writer;
+ // FIXME: Lock obtain time-out can happen here; if that happens,
+ // an exception will be thrown and this method will break in the middle
+ // leaving IndexWriters unclosed! Same for any Lucene.Net-index modification
+ // methods.
primary_writer = new IndexWriter (PrimaryStore, IndexingAnalyzer, false);
secondary_writer = null;
Modified: branches/beagle-lucene2_1/beagled/NoiseFilter.cs
==============================================================================
--- branches/beagle-lucene2_1/beagled/NoiseFilter.cs (original)
+++ branches/beagle-lucene2_1/beagled/NoiseFilter.cs Thu Feb 28 14:13:15 2008
@@ -271,7 +271,7 @@
}
}
-#if false
+#if Noisefilter
public class AnalyzerTest {
public static void Main ()
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]