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
FieldsModifier and TypeFieldDescriptionprotected final Directorystatic longStartup time of original test, carefully propagated to all nodes to produce consistent "seconds since start time" in messagesprotected final intCompact ordinal for this nodeprotected Map<String, FileMetaData> File metadata for last sync that succeeded; we use this as a cachestatic final longWhen this node was startedprotected ReferenceManager<IndexSearcher> static final StringKey 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 PrintStreamFor debug loggingprotected final SearcherFactorystatic final StringKey to store the version in the commit data, which increments every time we open a new NRT reader -
Constructor Summary
ConstructorsConstructorDescriptionNode(int id, Directory dir, SearcherFactory searcherFactory, PrintStream printStream) -
Method Summary
Modifier and TypeMethodDescriptionstatic StringbytesToString(long bytes) abstract voidcommit()longReturns theDirectorythis node is writing toReturns theReferenceManagerto use for acquiring and releasing searchersabstract booleanisClosed()booleanvoidname()static voidnodeMessage(PrintStream printStream, int id, String message) static voidnodeMessage(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.voidsetVerboseFiles(boolean verboseFiles) toString()
-
Field Details
-
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- See Also:
-
VERSION_KEY
Key to store the version in the commit data, which increments every time we open a new NRT reader- See Also:
-
id
protected final int idCompact ordinal for this node -
dir
-
searcherFactory
-
mgr
-
globalStartNS
public static long globalStartNSStartup time of original test, carefully propagated 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 theReferenceManagerto use for acquiring and releasing searchers -
getDirectory
Returns theDirectorythis 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
-
isVerboseFiles
public boolean isVerboseFiles() -
setVerboseFiles
public void setVerboseFiles(boolean verboseFiles)
-