lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [2/2] lucenenet git commit: Cleanup
Date Wed, 04 Feb 2015 09:35:58 GMT
Cleanup


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

Branch: refs/heads/master
Commit: a4e60e32c1c9b9fd442c0946d485af139e014e84
Parents: 16f2d8d
Author: Itamar Syn-Hershko <itamar@code972.com>
Authored: Wed Feb 4 11:35:43 2015 +0200
Committer: Itamar Syn-Hershko <itamar@code972.com>
Committed: Wed Feb 4 11:35:43 2015 +0200

----------------------------------------------------------------------
 src/Lucene.Net.Core/Index/IndexWriter.cs  | 96 +++++++++++++-------------
 src/Lucene.Net.Core/Index/MergePolicy.cs  | 10 +--
 src/Lucene.Net.Core/Index/SegmentInfos.cs |  4 +-
 3 files changed, 55 insertions(+), 55 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4e60e32/src/Lucene.Net.Core/Index/IndexWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/IndexWriter.cs b/src/Lucene.Net.Core/Index/IndexWriter.cs
index b8ac534..151577b 100644
--- a/src/Lucene.Net.Core/Index/IndexWriter.cs
+++ b/src/Lucene.Net.Core/Index/IndexWriter.cs
@@ -247,7 +247,7 @@ namespace Lucene.Net.Index
         internal readonly IndexFileDeleter Deleter;
 
         // used by forceMerge to note those needing merging
-        private IDictionary<SegmentCommitInfo, bool?> SegmentsToMerge = new Dictionary<SegmentCommitInfo,
bool?>();
+        private readonly IDictionary<SegmentCommitInfo, bool?> SegmentsToMerge = new
Dictionary<SegmentCommitInfo, bool?>();
 
         private int MergeMaxNumSegments;
 
@@ -258,12 +258,12 @@ namespace Lucene.Net.Index
 
         // Holds all SegmentInfo instances currently involved in
         // merges
-        private HashSet<SegmentCommitInfo> mergingSegments = new HashSet<SegmentCommitInfo>();
+        private readonly HashSet<SegmentCommitInfo> mergingSegments = new HashSet<SegmentCommitInfo>();
 
-        private MergePolicy mergePolicy;
+        private readonly MergePolicy mergePolicy;
         private readonly MergeScheduler mergeScheduler;
-        private LinkedList<MergePolicy.OneMerge> PendingMerges = new LinkedList<MergePolicy.OneMerge>();
-        private HashSet<MergePolicy.OneMerge> RunningMerges = new HashSet<MergePolicy.OneMerge>();
+        private readonly LinkedList<MergePolicy.OneMerge> PendingMerges = new LinkedList<MergePolicy.OneMerge>();
+        private readonly HashSet<MergePolicy.OneMerge> RunningMerges = new HashSet<MergePolicy.OneMerge>();
         private IList<MergePolicy.OneMerge> MergeExceptions = new List<MergePolicy.OneMerge>();
         private long MergeGen;
         private bool StopMerges;
@@ -4051,9 +4051,9 @@ namespace Lucene.Net.Index
             {
                 if (MergedDeletesAndUpdates_Renamed == null)
                 {
-                    MergedDeletesAndUpdates_Renamed = readerPool.Get(merge.Info_Renamed,
true);
+                    MergedDeletesAndUpdates_Renamed = readerPool.Get(merge.info, true);
                     DocMap = merge.GetDocMap(mergeState);
-                    Debug.Assert(DocMap.IsConsistent(merge.Info_Renamed.Info.DocCount));
+                    Debug.Assert(DocMap.IsConsistent(merge.info.Info.DocCount));
                 }
                 if (initWritableLiveDocs && !InitializedWritableLiveDocs)
                 {
@@ -4285,7 +4285,7 @@ namespace Lucene.Net.Index
                     }
                 }
 
-                Debug.Assert(docUpto == merge.Info_Renamed.Info.DocCount);
+                Debug.Assert(docUpto == merge.info.Info.DocCount);
 
                 if (mergedDVUpdates.Any())
                 {
@@ -4307,7 +4307,7 @@ namespace Lucene.Net.Index
                         if (!success)
                         {
                             holder.MergedDeletesAndUpdates_Renamed.DropChanges();
-                            readerPool.Drop(merge.Info_Renamed);
+                            readerPool.Drop(merge.info);
                         }
                     }
                 }
@@ -4330,7 +4330,7 @@ namespace Lucene.Net.Index
                     }
                 }
 
-                merge.Info_Renamed.BufferedDeletesGen = minGen;
+                merge.info.BufferedDeletesGen = minGen;
 
                 return holder.MergedDeletesAndUpdates_Renamed;
             }
@@ -4375,12 +4375,12 @@ namespace Lucene.Net.Index
                     // so it will be dropped shortly anyway, but not
                     // doing this  makes  MockDirWrapper angry in
                     // TestNRTThreads (LUCENE-5434):
-                    readerPool.Drop(merge.Info_Renamed);
-                    Deleter.DeleteNewFiles(merge.Info_Renamed.Files());
+                    readerPool.Drop(merge.info);
+                    Deleter.DeleteNewFiles(merge.info.Files());
                     return false;
                 }
 
-                ReadersAndUpdates mergedUpdates = merge.Info_Renamed.Info.DocCount == 0 ?
null : CommitMergedDeletesAndUpdates(merge, mergeState);
+                ReadersAndUpdates mergedUpdates = merge.info.Info.DocCount == 0 ? null :
CommitMergedDeletesAndUpdates(merge, mergeState);
                 //    System.out.println("[" + Thread.currentThread().getName() + "] IW.commitMerge:
mergedDeletes=" + mergedDeletes);
 
                 // If the doc store we are using has been closed and
@@ -4388,15 +4388,15 @@ namespace Lucene.Net.Index
                 // started), then we will switch to the compound
                 // format as well:
 
-                Debug.Assert(!segmentInfos.Contains(merge.Info_Renamed));
+                Debug.Assert(!segmentInfos.Contains(merge.info));
 
-                bool allDeleted = merge.Segments.Count == 0 || merge.Info_Renamed.Info.DocCount
== 0 || (mergedUpdates != null && mergedUpdates.PendingDeleteCount == merge.Info_Renamed.Info.DocCount);
+                bool allDeleted = merge.Segments.Count == 0 || merge.info.Info.DocCount ==
0 || (mergedUpdates != null && mergedUpdates.PendingDeleteCount == merge.info.Info.DocCount);
 
                 if (infoStream.IsEnabled("IW"))
                 {
                     if (allDeleted)
                     {
-                        infoStream.Message("IW", "merged segment " + merge.Info_Renamed +
" is 100% deleted" + (KeepFullyDeletedSegments_Renamed ? "" : "; skipping insert"));
+                        infoStream.Message("IW", "merged segment " + merge.info + " is 100%
deleted" + (KeepFullyDeletedSegments_Renamed ? "" : "; skipping insert"));
                     }
                 }
 
@@ -4406,7 +4406,7 @@ namespace Lucene.Net.Index
                 // the new segment:
                 Debug.Assert(merge.Segments.Count > 0 || dropSegment);
 
-                Debug.Assert(merge.Info_Renamed.Info.DocCount != 0 || KeepFullyDeletedSegments_Renamed
|| dropSegment);
+                Debug.Assert(merge.info.Info.DocCount != 0 || KeepFullyDeletedSegments_Renamed
|| dropSegment);
 
                 if (mergedUpdates != null)
                 {
@@ -4428,7 +4428,7 @@ namespace Lucene.Net.Index
                         if (!success)
                         {
                             mergedUpdates.DropChanges();
-                            readerPool.Drop(merge.Info_Renamed);
+                            readerPool.Drop(merge.info);
                         }
                     }
                 }
@@ -4441,9 +4441,9 @@ namespace Lucene.Net.Index
 
                 if (dropSegment)
                 {
-                    Debug.Assert(!segmentInfos.Contains(merge.Info_Renamed));
-                    readerPool.Drop(merge.Info_Renamed);
-                    Deleter.DeleteNewFiles(merge.Info_Renamed.Files());
+                    Debug.Assert(!segmentInfos.Contains(merge.info));
+                    readerPool.Drop(merge.info);
+                    Deleter.DeleteNewFiles(merge.info.Files());
                 }
 
                 bool success_ = false;
@@ -4487,9 +4487,9 @@ namespace Lucene.Net.Index
                 if (merge.MaxNumSegments != -1 && !dropSegment)
                 {
                     // cascade the forceMerge:
-                    if (!SegmentsToMerge.ContainsKey(merge.Info_Renamed))
+                    if (!SegmentsToMerge.ContainsKey(merge.info))
                     {
-                        SegmentsToMerge[merge.Info_Renamed] = false;
+                        SegmentsToMerge[merge.info] = false;
                     }
                 }
 
@@ -4578,9 +4578,9 @@ namespace Lucene.Net.Index
                             {
                                 infoStream.Message("IW", "hit exception during merge");
                             }
-                            if (merge.Info_Renamed != null && !segmentInfos.Contains(merge.Info_Renamed))
+                            if (merge.info != null && !segmentInfos.Contains(merge.info))
                             {
-                                Deleter.Refresh(merge.Info_Renamed.Info.Name);
+                                Deleter.Refresh(merge.info.Info.Name);
                             }
                         }
 
@@ -4598,11 +4598,11 @@ namespace Lucene.Net.Index
             {
                 HandleOOM(oom, "merge");
             }
-            if (merge.Info_Renamed != null && !merge.Aborted)
+            if (merge.info != null && !merge.Aborted)
             {
                 if (infoStream.IsEnabled("IW"))
                 {
-                    infoStream.Message("IW", "merge time " + (DateTime.Now.Millisecond -
t0) + " msec for " + merge.Info_Renamed.Info.DocCount + " docs");
+                    infoStream.Message("IW", "merge time " + (DateTime.Now.Millisecond -
t0) + " msec for " + merge.info.Info.DocCount + " docs");
                 }
             }
         }
@@ -4769,7 +4769,7 @@ namespace Lucene.Net.Index
                     throw new InvalidOperationException("this writer hit an OutOfMemoryError;
cannot merge");
                 }
 
-                if (merge.Info_Renamed != null)
+                if (merge.info != null)
                 {
                     // mergeInit already done
                     return;
@@ -4830,7 +4830,7 @@ namespace Lucene.Net.Index
 
                 if (infoStream.IsEnabled("IW"))
                 {
-                    infoStream.Message("IW", "merge seg=" + merge.Info_Renamed.Info.Name
+ " " + SegString(merge.Segments));
+                    infoStream.Message("IW", "merge seg=" + merge.info.Info.Name + " " +
SegString(merge.Segments));
                 }
             }
         }
@@ -4948,7 +4948,7 @@ namespace Lucene.Net.Index
         {
             merge.CheckAborted(directory);
 
-            string mergedName = merge.Info_Renamed.Info.Name;
+            string mergedName = merge.info.Info.Name;
 
             IList<SegmentCommitInfo> sourceSegments = merge.Segments;
 
@@ -5047,7 +5047,7 @@ namespace Lucene.Net.Index
 
                 // we pass merge.getMergeReaders() instead of merge.readers to allow the
                 // OneMerge to return a view over the actual segments to merge
-                SegmentMerger merger = new SegmentMerger(merge.MergeReaders, merge.Info_Renamed.Info,
infoStream, dirWrapper, Config_Renamed.TermIndexInterval, checkAbort, GlobalFieldNumberMap,
context, Config_Renamed.CheckIntegrityAtMerge);
+                SegmentMerger merger = new SegmentMerger(merge.MergeReaders, merge.info.Info,
infoStream, dirWrapper, Config_Renamed.TermIndexInterval, checkAbort, GlobalFieldNumberMap,
context, Config_Renamed.CheckIntegrityAtMerge);
 
                 merge.CheckAborted(directory);
 
@@ -5059,7 +5059,7 @@ namespace Lucene.Net.Index
                     if (!merger.ShouldMerge())
                     {
                         // would result in a 0 document segment: nothing to merge!
-                        mergeState = new MergeState(new List<AtomicReader>(), merge.Info_Renamed.Info,
infoStream, checkAbort);
+                        mergeState = new MergeState(new List<AtomicReader>(), merge.info.Info,
infoStream, checkAbort);
                     }
                     else
                     {
@@ -5073,24 +5073,24 @@ namespace Lucene.Net.Index
                     {
                         lock (this)
                         {
-                            Deleter.Refresh(merge.Info_Renamed.Info.Name);
+                            Deleter.Refresh(merge.info.Info.Name);
                         }
                     }
                 }
-                Debug.Assert(mergeState.SegmentInfo == merge.Info_Renamed.Info);
-                merge.Info_Renamed.Info.Files = new HashSet<string>(dirWrapper.CreatedFiles);
+                Debug.Assert(mergeState.SegmentInfo == merge.info.Info);
+                merge.info.Info.Files = new HashSet<string>(dirWrapper.CreatedFiles);
 
                 // Record which codec was used to write the segment
 
                 if (infoStream.IsEnabled("IW"))
                 {
-                    if (merge.Info_Renamed.Info.DocCount == 0)
+                    if (merge.info.Info.DocCount == 0)
                     {
                         infoStream.Message("IW", "merge away fully deleted segments");
                     }
                     else
                     {
-                        infoStream.Message("IW", "merge codec=" + Codec + " docCount=" +
merge.Info_Renamed.Info.DocCount + "; merged segment has " + (mergeState.FieldInfos.HasVectors()
? "vectors" : "no vectors") + "; " + (mergeState.FieldInfos.HasNorms() ? "norms" : "no norms")
+ "; " + (mergeState.FieldInfos.HasDocValues() ? "docValues" : "no docValues") + "; " + (mergeState.FieldInfos.HasProx()
? "prox" : "no prox") + "; " + (mergeState.FieldInfos.HasProx() ? "freqs" : "no freqs"));
+                        infoStream.Message("IW", "merge codec=" + Codec + " docCount=" +
merge.info.Info.DocCount + "; merged segment has " + (mergeState.FieldInfos.HasVectors() ?
"vectors" : "no vectors") + "; " + (mergeState.FieldInfos.HasNorms() ? "norms" : "no norms")
+ "; " + (mergeState.FieldInfos.HasDocValues() ? "docValues" : "no docValues") + "; " + (mergeState.FieldInfos.HasProx()
? "prox" : "no prox") + "; " + (mergeState.FieldInfos.HasProx() ? "freqs" : "no freqs"));
                     }
                 }
 
@@ -5101,18 +5101,18 @@ namespace Lucene.Net.Index
                 bool useCompoundFile;
                 lock (this) // Guard segmentInfos
                 {
-                    useCompoundFile = mergePolicy.UseCompoundFile(segmentInfos, merge.Info_Renamed);
+                    useCompoundFile = mergePolicy.UseCompoundFile(segmentInfos, merge.info);
                 }
 
                 if (useCompoundFile)
                 {
                     success = false;
 
-                    ICollection<string> filesToRemove = merge.Info_Renamed.Files();
+                    ICollection<string> filesToRemove = merge.info.Files();
 
                     try
                     {
-                        filesToRemove = CreateCompoundFile(infoStream, directory, checkAbort,
merge.Info_Renamed.Info, context);
+                        filesToRemove = CreateCompoundFile(infoStream, directory, checkAbort,
merge.info.Info, context);
                         success = true;
                     }
                     catch (System.IO.IOException ioe)
@@ -5148,7 +5148,7 @@ namespace Lucene.Net.Index
                             {
                                 Deleter.DeleteFile(Lucene.Net.Index.IndexFileNames.SegmentFileName(mergedName,
"", Lucene.Net.Index.IndexFileNames.COMPOUND_FILE_EXTENSION));
                                 Deleter.DeleteFile(Lucene.Net.Index.IndexFileNames.SegmentFileName(mergedName,
"", Lucene.Net.Index.IndexFileNames.COMPOUND_FILE_ENTRIES_EXTENSION));
-                                Deleter.DeleteNewFiles(merge.Info_Renamed.Files());
+                                Deleter.DeleteNewFiles(merge.info.Files());
                             }
                         }
                     }
@@ -5176,7 +5176,7 @@ namespace Lucene.Net.Index
                         }
                     }
 
-                    merge.Info_Renamed.Info.UseCompoundFile = true;
+                    merge.info.Info.UseCompoundFile = true;
                 }
                 else
                 {
@@ -5193,7 +5193,7 @@ namespace Lucene.Net.Index
                 bool success2 = false;
                 try
                 {
-                    Codec.SegmentInfoFormat().SegmentInfoWriter.Write(directory, merge.Info_Renamed.Info,
mergeState.FieldInfos, context);
+                    Codec.SegmentInfoFormat().SegmentInfoWriter.Write(directory, merge.info.Info,
mergeState.FieldInfos, context);
                     success2 = true;
                 }
                 finally
@@ -5202,7 +5202,7 @@ namespace Lucene.Net.Index
                     {
                         lock (this)
                         {
-                            Deleter.DeleteNewFiles(merge.Info_Renamed.Files());
+                            Deleter.DeleteNewFiles(merge.info.Files());
                         }
                     }
                 }
@@ -5213,13 +5213,13 @@ namespace Lucene.Net.Index
 
                 if (infoStream.IsEnabled("IW"))
                 {
-                    infoStream.Message("IW", string.Format(CultureInfo.InvariantCulture,
"merged segment size=%.3f MB vs estimate=%.3f MB", merge.Info_Renamed.SizeInBytes() / 1024.0
/ 1024.0, merge.EstimatedMergeBytes / 1024 / 1024.0));
+                    infoStream.Message("IW", string.Format(CultureInfo.InvariantCulture,
"merged segment size=%.3f MB vs estimate=%.3f MB", merge.info.SizeInBytes() / 1024.0 / 1024.0,
merge.EstimatedMergeBytes / 1024 / 1024.0));
                 }
 
                 IndexReaderWarmer mergedSegmentWarmer = Config_Renamed.MergedSegmentWarmer;
-                if (PoolReaders && mergedSegmentWarmer != null && merge.Info_Renamed.Info.DocCount
!= 0)
+                if (PoolReaders && mergedSegmentWarmer != null && merge.info.Info.DocCount
!= 0)
                 {
-                    ReadersAndUpdates rld = readerPool.Get(merge.Info_Renamed, true);
+                    ReadersAndUpdates rld = readerPool.Get(merge.info, true);
                     SegmentReader sr = rld.GetReader(IOContext.READ);
                     try
                     {
@@ -5256,7 +5256,7 @@ namespace Lucene.Net.Index
                 }
             }
 
-            return merge.Info_Renamed.Info.DocCount;
+            return merge.info.Info.DocCount;
         }
 
         internal virtual void AddMergeException(MergePolicy.OneMerge merge)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4e60e32/src/Lucene.Net.Core/Index/MergePolicy.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/MergePolicy.cs b/src/Lucene.Net.Core/Index/MergePolicy.cs
index 1b98ce4..b48a55b 100644
--- a/src/Lucene.Net.Core/Index/MergePolicy.cs
+++ b/src/Lucene.Net.Core/Index/MergePolicy.cs
@@ -108,7 +108,7 @@ namespace Lucene.Net.Index
 
         public class OneMerge
         {
-            internal SegmentCommitInfo Info_Renamed; // used by IndexWriter
+            internal SegmentCommitInfo info; // used by IndexWriter
             internal bool RegisterDone; // used by IndexWriter
             internal long MergeGen; // used by IndexWriter
             internal bool IsExternal; // used by IndexWriter
@@ -191,11 +191,11 @@ namespace Lucene.Net.Index
             {
                 set
                 {
-                    this.Info_Renamed = value;
+                    this.info = value;
                 }
                 get
                 {
-                    return Info_Renamed;
+                    return info;
                 }
             }
 
@@ -352,9 +352,9 @@ namespace Lucene.Net.Index
                     }
                     b.Append(Segments[i].ToString(dir, 0));
                 }
-                if (Info_Renamed != null)
+                if (info != null)
                 {
-                    b.Append(" into ").Append(Info_Renamed.Info.Name);
+                    b.Append(" into ").Append(info.Info.Name);
                 }
                 if (MaxNumSegments != -1)
                 {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4e60e32/src/Lucene.Net.Core/Index/SegmentInfos.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/SegmentInfos.cs b/src/Lucene.Net.Core/Index/SegmentInfos.cs
index 87c25ac..cb0e970 100644
--- a/src/Lucene.Net.Core/Index/SegmentInfos.cs
+++ b/src/Lucene.Net.Core/Index/SegmentInfos.cs
@@ -1363,7 +1363,7 @@ namespace Lucene.Net.Index
                 {
                     if (!inserted && !dropSegment)
                     {
-                        segments[segIdx] = merge.Info_Renamed;
+                        segments[segIdx] = merge.info;
                         inserted = true;
                         newSegIdx++;
                     }
@@ -1385,7 +1385,7 @@ namespace Lucene.Net.Index
             // we insert it at the beginning if it should not be dropped:
             if (!inserted && !dropSegment)
             {
-                segments.Insert(0, merge.Info_Renamed);
+                segments.Insert(0, merge.info);
             }
         }
 


Mime
View raw message