You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sa...@apache.org on 2016/08/02 01:07:32 UTC

[12/40] lucene-solr:apiv2: LUCENE-5438: make some APIs public so servers can actually use this feature

LUCENE-5438: make some APIs public so servers can actually use this feature


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/2d07ffd9
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/2d07ffd9
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/2d07ffd9

Branch: refs/heads/apiv2
Commit: 2d07ffd97fb4aec2a11aeddab40490044f3c2b49
Parents: 4c61d5a
Author: Mike McCandless <mi...@apache.org>
Authored: Mon Jul 25 06:00:11 2016 -0400
Committer: Mike McCandless <mi...@apache.org>
Committed: Mon Jul 25 06:00:37 2016 -0400

----------------------------------------------------------------------
 .../org/apache/lucene/replicator/nrt/Node.java   | 19 +++++++++++++++----
 .../lucene/replicator/nrt/PrimaryNode.java       |  5 +++++
 2 files changed, 20 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/2d07ffd9/lucene/replicator/src/java/org/apache/lucene/replicator/nrt/Node.java
----------------------------------------------------------------------
diff --git a/lucene/replicator/src/java/org/apache/lucene/replicator/nrt/Node.java b/lucene/replicator/src/java/org/apache/lucene/replicator/nrt/Node.java
index 759497a..aa66d9f 100644
--- a/lucene/replicator/src/java/org/apache/lucene/replicator/nrt/Node.java
+++ b/lucene/replicator/src/java/org/apache/lucene/replicator/nrt/Node.java
@@ -25,6 +25,7 @@ import java.io.PrintStream;
 import java.nio.file.NoSuchFileException;
 import java.util.Locale;
 import java.util.Map;
+
 import org.apache.lucene.codecs.CodecUtil;
 import org.apache.lucene.index.CorruptIndexException;
 import org.apache.lucene.index.DirectoryReader;
@@ -39,10 +40,10 @@ import org.apache.lucene.store.IndexInput;
  *
  * @lucene.experimental */
 
-abstract class Node implements Closeable {
+public abstract class Node implements Closeable {
 
-  static boolean VERBOSE_FILES = true;
-  static boolean VERBOSE_CONNECTIONS = false;
+  public static boolean VERBOSE_FILES = true;
+  public static boolean VERBOSE_CONNECTIONS = false;
 
   // Keys we store into IndexWriter's commit user data:
 
@@ -87,6 +88,16 @@ abstract class Node implements Closeable {
     this.printStream = printStream;
   }
 
+  /** Returns the {@link ReferenceManager} to use for acquiring and releasing searchers */
+  public ReferenceManager<IndexSearcher> getSearcherManager() {
+    return mgr;
+  }
+
+  /** Returns the {@link Directory} this node is writing to */
+  public Directory getDirectory() {
+    return dir;
+  }
+
   @Override
   public String toString() {
     return getClass().getSimpleName() + "(id=" + id + ")";
@@ -119,7 +130,7 @@ abstract class Node implements Closeable {
     }
   }
 
-  protected void message(String message) {
+  public void message(String message) {
     if (printStream != null) {
       long now = System.nanoTime();
       printStream.println(String.format(Locale.ROOT,

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/2d07ffd9/lucene/replicator/src/java/org/apache/lucene/replicator/nrt/PrimaryNode.java
----------------------------------------------------------------------
diff --git a/lucene/replicator/src/java/org/apache/lucene/replicator/nrt/PrimaryNode.java b/lucene/replicator/src/java/org/apache/lucene/replicator/nrt/PrimaryNode.java
index 1d04d08..8a3f07e 100644
--- a/lucene/replicator/src/java/org/apache/lucene/replicator/nrt/PrimaryNode.java
+++ b/lucene/replicator/src/java/org/apache/lucene/replicator/nrt/PrimaryNode.java
@@ -128,6 +128,11 @@ public abstract class PrimaryNode extends Node {
     }
   }
 
+  /** Returns the current primary generation, which is incremented each time a new primary is started for this index */
+  public long getPrimaryGen() {
+    return primaryGen;
+  }
+
   // TODO: in the future, we should separate "flush" (returns an incRef'd SegmentInfos) from "refresh" (open new NRT reader from
   // IndexWriter) so that the latter can be done concurrently while copying files out to replicas, minimizing the refresh time from the
   // replicas.  But fixing this is tricky because e.g. IndexWriter may complete a big merge just after returning the incRef'd SegmentInfos