lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [21/50] [abbrv] lucenenet git commit: Lucene.Net.Core.Store.ByteBufferIndexInput: fixed implementation so it always calls Seek(0L) as the original did and added missing assert
Date Sun, 05 Mar 2017 11:49:00 GMT
Lucene.Net.Core.Store.ByteBufferIndexInput: fixed implementation so it always calls Seek(0L)
as the original did and added missing assert


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

Branch: refs/heads/api-work
Commit: d4c0d43c7aa63a9c996be00c5b84bcc37f9c001d
Parents: f18fd2e
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Fri Mar 3 14:09:54 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Sun Mar 5 17:08:38 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Store/ByteBufferIndexInput.cs | 13 ++++++++++---
 src/Lucene.Net.Core/Store/MMapDirectory.cs        |  3 ---
 2 files changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/d4c0d43c/src/Lucene.Net.Core/Store/ByteBufferIndexInput.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/ByteBufferIndexInput.cs b/src/Lucene.Net.Core/Store/ByteBufferIndexInput.cs
index 5a27cd6..28b29d2 100644
--- a/src/Lucene.Net.Core/Store/ByteBufferIndexInput.cs
+++ b/src/Lucene.Net.Core/Store/ByteBufferIndexInput.cs
@@ -64,22 +64,29 @@ namespace Lucene.Net.Store
         internal ByteBufferIndexInput(string resourceDescription, ByteBuffer[] buffers, long
length, int chunkSizePower, bool trackClones)
             : base(resourceDescription)
         {
-            this.buffers = buffers;
+            //this.buffers = buffers;
             this.length = length;
             this.chunkSizePower = chunkSizePower;
             this.chunkSizeMask = (1L << chunkSizePower) - 1L;
             this.clones = trackClones ? WeakIdentityMap<ByteBufferIndexInput, BoolRefWrapper>.NewConcurrentHashMap()
: null;
 
             Debug.Assert(chunkSizePower >= 0 && chunkSizePower <= 30);
-            //assert((long)((ulong)length >> chunkSizePower)) < int.MaxValue; //
LUCENENET TODO: why isn't this in place?
+            Debug.Assert(((long)((ulong)length >> chunkSizePower)) < int.MaxValue);
 
-            //Seek(0L); // LUCENENET TODO: why isn't this in place?
+            // LUCENENET specific: MMapIndexInput calls SetBuffers() to populate
+            // the buffers, so we need to skip that call if it is null here, and
+            // do the seek inside SetBuffers()
+            if (buffers != null)
+            {
+                SetBuffers(buffers);
+            }
         }
 
         // LUCENENET specific for encapsulating buffers field.
         internal void SetBuffers(ByteBuffer[] buffers) // necessary for MMapIndexInput
         {
             this.buffers = buffers;
+            Seek(0L);
         }
 
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/d4c0d43c/src/Lucene.Net.Core/Store/MMapDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/MMapDirectory.cs b/src/Lucene.Net.Core/Store/MMapDirectory.cs
index 4bd2868..59307c1 100644
--- a/src/Lucene.Net.Core/Store/MMapDirectory.cs
+++ b/src/Lucene.Net.Core/Store/MMapDirectory.cs
@@ -259,9 +259,6 @@ namespace Lucene.Net.Store
                 this.outerInstance = outerInstance;
                 this.useUnmapHack = outerInstance.UseUnmap;
                 this.SetBuffers(outerInstance.Map(this, fc, 0, fc.Length));
-
-                //Called here to let buffers get set up
-                base.Seek(0L);
             }
 
             public override sealed void Dispose()


Mime
View raw message