lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [6/9] lucenenet git commit: LUCENENET-521: Added regression test to confirm this issue is fixed with the new MMapDirectory implementation.
Date Thu, 13 Jul 2017 18:36:01 GMT
LUCENENET-521: Added regression test to confirm this issue is fixed with the new MMapDirectory
implementation.


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/39e63160
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/39e63160
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/39e63160

Branch: refs/heads/master
Commit: 39e63160efd6709c591862a7cf6c8e3a1e44b126
Parents: 3944108
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Fri Jul 14 00:46:07 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Fri Jul 14 00:46:07 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Tests/Lucene.Net.Tests.csproj |   1 +
 src/Lucene.Net.Tests/Store/LUCENENET521.zip  | Bin 0 -> 8186 bytes
 src/Lucene.Net.Tests/Store/TestDirectory.cs  |  44 ++++++++++++++++++++++
 src/Lucene.Net.Tests/project.json            |   1 +
 4 files changed, 46 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/39e63160/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj b/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
index a913b37..de94c52 100644
--- a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
+++ b/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
@@ -117,6 +117,7 @@
     <EmbeddedResource Include="Index\taxo.48.w-binary-doc-values.zip" />
     <None Include="Lucene.Net.snk" />
     <None Include="Lucene.Net.Tests.project.json" />
+    <EmbeddedResource Include="Store\LUCENENET521.zip" />
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\Lucene.Net.Analysis.Common\Lucene.Net.Analysis.Common.csproj">

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/39e63160/src/Lucene.Net.Tests/Store/LUCENENET521.zip
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Store/LUCENENET521.zip b/src/Lucene.Net.Tests/Store/LUCENENET521.zip
new file mode 100644
index 0000000..ee12368
Binary files /dev/null and b/src/Lucene.Net.Tests/Store/LUCENENET521.zip differ

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/39e63160/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 bbcfbc9..2d22ae1 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.Reflection;
 using System.Threading;
 
 namespace Lucene.Net.Store
@@ -477,5 +478,48 @@ namespace Lucene.Net.Store
                 }
             }
         }
+
+        [Test]
+        [LuceneNetSpecific]
+        public void TestLUCENENET521()
+        {
+            var newDirectoryInfo = CreateTempDir("LUCENENET521");
+            using (var zipFileStream = this.GetType().GetTypeInfo().Assembly.FindAndGetManifestResourceStream(this.GetType(),
"LUCENENET521.zip"))
+            {
+                TestUtil.Unzip(zipFileStream, newDirectoryInfo);
+            }
+
+            var newDirectory = new MMapDirectory(newDirectoryInfo);
+            var conf = new Index.IndexWriterConfig(LuceneVersion.LUCENE_30, new Analysis.Standard.StandardAnalyzer(LuceneVersion.LUCENE_30));
+            var indexWriter = new Index.IndexWriter(newDirectory, conf);
+            indexWriter.Dispose();
+
+            var sharedReader = Index.IndexReader.Open(newDirectory /*, true*/);
+            const int times = 10;
+            const int concurrentTaskCount = 10;
+            var task = new System.Threading.Tasks.Task[concurrentTaskCount];
+            for (int i = 0; i < concurrentTaskCount; i++)
+            {
+                task[i] = new System.Threading.Tasks.Task(() => Search(sharedReader, times));
+                task[i].Start();
+            }
+
+            System.Threading.Tasks.Task.WaitAll(task);
+            return;
+        }
+
+        private static void Search(Index.IndexReader r, int times)
+        {
+            var searcher = new Search.IndexSearcher(r);
+            var docs = new System.Collections.Generic.List<Documents.Document>(10000);
+            for (int i = 0; i < times; i++)
+            {
+                var q = new Search.TermQuery(new Index.Term("title", "volume"));
+                foreach (var scoreDoc in searcher.Search(q, 100).ScoreDocs)
+                {
+                    docs.Add(searcher.Doc(scoreDoc.Doc));
+                }
+            }
+        }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/39e63160/src/Lucene.Net.Tests/project.json
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/project.json b/src/Lucene.Net.Tests/project.json
index 117862c..f1ff4ed 100644
--- a/src/Lucene.Net.Tests/project.json
+++ b/src/Lucene.Net.Tests/project.json
@@ -50,6 +50,7 @@
         "Index/unsupported.24.nocfs.zip",
         "Index/unsupported.29.cfs.zip",
         "Index/unsupported.29.nocfs.zip",
+        "Store/LUCENENET521.zip",
         "Support/IO/ReadFully.txt"
       ]
     }


Mime
View raw message