Apache Lucene open-source search software
LUCENE-5438: make some APIs public so servers can actually use this feature
Mike McCandless2d07ffd97fb4
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.javaindex 759497a644a..aa66d9fafe2 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;+ }+@Overridepublic 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,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.javaindex 1d04d081c95..8a3f07e4820 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