Class PulsarLedgerUnderreplicationManager
java.lang.Object
org.apache.pulsar.metadata.bookkeeper.PulsarLedgerUnderreplicationManager
- All Implemented Interfaces:
AutoCloseable,org.apache.bookkeeper.meta.LedgerUnderreplicationManager
public class PulsarLedgerUnderreplicationManager
extends Object
implements org.apache.bookkeeper.meta.LedgerUnderreplicationManager
-
Constructor Summary
ConstructorsConstructorDescriptionPulsarLedgerUnderreplicationManager(org.apache.bookkeeper.conf.AbstractConfiguration<?> conf, MetadataStoreExtended store, String ledgerRootPath) -
Method Summary
Modifier and TypeMethodDescriptionvoidacquireUnderreplicatedLedger(long ledgerId) voidclose()voidvoidlonglongorg.apache.bookkeeper.meta.UnderreplicatedLedgergetLedgerUnreplicationInfo(long ledgerId) static byte[]intlonglonggetReplicationWorkerIdRereplicatingLedger(long ledgerId) static StringgetUrLedgerLockPath(String base, long ledgerId) static StringgetUrLedgerPath(String base, long ledgerId) booleaninitializeLostBookieRecoveryDelay(int lostBookieRecoveryDelay) booleanisLedgerBeingReplicated(long ledgerId) Check whether the ledger is being replicated by any bookie.booleanIterator<org.apache.bookkeeper.meta.UnderreplicatedLedger>listLedgersToRereplicate(Predicate<List<String>> predicate) Get a list of all the underreplicated ledgers which have been marked for rereplication, filtered by the predicate on the replicas list.voidmarkLedgerReplicated(long ledgerId) markLedgerUnderreplicatedAsync(long ledgerId, Collection<String> missingReplicas) voidnotifyLedgerReplicationEnabled(org.apache.bookkeeper.proto.BookkeeperInternalCallbacks.GenericCallback<Void> cb) voidnotifyLostBookieRecoveryDelayChanged(org.apache.bookkeeper.proto.BookkeeperInternalCallbacks.GenericCallback<Void> cb) voidnotifyUnderReplicationLedgerChanged(org.apache.bookkeeper.proto.BookkeeperInternalCallbacks.GenericCallback<Void> cb) longvoidreleaseUnderreplicatedLedger(long ledgerId) voidsetCheckAllLedgersCTime(long checkAllLedgersCTime) voidsetLostBookieRecoveryDelay(int lostBookieRecoveryDelay) voidsetPlacementPolicyCheckCTime(long placementPolicyCheckCTime) voidsetReplicasCheckCTime(long replicasCheckCTime) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.bookkeeper.meta.LedgerUnderreplicationManager
markLedgerUnderreplicated
-
Constructor Details
-
PulsarLedgerUnderreplicationManager
public PulsarLedgerUnderreplicationManager(org.apache.bookkeeper.conf.AbstractConfiguration<?> conf, MetadataStoreExtended store, String ledgerRootPath) throws org.apache.bookkeeper.replication.ReplicationException.CompatibilityException - Throws:
org.apache.bookkeeper.replication.ReplicationException.CompatibilityException
-
-
Method Details
-
getLockData
public static byte[] getLockData() -
getUrLedgerPath
-
getUrLedgerLockPath
-
getLedgerUnreplicationInfo
public org.apache.bookkeeper.meta.UnderreplicatedLedger getLedgerUnreplicationInfo(long ledgerId) throws org.apache.bookkeeper.replication.ReplicationException.UnavailableException - Specified by:
getLedgerUnreplicationInfoin interfaceorg.apache.bookkeeper.meta.LedgerUnderreplicationManager- Throws:
org.apache.bookkeeper.replication.ReplicationException.UnavailableException
-
markLedgerUnderreplicatedAsync
public CompletableFuture<Void> markLedgerUnderreplicatedAsync(long ledgerId, Collection<String> missingReplicas) - Specified by:
markLedgerUnderreplicatedAsyncin interfaceorg.apache.bookkeeper.meta.LedgerUnderreplicationManager
-
acquireUnderreplicatedLedger
public void acquireUnderreplicatedLedger(long ledgerId) throws org.apache.bookkeeper.replication.ReplicationException - Specified by:
acquireUnderreplicatedLedgerin interfaceorg.apache.bookkeeper.meta.LedgerUnderreplicationManager- Throws:
org.apache.bookkeeper.replication.ReplicationException
-
markLedgerReplicated
public void markLedgerReplicated(long ledgerId) throws org.apache.bookkeeper.replication.ReplicationException.UnavailableException - Specified by:
markLedgerReplicatedin interfaceorg.apache.bookkeeper.meta.LedgerUnderreplicationManager- Throws:
org.apache.bookkeeper.replication.ReplicationException.UnavailableException
-
listLedgersToRereplicate
public Iterator<org.apache.bookkeeper.meta.UnderreplicatedLedger> listLedgersToRereplicate(Predicate<List<String>> predicate) Get a list of all the underreplicated ledgers which have been marked for rereplication, filtered by the predicate on the replicas list.Replicas list of an underreplicated ledger is the list of the bookies which are part of the ensemble of this ledger and are currently unavailable/down.
- Specified by:
listLedgersToRereplicatein interfaceorg.apache.bookkeeper.meta.LedgerUnderreplicationManager- Parameters:
predicate- filter to use while listing under replicated ledgers. 'null' if filtering is not required.- Returns:
- an iterator which returns underreplicated ledgers.
-
pollLedgerToRereplicate
public long pollLedgerToRereplicate() throws org.apache.bookkeeper.replication.ReplicationException.UnavailableException- Specified by:
pollLedgerToRereplicatein interfaceorg.apache.bookkeeper.meta.LedgerUnderreplicationManager- Throws:
org.apache.bookkeeper.replication.ReplicationException.UnavailableException
-
getLedgerToRereplicate
public long getLedgerToRereplicate() throws org.apache.bookkeeper.replication.ReplicationException.UnavailableException- Specified by:
getLedgerToRereplicatein interfaceorg.apache.bookkeeper.meta.LedgerUnderreplicationManager- Throws:
org.apache.bookkeeper.replication.ReplicationException.UnavailableException
-
releaseUnderreplicatedLedger
public void releaseUnderreplicatedLedger(long ledgerId) throws org.apache.bookkeeper.replication.ReplicationException.UnavailableException - Specified by:
releaseUnderreplicatedLedgerin interfaceorg.apache.bookkeeper.meta.LedgerUnderreplicationManager- Throws:
org.apache.bookkeeper.replication.ReplicationException.UnavailableException
-
close
public void close() throws org.apache.bookkeeper.replication.ReplicationException.UnavailableException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceorg.apache.bookkeeper.meta.LedgerUnderreplicationManager- Throws:
org.apache.bookkeeper.replication.ReplicationException.UnavailableException
-
disableLedgerReplication
public void disableLedgerReplication() throws org.apache.bookkeeper.replication.ReplicationException.UnavailableException- Specified by:
disableLedgerReplicationin interfaceorg.apache.bookkeeper.meta.LedgerUnderreplicationManager- Throws:
org.apache.bookkeeper.replication.ReplicationException.UnavailableException
-
enableLedgerReplication
public void enableLedgerReplication() throws org.apache.bookkeeper.replication.ReplicationException.UnavailableException- Specified by:
enableLedgerReplicationin interfaceorg.apache.bookkeeper.meta.LedgerUnderreplicationManager- Throws:
org.apache.bookkeeper.replication.ReplicationException.UnavailableException
-
isLedgerReplicationEnabled
public boolean isLedgerReplicationEnabled() throws org.apache.bookkeeper.replication.ReplicationException.UnavailableException- Specified by:
isLedgerReplicationEnabledin interfaceorg.apache.bookkeeper.meta.LedgerUnderreplicationManager- Throws:
org.apache.bookkeeper.replication.ReplicationException.UnavailableException
-
notifyLedgerReplicationEnabled
public void notifyLedgerReplicationEnabled(org.apache.bookkeeper.proto.BookkeeperInternalCallbacks.GenericCallback<Void> cb) throws org.apache.bookkeeper.replication.ReplicationException.UnavailableException - Specified by:
notifyLedgerReplicationEnabledin interfaceorg.apache.bookkeeper.meta.LedgerUnderreplicationManager- Throws:
org.apache.bookkeeper.replication.ReplicationException.UnavailableException
-
isLedgerBeingReplicated
public boolean isLedgerBeingReplicated(long ledgerId) throws org.apache.bookkeeper.replication.ReplicationException Check whether the ledger is being replicated by any bookie.- Specified by:
isLedgerBeingReplicatedin interfaceorg.apache.bookkeeper.meta.LedgerUnderreplicationManager- Throws:
org.apache.bookkeeper.replication.ReplicationException
-
initializeLostBookieRecoveryDelay
public boolean initializeLostBookieRecoveryDelay(int lostBookieRecoveryDelay) throws org.apache.bookkeeper.replication.ReplicationException.UnavailableException - Specified by:
initializeLostBookieRecoveryDelayin interfaceorg.apache.bookkeeper.meta.LedgerUnderreplicationManager- Throws:
org.apache.bookkeeper.replication.ReplicationException.UnavailableException
-
setLostBookieRecoveryDelay
public void setLostBookieRecoveryDelay(int lostBookieRecoveryDelay) throws org.apache.bookkeeper.replication.ReplicationException.UnavailableException - Specified by:
setLostBookieRecoveryDelayin interfaceorg.apache.bookkeeper.meta.LedgerUnderreplicationManager- Throws:
org.apache.bookkeeper.replication.ReplicationException.UnavailableException
-
getLostBookieRecoveryDelay
public int getLostBookieRecoveryDelay() throws org.apache.bookkeeper.replication.ReplicationException.UnavailableException- Specified by:
getLostBookieRecoveryDelayin interfaceorg.apache.bookkeeper.meta.LedgerUnderreplicationManager- Throws:
org.apache.bookkeeper.replication.ReplicationException.UnavailableException
-
notifyLostBookieRecoveryDelayChanged
public void notifyLostBookieRecoveryDelayChanged(org.apache.bookkeeper.proto.BookkeeperInternalCallbacks.GenericCallback<Void> cb) throws org.apache.bookkeeper.replication.ReplicationException.UnavailableException - Specified by:
notifyLostBookieRecoveryDelayChangedin interfaceorg.apache.bookkeeper.meta.LedgerUnderreplicationManager- Throws:
org.apache.bookkeeper.replication.ReplicationException.UnavailableException
-
getReplicationWorkerIdRereplicatingLedger
public String getReplicationWorkerIdRereplicatingLedger(long ledgerId) throws org.apache.bookkeeper.replication.ReplicationException.UnavailableException - Specified by:
getReplicationWorkerIdRereplicatingLedgerin interfaceorg.apache.bookkeeper.meta.LedgerUnderreplicationManager- Throws:
org.apache.bookkeeper.replication.ReplicationException.UnavailableException
-
setCheckAllLedgersCTime
public void setCheckAllLedgersCTime(long checkAllLedgersCTime) throws org.apache.bookkeeper.replication.ReplicationException.UnavailableException - Specified by:
setCheckAllLedgersCTimein interfaceorg.apache.bookkeeper.meta.LedgerUnderreplicationManager- Throws:
org.apache.bookkeeper.replication.ReplicationException.UnavailableException
-
getCheckAllLedgersCTime
public long getCheckAllLedgersCTime() throws org.apache.bookkeeper.replication.ReplicationException.UnavailableException- Specified by:
getCheckAllLedgersCTimein interfaceorg.apache.bookkeeper.meta.LedgerUnderreplicationManager- Throws:
org.apache.bookkeeper.replication.ReplicationException.UnavailableException
-
setPlacementPolicyCheckCTime
public void setPlacementPolicyCheckCTime(long placementPolicyCheckCTime) throws org.apache.bookkeeper.replication.ReplicationException.UnavailableException - Specified by:
setPlacementPolicyCheckCTimein interfaceorg.apache.bookkeeper.meta.LedgerUnderreplicationManager- Throws:
org.apache.bookkeeper.replication.ReplicationException.UnavailableException
-
getPlacementPolicyCheckCTime
public long getPlacementPolicyCheckCTime() throws org.apache.bookkeeper.replication.ReplicationException.UnavailableException- Specified by:
getPlacementPolicyCheckCTimein interfaceorg.apache.bookkeeper.meta.LedgerUnderreplicationManager- Throws:
org.apache.bookkeeper.replication.ReplicationException.UnavailableException
-
setReplicasCheckCTime
public void setReplicasCheckCTime(long replicasCheckCTime) throws org.apache.bookkeeper.replication.ReplicationException.UnavailableException - Specified by:
setReplicasCheckCTimein interfaceorg.apache.bookkeeper.meta.LedgerUnderreplicationManager- Throws:
org.apache.bookkeeper.replication.ReplicationException.UnavailableException
-
getReplicasCheckCTime
public long getReplicasCheckCTime() throws org.apache.bookkeeper.replication.ReplicationException.UnavailableException- Specified by:
getReplicasCheckCTimein interfaceorg.apache.bookkeeper.meta.LedgerUnderreplicationManager- Throws:
org.apache.bookkeeper.replication.ReplicationException.UnavailableException
-
notifyUnderReplicationLedgerChanged
public void notifyUnderReplicationLedgerChanged(org.apache.bookkeeper.proto.BookkeeperInternalCallbacks.GenericCallback<Void> cb) throws org.apache.bookkeeper.replication.ReplicationException.UnavailableException - Specified by:
notifyUnderReplicationLedgerChangedin interfaceorg.apache.bookkeeper.meta.LedgerUnderreplicationManager- Throws:
org.apache.bookkeeper.replication.ReplicationException.UnavailableException
-