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 java.util.Collection<java.lang.String> |
lastNRTFiles
IncRef'd files in the current NRT point:
|
protected long |
lastPrimaryGen
Primary gen last time we successfully replicated:
|
protected java.util.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,
java.io.PrintStream printStream) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
commit() |
IndexOutput |
createTempOutput(java.lang.String prefix,
java.lang.String suffix,
IOContext ioContext) |
void |
finishCopyFile(java.lang.String name) |
protected void |
finishNRTCopy(CopyJob job,
long startNS) |
java.util.List<java.util.Map.Entry<java.lang.String,FileMetaData>> |
getFilesToCopy(java.util.Map<java.lang.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(java.util.concurrent.atomic.AtomicBoolean finished,
long newPrimaryGen,
java.util.Map<java.lang.String,FileMetaData> files) |
protected void |
maybeNewPrimary(long newPrimaryGen)
Called when the primary changed
|
protected abstract CopyJob |
newCopyJob(java.lang.String reason,
java.util.Map<java.lang.String,FileMetaData> files,
java.util.Map<java.lang.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(java.lang.String name) |
bytesToString, getCurrentSearchingVersion, getDirectory, getSearcherManager, message, name, nodeMessage, nodeMessage, readLocalFileMetaData, toStringprotected final java.util.Collection<java.lang.String> lastNRTFiles
protected final java.util.Set<CopyJob> mergeCopyJobs
protected CopyJob curNRTCopy
protected long lastPrimaryGen
public ReplicaNode(int id,
Directory dir,
SearcherFactory searcherFactory,
java.io.PrintStream printStream)
throws java.io.IOException
java.io.IOExceptionprotected void start(long curPrimaryGen)
throws java.io.IOException
java.io.IOExceptionpublic void commit()
throws java.io.IOException
protected void finishNRTCopy(CopyJob job, long startNS) throws java.io.IOException
java.io.IOExceptionprotected abstract CopyJob newCopyJob(java.lang.String reason, java.util.Map<java.lang.String,FileMetaData> files, java.util.Map<java.lang.String,FileMetaData> prevFiles, boolean highPriority, CopyJob.OnceDone onceDone) throws java.io.IOException
java.io.IOExceptionprotected abstract void launch(CopyJob job)
protected abstract void sendNewReplica()
throws java.io.IOException
java.io.IOExceptionpublic CopyJob newNRTPoint(long newPrimaryGen, long version) throws java.io.IOException
java.io.IOExceptionpublic boolean isCopying()
public void close()
throws java.io.IOException
java.io.IOExceptionprotected void maybeNewPrimary(long newPrimaryGen)
throws java.io.IOException
java.io.IOExceptionprotected CopyJob launchPreCopyMerge(java.util.concurrent.atomic.AtomicBoolean finished, long newPrimaryGen, java.util.Map<java.lang.String,FileMetaData> files) throws java.io.IOException
java.io.IOExceptionpublic IndexOutput createTempOutput(java.lang.String prefix, java.lang.String suffix, IOContext ioContext) throws java.io.IOException
java.io.IOExceptionpublic java.util.List<java.util.Map.Entry<java.lang.String,FileMetaData>> getFilesToCopy(java.util.Map<java.lang.String,FileMetaData> files) throws java.io.IOException
java.io.IOExceptionpublic void startCopyFile(java.lang.String name)
public void finishCopyFile(java.lang.String name)
Copyright © 2000–2025 The Apache Software Foundation. All rights reserved.