Class ReplicationWorker
java.lang.Object
org.apache.bookkeeper.replication.ReplicationWorker
- All Implemented Interfaces:
Runnable
@StatsDoc(name="replication_worker",
help="replication worker related stats")
public class ReplicationWorker
extends Object
implements Runnable
ReplicationWorker will take the fragments one by one from
ZKLedgerUnderreplicationManager and replicates to it.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int(package private) final com.google.common.cache.LoadingCache<Long,AtomicInteger> (package private) final com.google.common.cache.LoadingCache<Long,ConcurrentSkipListSet<Long>> -
Constructor Summary
ConstructorsConstructorDescriptionReplication worker for replicating the ledger fragments from UnderReplicationManager to the targetBookie.ReplicationWorker(ServerConfiguration conf, BookKeeper bkc, boolean ownBkc, StatsLogger statsLogger) ReplicationWorker(ServerConfiguration conf, StatsLogger statsLogger) Replication worker for replicating the ledger fragments from UnderReplicationManager to the targetBookie. -
Method Summary
Modifier and TypeMethodDescription(package private) Set<LedgerFragment>getUnderreplicatedFragments(LedgerHandle lh, Long ledgerVerificationPercentage) Gets the under replicated fragments.booleanGives the running status of ReplicationWorker.voidrun()(package private) voidscheduleTaskWithDelay(TimerTask timerTask, long delayPeriod) voidshutdown()Stop the replication worker service.voidstart()Start the replication worker.
-
Field Details
-
NUM_OF_EXPONENTIAL_BACKOFF_RETRIALS
public static final int NUM_OF_EXPONENTIAL_BACKOFF_RETRIALS- See Also:
-
replicationFailedLedgers
-
unableToReadEntriesForReplication
final com.google.common.cache.LoadingCache<Long,ConcurrentSkipListSet<Long>> unableToReadEntriesForReplication
-
-
Constructor Details
-
ReplicationWorker
public ReplicationWorker(ServerConfiguration conf) throws ReplicationException.CompatibilityException, ReplicationException.UnavailableException, InterruptedException, IOException Replication worker for replicating the ledger fragments from UnderReplicationManager to the targetBookie. This target bookie will be a local bookie.- Parameters:
conf- - configurations- Throws:
ReplicationException.CompatibilityExceptionReplicationException.UnavailableExceptionInterruptedExceptionIOException
-
ReplicationWorker
public ReplicationWorker(ServerConfiguration conf, StatsLogger statsLogger) throws ReplicationException.CompatibilityException, ReplicationException.UnavailableException, InterruptedException, IOException Replication worker for replicating the ledger fragments from UnderReplicationManager to the targetBookie. This target bookie will be a local bookie.- Parameters:
conf- - configurationsstatsLogger- - stats logger- Throws:
ReplicationException.CompatibilityExceptionReplicationException.UnavailableExceptionInterruptedExceptionIOException
-
ReplicationWorker
ReplicationWorker(ServerConfiguration conf, BookKeeper bkc, boolean ownBkc, StatsLogger statsLogger) throws ReplicationException.CompatibilityException, InterruptedException, ReplicationException.UnavailableException
-
-
Method Details
-
start
public void start()Start the replication worker. -
run
public void run() -
getUnderreplicatedFragments
Set<LedgerFragment> getUnderreplicatedFragments(LedgerHandle lh, Long ledgerVerificationPercentage) throws InterruptedException Gets the under replicated fragments.- Throws:
InterruptedException
-
scheduleTaskWithDelay
-
shutdown
public void shutdown()Stop the replication worker service. -
isRunning
public boolean isRunning()Gives the running status of ReplicationWorker.
-