public abstract class ReplicaNode extends Node
Modifier and Type | Field and Description |
---|---|
protected CopyJob |
curNRTCopy
Non-null when we are currently copying files from a new NRT point:
|
protected Collection<String> |
lastNRTFiles
IncRef'd files in the current NRT point:
|
protected long |
lastPrimaryGen
Primary gen last time we successfully replicated:
|
protected Set<CopyJob> |
mergeCopyJobs
Currently running merge pre-copy jobs
|
dir, globalStartNS, id, lastFileMetaData, localStartNS, mgr, PRIMARY_GEN_KEY, printStream, searcherFactory, VERBOSE_CONNECTIONS, VERBOSE_FILES, VERSION_KEY
Constructor and Description |
---|
ReplicaNode(int id,
Directory dir,
SearcherFactory searcherFactory,
PrintStream printStream) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
commit() |
IndexOutput |
createTempOutput(String prefix,
String suffix,
IOContext ioContext) |
void |
finishCopyFile(String name) |
List<Map.Entry<String,FileMetaData>> |
getFilesToCopy(Map<String,FileMetaData> files)
Compares incoming per-file identity (id, checksum, header, footer) versus what we have locally and returns the subset of the incoming
files that need copying
|
boolean |
isClosed() |
boolean |
isCopying() |
protected abstract void |
launch(CopyJob job)
Runs this job async'd
|
protected CopyJob |
launchPreCopyMerge(AtomicBoolean finished,
long newPrimaryGen,
Map<String,FileMetaData> files) |
protected void |
maybeNewPrimary(long newPrimaryGen)
Called when the primary changed
|
protected abstract CopyJob |
newCopyJob(String reason,
Map<String,FileMetaData> files,
Map<String,FileMetaData> prevFiles,
boolean highPriority,
CopyJob.OnceDone onceDone)
Start a background copying job, to copy the specified files from the current primary node.
|
CopyJob |
newNRTPoint(long newPrimaryGen,
long version)
Call this to notify this replica node that a new NRT infos is available on the primary.
|
protected abstract void |
sendNewReplica()
Tell primary we (replica) just started, so primary can tell us to warm any already warming merges.
|
protected void |
start(long curPrimaryGen)
Start up this replica, which possibly requires heavy copying of files from the primary node, if we were down for a long time
|
void |
startCopyFile(String name) |
bytesToString, getCurrentSearchingVersion, getDirectory, getSearcherManager, message, name, nodeMessage, nodeMessage, readLocalFileMetaData, toString
protected final Collection<String> lastNRTFiles
protected CopyJob curNRTCopy
protected long lastPrimaryGen
public ReplicaNode(int id, Directory dir, SearcherFactory searcherFactory, PrintStream printStream) throws IOException
IOException
protected void start(long curPrimaryGen) throws IOException
IOException
public void commit() throws IOException
commit
in class Node
IOException
protected abstract CopyJob newCopyJob(String reason, Map<String,FileMetaData> files, Map<String,FileMetaData> prevFiles, boolean highPriority, CopyJob.OnceDone onceDone) throws IOException
IOException
protected abstract void launch(CopyJob job)
protected abstract void sendNewReplica() throws IOException
IOException
public CopyJob newNRTPoint(long newPrimaryGen, long version) throws IOException
IOException
public boolean isCopying()
public void close() throws IOException
IOException
protected void maybeNewPrimary(long newPrimaryGen) throws IOException
IOException
protected CopyJob launchPreCopyMerge(AtomicBoolean finished, long newPrimaryGen, Map<String,FileMetaData> files) throws IOException
IOException
public IndexOutput createTempOutput(String prefix, String suffix, IOContext ioContext) throws IOException
IOException
public List<Map.Entry<String,FileMetaData>> getFilesToCopy(Map<String,FileMetaData> files) throws IOException
IOException
public void startCopyFile(String name)
public void finishCopyFile(String name)
Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.