You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by pa...@apache.org on 2013/11/12 21:40:14 UTC

[1/2] git commit: Fix bug with segmentinfos cloning

Updated Branches:
  refs/heads/branch_4x a7f1e236d -> eef5d7a0b


Fix bug with segmentinfos cloning


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

Branch: refs/heads/branch_4x
Commit: e7d92042b85558a329d8df6437c9477d4d98b484
Parents: a7f1e23
Author: Paul Irwin <pa...@gmail.com>
Authored: Fri Nov 8 13:07:14 2013 -0500
Committer: Paul Irwin <pa...@gmail.com>
Committed: Fri Nov 8 13:07:14 2013 -0500

----------------------------------------------------------------------
 src/core/Index/SegmentInfos.cs | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e7d92042/src/core/Index/SegmentInfos.cs
----------------------------------------------------------------------
diff --git a/src/core/Index/SegmentInfos.cs b/src/core/Index/SegmentInfos.cs
index 72cb341..424b767 100644
--- a/src/core/Index/SegmentInfos.cs
+++ b/src/core/Index/SegmentInfos.cs
@@ -510,6 +510,11 @@ namespace Lucene.Net.Index
         public object Clone()
         {
             SegmentInfos sis = new SegmentInfos();
+            sis.counter = this.counter;
+            sis.version = this.version;
+            sis.generation = this.generation;
+            sis.lastGeneration = this.lastGeneration;
+            sis.pendingSegnOutput = this.pendingSegnOutput;
             for (int i = 0; i < this.Count; i++)
             {
                 sis.Add((SegmentInfoPerCommit)this[i].Clone());


[2/2] git commit: Various FSDirectory fixes for file locking

Posted by pa...@apache.org.
Various FSDirectory fixes for file locking


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

Branch: refs/heads/branch_4x
Commit: eef5d7a0be39016ce8680d25d976c86f1de534ae
Parents: e7d9204
Author: Paul Irwin <pa...@gmail.com>
Authored: Tue Nov 12 15:39:29 2013 -0500
Committer: Paul Irwin <pa...@gmail.com>
Committed: Tue Nov 12 15:39:29 2013 -0500

----------------------------------------------------------------------
 src/core/Store/FSDirectory.cs   | 8 ++++----
 src/core/Store/MMapDirectory.cs | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/eef5d7a0/src/core/Store/FSDirectory.cs
----------------------------------------------------------------------
diff --git a/src/core/Store/FSDirectory.cs b/src/core/Store/FSDirectory.cs
index f5a5ce0..8b9f817 100644
--- a/src/core/Store/FSDirectory.cs
+++ b/src/core/Store/FSDirectory.cs
@@ -473,7 +473,7 @@ namespace Lucene.Net.Store
             protected FSIndexInput(string resourceDesc, FileInfo path, IOContext context, int chunkSize)
                 : base(resourceDesc, context)
             {
-                this.file = path.OpenRead();
+                this.file = new FileStream(path.FullName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
                 this.chunkSize = chunkSize;
                 this.off = 0L;
                 this.end = file.Length;
@@ -543,6 +543,7 @@ namespace Lucene.Net.Store
             {
                 //assert isOpen;
                 file.Write(b, offset, size);
+                file.Flush();
             }
 
             protected override void Dispose(bool disposing)
@@ -611,9 +612,8 @@ namespace Lucene.Net.Store
                 {
                     try
                     {
-                        file = new FileStream(fullFile.FullName, FileMode.OpenOrCreate, FileAccess.ReadWrite);
-                        //file.getFD().sync();
-                        // TODO: .NET Port: what do we do here?
+                        file = new System.IO.FileStream(fullFile.FullName, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite);
+                        FileSupport.Sync(file);
                         success = true;
                     }
                     finally

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/eef5d7a0/src/core/Store/MMapDirectory.cs
----------------------------------------------------------------------
diff --git a/src/core/Store/MMapDirectory.cs b/src/core/Store/MMapDirectory.cs
index 051b9e8..b6b8556 100644
--- a/src/core/Store/MMapDirectory.cs
+++ b/src/core/Store/MMapDirectory.cs
@@ -172,7 +172,7 @@ namespace Lucene.Net.Store
         {
             EnsureOpen();
             String path = System.IO.Path.Combine(Directory.FullName, name);
-            System.IO.FileStream raf = new System.IO.FileStream(path, System.IO.FileMode.Open, System.IO.FileAccess.Read);
+            System.IO.FileStream raf = new System.IO.FileStream(path, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.ReadWrite);
             try
             {
                 return new MMapIndexInput(this, "MMapIndexInput(path=\"" + path + "\")", raf, path);