public abstract class PrimaryNode
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected Directory |
dir |
static long |
globalStartNS
Startup time of original test, carefully propogated to all nodes to produce consistent "seconds since start time" in messages
|
protected int |
id
Compact ordinal for this node
|
protected java.util.Map<java.lang.String,FileMetaData> |
lastFileMetaData
File metadata for last sync that succeeded; we use this as a cache
|
static long |
localStartNS
When this node was started
|
protected ReferenceManager<IndexSearcher> |
mgr |
static java.lang.String |
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
|
protected long |
primaryGen |
protected java.io.PrintStream |
printStream
For debug logging
|
protected SearcherFactory |
searcherFactory |
static java.lang.String |
VERSION_KEY
Key to store the version in the commit data, which increments every time we open a new NRT reader
|
| Constructor and Description |
|---|
PrimaryNode(IndexWriter writer,
int id,
long primaryGen,
long forcePrimaryVersion,
SearcherFactory searcherFactory,
java.io.PrintStream printStream) |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
bytesToString(long bytes) |
void |
close() |
void |
commit() |
boolean |
flushAndRefresh()
Flush all index operations to disk and opens a new near-real-time reader.
|
CopyState |
getCopyState()
IncRef the current CopyState and return it
|
long |
getCopyStateVersion() |
long |
getCurrentSearchingVersion() |
long |
getLastCommitVersion() |
boolean |
isClosed() |
protected void |
message(java.lang.String message) |
java.lang.String |
name() |
static void |
nodeMessage(java.io.PrintStream printStream,
int id,
java.lang.String message) |
static void |
nodeMessage(java.io.PrintStream printStream,
java.lang.String message) |
protected abstract void |
preCopyMergedSegmentFiles(SegmentCommitInfo info,
java.util.Map<java.lang.String,FileMetaData> files)
Called when a merge has finished, but before IW switches to the merged segment
|
FileMetaData |
readLocalFileMetaData(java.lang.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 resulting
FileMetaData. |
void |
releaseCopyState(CopyState copyState)
Called once replica is done (or failed) copying an NRT point
|
java.lang.String |
toString() |
protected final long primaryGen
public static java.lang.String PRIMARY_GEN_KEY
public static java.lang.String VERSION_KEY
protected final int id
protected final Directory dir
protected final SearcherFactory searcherFactory
protected ReferenceManager<IndexSearcher> mgr
public static long globalStartNS
public static final long localStartNS
protected final java.io.PrintStream printStream
protected volatile java.util.Map<java.lang.String,FileMetaData> lastFileMetaData
public PrimaryNode(IndexWriter writer, int id, long primaryGen, long forcePrimaryVersion, SearcherFactory searcherFactory, java.io.PrintStream printStream) throws java.io.IOException
java.io.IOExceptionpublic boolean flushAndRefresh()
throws java.io.IOException
java.io.IOExceptionpublic long getCopyStateVersion()
public long getLastCommitVersion()
public void commit()
throws java.io.IOException
java.io.IOExceptionpublic CopyState getCopyState() throws java.io.IOException
java.io.IOExceptionpublic void releaseCopyState(CopyState copyState) throws java.io.IOException
java.io.IOExceptionpublic boolean isClosed()
public void close()
throws java.io.IOException
java.io.IOExceptionprotected abstract void preCopyMergedSegmentFiles(SegmentCommitInfo info, java.util.Map<java.lang.String,FileMetaData> files) throws java.io.IOException
java.io.IOExceptionpublic java.lang.String toString()
toString in class java.lang.Objectpublic static void nodeMessage(java.io.PrintStream printStream,
java.lang.String message)
public static void nodeMessage(java.io.PrintStream printStream,
int id,
java.lang.String message)
protected void message(java.lang.String message)
public java.lang.String name()
public long getCurrentSearchingVersion()
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String bytesToString(long bytes)
public FileMetaData readLocalFileMetaData(java.lang.String fileName) throws java.io.IOException
FileMetaData.
This returns null, logging a message, if there are any problems (the file does not exist, is corrupt, truncated, etc.).
java.io.IOExceptionCopyright © 2000–2017 The Apache Software Foundation. All rights reserved.