You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2017/05/09 11:57:48 UTC
[1/3] lucenenet git commit: Made FSDirectory stale files set
synchronized.
Repository: lucenenet
Updated Branches:
refs/heads/master a42b1dbb8 -> 483611579
Made FSDirectory stale files set synchronized.
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/d5815724
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/d5815724
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/d5815724
Branch: refs/heads/master
Commit: d58157242ba43edf6b0405e265015f6c519663ad
Parents: a42b1db
Author: Pieter van Ginkel <pi...@amcsgroup.com>
Authored: Mon May 8 13:41:05 2017 +0200
Committer: Pieter van Ginkel <pi...@amcsgroup.com>
Committed: Mon May 8 13:41:05 2017 +0200
----------------------------------------------------------------------
src/Lucene.Net/Store/FSDirectory.cs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/d5815724/src/Lucene.Net/Store/FSDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Store/FSDirectory.cs b/src/Lucene.Net/Store/FSDirectory.cs
index 0330e4c..42c5bfc 100644
--- a/src/Lucene.Net/Store/FSDirectory.cs
+++ b/src/Lucene.Net/Store/FSDirectory.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;// Used only for WRITE_LOCK_NAME in deprecated create=true case:
+using Lucene.Net.Support;
namespace Lucene.Net.Store
{
@@ -91,7 +92,7 @@ namespace Lucene.Net.Store
public const int DEFAULT_READ_CHUNK_SIZE = 8192;
protected readonly DirectoryInfo m_directory; // The underlying filesystem directory
- protected readonly ISet<string> m_staleFiles = new HashSet<string>(); // Files written, but not yet sync'ed
+ protected readonly ISet<string> m_staleFiles = new ConcurrentHashSet<string>(); // Files written, but not yet sync'ed
#pragma warning disable 612, 618
private int chunkSize = DEFAULT_READ_CHUNK_SIZE;
#pragma warning restore 612, 618
[2/3] lucenenet git commit: Added test case which throws on
concurrent directory access.
Posted by ni...@apache.org.
Added test case which throws on concurrent directory access.
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/33401007
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/33401007
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/33401007
Branch: refs/heads/master
Commit: 33401007061e339ed692432abcbb5feb33ed50a0
Parents: d581572
Author: Pieter van Ginkel <pi...@amcsgroup.com>
Authored: Mon May 8 15:21:00 2017 +0200
Committer: Pieter van Ginkel <pi...@amcsgroup.com>
Committed: Mon May 8 15:21:00 2017 +0200
----------------------------------------------------------------------
src/Lucene.Net.Tests/Store/TestDirectory.cs | 55 ++++++++++++++++++++++++
1 file changed, 55 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/33401007/src/Lucene.Net.Tests/Store/TestDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Store/TestDirectory.cs b/src/Lucene.Net.Tests/Store/TestDirectory.cs
index e796640..3753818 100644
--- a/src/Lucene.Net.Tests/Store/TestDirectory.cs
+++ b/src/Lucene.Net.Tests/Store/TestDirectory.cs
@@ -6,6 +6,7 @@ using Lucene.Net.Util;
using NUnit.Framework;
using System;
using System.IO;
+using System.Threading;
namespace Lucene.Net.Store
{
@@ -423,5 +424,59 @@ namespace Lucene.Net.Store
Assert.AreEqual(0, fsdir.ListAll().Length);
}
}
+
+ [Test]
+ [Ignore("Not deterministic; depends on a race condition")]
+ [LuceneNetSpecific]
+ public virtual void ConcurrentIndexAccessThrowsWithoutSynchronizedStaleFiles()
+ {
+ DirectoryInfo tempDir = CreateTempDir(GetType().Name);
+ using (Directory dir = new SimpleFSDirectory(tempDir))
+ {
+ var ioContext = NewIOContext(Random());
+ var threads = new Thread[Environment.ProcessorCount];
+ int file = 0;
+ Exception exception = null;
+ bool stopped = false;
+
+ using (var @event = new ManualResetEvent(false))
+ {
+ for (int i = 0; i < threads.Length; i++)
+ {
+ var thread = new Thread(() =>
+ {
+ while (!stopped)
+ {
+ int nextFile = Interlocked.Increment(ref file);
+ try
+ {
+ dir.CreateOutput("test" + nextFile, ioContext).Dispose();
+ }
+ catch (Exception ex)
+ {
+ exception = ex;
+ @event.Set();
+ break;
+ }
+ }
+ });
+ thread.Start();
+ threads[i] = thread;
+ }
+
+ bool raised = @event.WaitOne(TimeSpan.FromSeconds(5));
+
+ stopped = true;
+
+ if (raised)
+ throw new Exception("Test failed", exception);
+ }
+
+ foreach (var thread in threads)
+ {
+ thread.Join();
+ }
+ }
+ }
}
}
\ No newline at end of file
[3/3] lucenenet git commit: Removed ignore from concurrent index
access test case.
Posted by ni...@apache.org.
Removed ignore from concurrent index access test case.
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/48361157
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/48361157
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/48361157
Branch: refs/heads/master
Commit: 48361157942a5dca1ae9590aec80f2462c565b83
Parents: 3340100
Author: Pieter van Ginkel <pi...@amcsgroup.com>
Authored: Tue May 9 10:28:24 2017 +0200
Committer: Pieter van Ginkel <pi...@amcsgroup.com>
Committed: Tue May 9 10:28:24 2017 +0200
----------------------------------------------------------------------
src/Lucene.Net.Tests/Store/TestDirectory.cs | 1 -
1 file changed, 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/48361157/src/Lucene.Net.Tests/Store/TestDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Store/TestDirectory.cs b/src/Lucene.Net.Tests/Store/TestDirectory.cs
index 3753818..bbcfbc9 100644
--- a/src/Lucene.Net.Tests/Store/TestDirectory.cs
+++ b/src/Lucene.Net.Tests/Store/TestDirectory.cs
@@ -426,7 +426,6 @@ namespace Lucene.Net.Store
}
[Test]
- [Ignore("Not deterministic; depends on a race condition")]
[LuceneNetSpecific]
public virtual void ConcurrentIndexAccessThrowsWithoutSynchronizedStaleFiles()
{