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 2019/08/15 07:56:46 UTC
[lucenenet] branch master updated (09c073b -> d9418ec)
This is an automated email from the ASF dual-hosted git repository.
nightowl888 pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git.
from 09c073b BUG: PerFieldAnalyzerWrapper and PerFieldReuseStrategy must support null keys (fixes LUCENENET-615)
new de71522 LUCENENET-617: Reverting commits that are causing Lucene.Net.Replicator.IndexAndTaxonomyReplicationClientTest::TestConsistencyOnExceptions() to deadlock and Lucene.Net.Store.TestMockDirectoryWrapper::TestDiskFull() to fail randomly
new d9418ec Lucene.Net.Tests.Replicator: Removed Timeout attribute that was put in only to ensure a deadlock doesn't cause the test run to time out (see LUCENENET-617)
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../Properties/AssemblyInfo.cs | 21 -------
src/Lucene.Net.Tests/Store/TestLockFactory.cs | 2 +-
src/Lucene.Net/Store/NativeFSLockFactory.cs | 73 ++++++++++------------
3 files changed, 34 insertions(+), 62 deletions(-)
[lucenenet] 01/02: LUCENENET-617: Reverting commits that are causing
Lucene.Net.Replicator.IndexAndTaxonomyReplicationClientTest::TestConsistencyOnExceptions()
to deadlock and Lucene.Net.Store.TestMockDirectoryWrapper::TestDiskFull()
to fail randomly
Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git
commit de715223d989d4a5ad9bbd066c64dd4093e20d72
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Wed Aug 14 14:37:28 2019 +0700
LUCENENET-617: Reverting commits that are causing Lucene.Net.Replicator.IndexAndTaxonomyReplicationClientTest::TestConsistencyOnExceptions() to deadlock and Lucene.Net.Store.TestMockDirectoryWrapper::TestDiskFull() to fail randomly
Revert "BUG: Fixed invalid method call introduced in #222 to ClearLock that caused the path to double up, which caused the GetCanonicalPathOfLockFile method to fail."
This reverts commit 7f2b76a0a81c3fbe7dd5e329cbf1d6504dba9e2c.
Revert "Lucene.Net.Store.NativeFSLockFactory: Renamed local variables to conform with naming rules (closes #222)"
This reverts commit c3e7ae30de1f23ec4198c817073096e302fc7a1b.
Revert "fix locking/disposal bug"
This reverts commit 7f6c78570d4b7e5e4bbb8708acfe3a397822baca.
---
src/Lucene.Net.Tests/Store/TestLockFactory.cs | 2 +-
src/Lucene.Net/Store/NativeFSLockFactory.cs | 73 ++++++++++++---------------
2 files changed, 34 insertions(+), 41 deletions(-)
diff --git a/src/Lucene.Net.Tests/Store/TestLockFactory.cs b/src/Lucene.Net.Tests/Store/TestLockFactory.cs
index 46e6655..7f5c13c 100644
--- a/src/Lucene.Net.Tests/Store/TestLockFactory.cs
+++ b/src/Lucene.Net.Tests/Store/TestLockFactory.cs
@@ -199,7 +199,7 @@ namespace Lucene.Net.Store
}
// Verify: NativeFSLockFactory works correctly
- [Test]
+ [Test, LongRunningTest]
public virtual void TestNativeFSLockFactory()
{
var f = new NativeFSLockFactory(CreateTempDir("testNativeFsLockFactory"));
diff --git a/src/Lucene.Net/Store/NativeFSLockFactory.cs b/src/Lucene.Net/Store/NativeFSLockFactory.cs
index e21d345..b5b65fc 100644
--- a/src/Lucene.Net/Store/NativeFSLockFactory.cs
+++ b/src/Lucene.Net/Store/NativeFSLockFactory.cs
@@ -88,17 +88,16 @@ namespace Lucene.Net.Store
SetLockDir(lockDir);
}
- // LUCENENET: NativeFSLocks in Java are infact singletons; this is how we mimick that to track instances and make sure
- // IW.Unlock and IW.IsLocked works correctly
- internal static readonly Dictionary<string, Lock> locks = new Dictionary<string, Lock>();
- internal static readonly object syncLock = new object();
-
- /// <summary>
- /// Given a lock name, return the full prefixed path of the actual lock file.
- /// </summary>
- /// <param name="lockName"></param>
- /// <returns></returns>
- private string GetCanonicalPathOfLockFile(string lockName)
+ // LUCENENET: NativeFSLocks in Java are infact singletons; this is how we mimick that to track instances and make sure
+ // IW.Unlock and IW.IsLocked works correctly
+ internal static readonly Dictionary<string, Lock> _locks = new Dictionary<string, Lock>();
+
+ /// <summary>
+ /// Given a lock name, return the full prefixed path of the actual lock file.
+ /// </summary>
+ /// <param name="lockName"></param>
+ /// <returns></returns>
+ private string GetCanonicalPathOfLockFile(string lockName)
{
if (m_lockPrefix != null)
{
@@ -111,11 +110,9 @@ namespace Lucene.Net.Store
{
var path = GetCanonicalPathOfLockFile(lockName);
Lock l;
- lock (syncLock)
- {
- if (!locks.TryGetValue(path, out l))
- locks.Add(path, l = NewLock(path));
- }
+ lock (_locks)
+ if (!_locks.TryGetValue(path, out l))
+ _locks.Add(path, l = NewLock(path));
return l;
}
@@ -133,16 +130,14 @@ namespace Lucene.Net.Store
{
var path = GetCanonicalPathOfLockFile(lockName);
Lock l;
- // this is the reason why we can't use ConcurrentDictionary: we need the removal and disposal of the lock to be atomic
- // otherwise it may clash with MakeLock making a lock and ClearLock disposing of it in another thread.
- lock (syncLock)
- {
- if (locks.TryGetValue(path, out l))
- {
- locks.Remove(path);
- l.Dispose();
- }
- }
+ // this is the reason why we can't use ConcurrentDictionary: we need the removal and disposal of the lock to be atomic
+ // otherwise it may clash with MakeLock making a lock and ClearLock disposing of it in another thread.
+ lock (_locks)
+ if (_locks.TryGetValue(path, out l))
+ {
+ _locks.Remove(path);
+ l.Dispose();
+ }
}
}
@@ -169,7 +164,6 @@ namespace Lucene.Net.Store
private FileStream channel;
private readonly string path;
private readonly DirectoryInfo lockDir;
- private readonly object syncLock = new object(); // avoid lock(this)
public NativeFSLock(NativeFSLockFactory outerInstance, DirectoryInfo lockDir, string path)
{
@@ -180,7 +174,7 @@ namespace Lucene.Net.Store
public override bool Obtain()
{
- lock (syncLock)
+ lock (this)
{
FailureReason = null;
@@ -248,15 +242,15 @@ namespace Lucene.Net.Store
{
if (disposing)
{
- lock (syncLock)
+ lock (this)
{
// whether or not we have created a file, we need to remove
// the lock instance from the dictionary that tracks them.
try
{
- outerInstance?.ClearLock(path);
-
- }
+ lock (NativeFSLockFactory._locks)
+ NativeFSLockFactory._locks.Remove(path);
+ }
finally
{
if (channel != null)
@@ -291,7 +285,7 @@ namespace Lucene.Net.Store
public override bool IsLocked()
{
- lock (syncLock)
+ lock (this)
{
// The test for is isLocked is not directly possible with native file locks:
@@ -342,9 +336,8 @@ namespace Lucene.Net.Store
private FileStream channel;
private readonly string path;
private readonly DirectoryInfo lockDir;
- private readonly object syncLock = new object(); // avoid lock(this)
- public SharingAwareNativeFSLock(NativeFSLockFactory outerInstance, DirectoryInfo lockDir, string path)
+ public SharingAwareNativeFSLock(NativeFSLockFactory outerInstance, DirectoryInfo lockDir, string path)
{
this.outerInstance = outerInstance;
this.lockDir = lockDir;
@@ -383,7 +376,7 @@ namespace Lucene.Net.Store
public override bool Obtain()
{
- lock (syncLock)
+ lock (this)
{
FailureReason = null;
@@ -468,14 +461,14 @@ namespace Lucene.Net.Store
{
if (disposing)
{
- lock (syncLock)
+ lock (this)
{
// whether or not we have created a file, we need to remove
// the lock instance from the dictionary that tracks them.
try
{
- lock (NativeFSLockFactory.syncLock)
- NativeFSLockFactory.locks.Remove(path);
+ lock (NativeFSLockFactory._locks)
+ NativeFSLockFactory._locks.Remove(path);
}
finally
{
@@ -507,7 +500,7 @@ namespace Lucene.Net.Store
public override bool IsLocked()
{
- lock (syncLock)
+ lock (this)
{
// First a shortcut, if a lock reference in this instance is available
if (channel != null)
[lucenenet] 02/02: Lucene.Net.Tests.Replicator: Removed Timeout
attribute that was put in only to ensure a deadlock doesn't cause the test
run to time out (see LUCENENET-617)
Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git
commit d9418ec2a80ae834d7b9515326b63768309478c9
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Thu Aug 15 12:54:04 2019 +0700
Lucene.Net.Tests.Replicator: Removed Timeout attribute that was put in only to ensure a deadlock doesn't cause the test run to time out (see LUCENENET-617)
---
.../Properties/AssemblyInfo.cs | 21 ---------------------
1 file changed, 21 deletions(-)
diff --git a/src/Lucene.Net.Tests.Replicator/Properties/AssemblyInfo.cs b/src/Lucene.Net.Tests.Replicator/Properties/AssemblyInfo.cs
index 62b4349..4de1f37 100644
--- a/src/Lucene.Net.Tests.Replicator/Properties/AssemblyInfo.cs
+++ b/src/Lucene.Net.Tests.Replicator/Properties/AssemblyInfo.cs
@@ -35,24 +35,3 @@ using System.Runtime.InteropServices;
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("418e9d8e-2369-4b52-8d2f-5a987213999b")]
-
-#if !NETSTANDARD
-// LUCENENET TODO: 2019-07-14 - Had a hanging test in Lucene.Net.Tests.Replicator
-// on .NET Framwork 4.5 (not sure which one),
-// but unable to repeat. Adding this timeout (with at least 10x the time it usually takes
-// to run all of these tests) to ensure if we get a hang again, the hanging test will fail
-// so we know which test to investigate.
-[assembly: NUnit.Framework.Timeout(120000)]
-
-//All we know for certain is that it wasn't any of these tests
-
-//√ TestBasic [1s 220ms]
-//√ TestNoUpdateThread [313ms]
-//√ TestRecreateTaxonomy [233ms]
-//√ TestRestart [380ms]
-//√ TestUpdateThread [314ms]
-//√ TestNoCommit [26ms]
-//√ TestOpen [31ms]
-//√ TestRevisionRelease [5ms]
-//√ TestSegmentsFileLast [3ms]
-#endif