Package org.apache.lucene.replicator.nrt
Class Node
java.lang.Object
org.apache.lucene.replicator.nrt.Node
- All Implemented Interfaces:
Closeable
,AutoCloseable
- Direct Known Subclasses:
PrimaryNode
,ReplicaNode
Common base class for
PrimaryNode
and ReplicaNode
.- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
Field Summary
Modifier and TypeFieldDescriptionprotected final Directory
static long
Startup time of original test, carefully propogated to all nodes to produce consistent "seconds since start time" in messagesprotected final int
Compact ordinal for this nodeprotected Map<String,
FileMetaData> File metadata for last sync that succeeded; we use this as a cachestatic final long
When this node was startedprotected ReferenceManager<IndexSearcher>
static String
Key to store the primary gen in the commit data, which increments every time we promote a new primary, so replicas can detect when the primary they were talking to is changedprotected final PrintStream
For debug loggingprotected final SearcherFactory
static boolean
static boolean
static String
Key to store the version in the commit data, which increments every time we open a new NRT reader -
Constructor Summary
ConstructorDescriptionNode
(int id, Directory dir, SearcherFactory searcherFactory, PrintStream printStream) -
Method Summary
Modifier and TypeMethodDescriptionstatic String
bytesToString
(long bytes) abstract void
commit()
long
Returns theDirectory
this node is writing toReturns theReferenceManager
to use for acquiring and releasing searchersabstract boolean
isClosed()
void
name()
static void
nodeMessage
(PrintStream printStream, int id, String message) static void
nodeMessage
(PrintStream printStream, String message) readLocalFileMetaData
(String fileName) Opens the specified file, reads its identifying information, including file length, full index header (includes the unique segment ID) and the full footer (includes checksum), and returns the resultingFileMetaData
.toString()
-
Field Details
-
VERBOSE_FILES
public static boolean VERBOSE_FILES -
VERBOSE_CONNECTIONS
public static boolean VERBOSE_CONNECTIONS -
PRIMARY_GEN_KEY
Key to store the primary gen in the commit data, which increments every time we promote a new primary, so replicas can detect when the primary they were talking to is changed -
VERSION_KEY
Key to store the version in the commit data, which increments every time we open a new NRT reader -
id
protected final int idCompact ordinal for this node -
dir
-
searcherFactory
-
mgr
-
globalStartNS
public static long globalStartNSStartup time of original test, carefully propogated to all nodes to produce consistent "seconds since start time" in messages -
localStartNS
public static final long localStartNSWhen this node was started -
printStream
For debug logging -
lastFileMetaData
File metadata for last sync that succeeded; we use this as a cache
-
-
Constructor Details
-
Node
-
-
Method Details
-
getSearcherManager
Returns theReferenceManager
to use for acquiring and releasing searchers -
getDirectory
Returns theDirectory
this node is writing to -
toString
-
commit
- Throws:
IOException
-
nodeMessage
-
nodeMessage
-
message
-
name
-
isClosed
public abstract boolean isClosed() -
getCurrentSearchingVersion
- Throws:
IOException
-
bytesToString
-
readLocalFileMetaData
Opens the specified file, reads its identifying information, including file length, full index header (includes the unique segment ID) and the full footer (includes checksum), and returns the resultingFileMetaData
.This returns null, logging a message, if there are any problems (the file does not exist, is corrupt, truncated, etc.).
- Throws:
IOException
-