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 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

      public static String getUrLedgerPath(String base, long ledgerId)
    • getUrLedgerLockPath

      public static String getUrLedgerLockPath(String base, long ledgerId)
    • getLedgerUnreplicationInfo

      public org.apache.bookkeeper.meta.UnderreplicatedLedger getLedgerUnreplicationInfo(long ledgerId) throws org.apache.bookkeeper.replication.ReplicationException.UnavailableException
      Specified by:
      getLedgerUnreplicationInfo in interface org.apache.bookkeeper.meta.LedgerUnderreplicationManager
      Throws:
      org.apache.bookkeeper.replication.ReplicationException.UnavailableException
    • markLedgerUnderreplicatedAsync

      public CompletableFuture<Void> markLedgerUnderreplicatedAsync(long ledgerId, Collection<String> missingReplicas)
      Specified by:
      markLedgerUnderreplicatedAsync in interface org.apache.bookkeeper.meta.LedgerUnderreplicationManager
    • acquireUnderreplicatedLedger

      public void acquireUnderreplicatedLedger(long ledgerId) throws org.apache.bookkeeper.replication.ReplicationException
      Specified by:
      acquireUnderreplicatedLedger in interface org.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:
      markLedgerReplicated in interface org.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:
      listLedgersToRereplicate in interface org.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:
      pollLedgerToRereplicate in interface org.apache.bookkeeper.meta.LedgerUnderreplicationManager
      Throws:
      org.apache.bookkeeper.replication.ReplicationException.UnavailableException
    • getLedgerToRereplicate

      public long getLedgerToRereplicate() throws org.apache.bookkeeper.replication.ReplicationException.UnavailableException
      Specified by:
      getLedgerToRereplicate in interface org.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:
      releaseUnderreplicatedLedger in interface org.apache.bookkeeper.meta.LedgerUnderreplicationManager
      Throws:
      org.apache.bookkeeper.replication.ReplicationException.UnavailableException
    • close

      public void close() throws org.apache.bookkeeper.replication.ReplicationException.UnavailableException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface org.apache.bookkeeper.meta.LedgerUnderreplicationManager
      Throws:
      org.apache.bookkeeper.replication.ReplicationException.UnavailableException
    • disableLedgerReplication

      public void disableLedgerReplication() throws org.apache.bookkeeper.replication.ReplicationException.UnavailableException
      Specified by:
      disableLedgerReplication in interface org.apache.bookkeeper.meta.LedgerUnderreplicationManager
      Throws:
      org.apache.bookkeeper.replication.ReplicationException.UnavailableException
    • enableLedgerReplication

      public void enableLedgerReplication() throws org.apache.bookkeeper.replication.ReplicationException.UnavailableException
      Specified by:
      enableLedgerReplication in interface org.apache.bookkeeper.meta.LedgerUnderreplicationManager
      Throws:
      org.apache.bookkeeper.replication.ReplicationException.UnavailableException
    • isLedgerReplicationEnabled

      public boolean isLedgerReplicationEnabled() throws org.apache.bookkeeper.replication.ReplicationException.UnavailableException
      Specified by:
      isLedgerReplicationEnabled in interface org.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:
      notifyLedgerReplicationEnabled in interface org.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:
      isLedgerBeingReplicated in interface org.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:
      initializeLostBookieRecoveryDelay in interface org.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:
      setLostBookieRecoveryDelay in interface org.apache.bookkeeper.meta.LedgerUnderreplicationManager
      Throws:
      org.apache.bookkeeper.replication.ReplicationException.UnavailableException
    • getLostBookieRecoveryDelay

      public int getLostBookieRecoveryDelay() throws org.apache.bookkeeper.replication.ReplicationException.UnavailableException
      Specified by:
      getLostBookieRecoveryDelay in interface org.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:
      notifyLostBookieRecoveryDelayChanged in interface org.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:
      getReplicationWorkerIdRereplicatingLedger in interface org.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:
      setCheckAllLedgersCTime in interface org.apache.bookkeeper.meta.LedgerUnderreplicationManager
      Throws:
      org.apache.bookkeeper.replication.ReplicationException.UnavailableException
    • getCheckAllLedgersCTime

      public long getCheckAllLedgersCTime() throws org.apache.bookkeeper.replication.ReplicationException.UnavailableException
      Specified by:
      getCheckAllLedgersCTime in interface org.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:
      setPlacementPolicyCheckCTime in interface org.apache.bookkeeper.meta.LedgerUnderreplicationManager
      Throws:
      org.apache.bookkeeper.replication.ReplicationException.UnavailableException
    • getPlacementPolicyCheckCTime

      public long getPlacementPolicyCheckCTime() throws org.apache.bookkeeper.replication.ReplicationException.UnavailableException
      Specified by:
      getPlacementPolicyCheckCTime in interface org.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:
      setReplicasCheckCTime in interface org.apache.bookkeeper.meta.LedgerUnderreplicationManager
      Throws:
      org.apache.bookkeeper.replication.ReplicationException.UnavailableException
    • getReplicasCheckCTime

      public long getReplicasCheckCTime() throws org.apache.bookkeeper.replication.ReplicationException.UnavailableException
      Specified by:
      getReplicasCheckCTime in interface org.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:
      notifyUnderReplicationLedgerChanged in interface org.apache.bookkeeper.meta.LedgerUnderreplicationManager
      Throws:
      org.apache.bookkeeper.replication.ReplicationException.UnavailableException