Class ReplicationWorker
- java.lang.Object
-
- org.apache.bookkeeper.replication.ReplicationWorker
-
- All Implemented Interfaces:
java.lang.Runnable
@StatsDoc(name="replication_worker", help="replication worker related stats") public class ReplicationWorker extends java.lang.Object implements java.lang.Runnable
ReplicationWorker will take the fragments one by one from ZKLedgerUnderreplicationManager and replicates to it.
-
-
Field Summary
Fields Modifier and Type Field Description static int
NUM_OF_EXPONENTIAL_BACKOFF_RETRIALS
(package private) com.google.common.cache.LoadingCache<java.lang.Long,java.util.concurrent.atomic.AtomicInteger>
replicationFailedLedgers
(package private) com.google.common.cache.LoadingCache<java.lang.Long,java.util.concurrent.ConcurrentSkipListSet<java.lang.Long>>
unableToReadEntriesForReplication
-
Constructor Summary
Constructors Constructor Description ReplicationWorker(ServerConfiguration conf)
Replication 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) java.util.Set<LedgerFragment>
getUnderreplicatedFragments(LedgerHandle lh, java.lang.Long ledgerVerificationPercentage)
Gets the under replicated fragments.boolean
isRunning()
Gives the running status of ReplicationWorker.void
run()
(package private) void
scheduleTaskWithDelay(java.util.TimerTask timerTask, long delayPeriod)
void
shutdown()
Stop the replication worker service.void
start()
Start the replication worker.
-
-
-
Field Detail
-
NUM_OF_EXPONENTIAL_BACKOFF_RETRIALS
public static final int NUM_OF_EXPONENTIAL_BACKOFF_RETRIALS
- See Also:
- Constant Field Values
-
replicationFailedLedgers
final com.google.common.cache.LoadingCache<java.lang.Long,java.util.concurrent.atomic.AtomicInteger> replicationFailedLedgers
-
unableToReadEntriesForReplication
final com.google.common.cache.LoadingCache<java.lang.Long,java.util.concurrent.ConcurrentSkipListSet<java.lang.Long>> unableToReadEntriesForReplication
-
-
Constructor Detail
-
ReplicationWorker
public ReplicationWorker(ServerConfiguration conf) throws ReplicationException.CompatibilityException, ReplicationException.UnavailableException, java.lang.InterruptedException, java.io.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.CompatibilityException
ReplicationException.UnavailableException
java.lang.InterruptedException
java.io.IOException
-
ReplicationWorker
public ReplicationWorker(ServerConfiguration conf, StatsLogger statsLogger) throws ReplicationException.CompatibilityException, ReplicationException.UnavailableException, java.lang.InterruptedException, java.io.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.CompatibilityException
ReplicationException.UnavailableException
java.lang.InterruptedException
java.io.IOException
-
ReplicationWorker
ReplicationWorker(ServerConfiguration conf, BookKeeper bkc, boolean ownBkc, StatsLogger statsLogger) throws ReplicationException.CompatibilityException, java.lang.InterruptedException, ReplicationException.UnavailableException
- Throws:
ReplicationException.CompatibilityException
java.lang.InterruptedException
ReplicationException.UnavailableException
-
-
Method Detail
-
start
public void start()
Start the replication worker.
-
run
public void run()
- Specified by:
run
in interfacejava.lang.Runnable
-
getUnderreplicatedFragments
java.util.Set<LedgerFragment> getUnderreplicatedFragments(LedgerHandle lh, java.lang.Long ledgerVerificationPercentage) throws java.lang.InterruptedException
Gets the under replicated fragments.- Throws:
java.lang.InterruptedException
-
scheduleTaskWithDelay
void scheduleTaskWithDelay(java.util.TimerTask timerTask, long delayPeriod)
-
shutdown
public void shutdown()
Stop the replication worker service.
-
isRunning
public boolean isRunning()
Gives the running status of ReplicationWorker.
-
-