Class ManagedLedgerConfig


  • @LimitedPrivate
    @Stable
    public class ManagedLedgerConfig
    extends java.lang.Object
    Configuration class for a ManagedLedger.
    • Constructor Detail

      • ManagedLedgerConfig

        public ManagedLedgerConfig()
    • Method Detail

      • isCreateIfMissing

        public boolean isCreateIfMissing()
      • setCreateIfMissing

        public ManagedLedgerConfig setCreateIfMissing​(boolean createIfMissing)
      • isLazyCursorRecovery

        public boolean isLazyCursorRecovery()
        Returns:
        the lazyCursorRecovery
      • setLazyCursorRecovery

        public ManagedLedgerConfig setLazyCursorRecovery​(boolean lazyCursorRecovery)
        Whether to recover cursors lazily when trying to recover a managed ledger backing a persistent topic. It can improve write availability of topics. The caveat is now when recovered ledger is ready to write we're not sure if all old consumers last mark delete position can be recovered or not.
        Parameters:
        lazyCursorRecovery - if enable lazy cursor recovery.
      • getMaxEntriesPerLedger

        public int getMaxEntriesPerLedger()
        Returns:
        the maxEntriesPerLedger
      • setMaxEntriesPerLedger

        public ManagedLedgerConfig setMaxEntriesPerLedger​(int maxEntriesPerLedger)
        Parameters:
        maxEntriesPerLedger - the maxEntriesPerLedger to set
      • getMaxSizePerLedgerMb

        public int getMaxSizePerLedgerMb()
        Returns:
        the maxSizePerLedgerMb
      • setMaxSizePerLedgerMb

        public ManagedLedgerConfig setMaxSizePerLedgerMb​(int maxSizePerLedgerMb)
        Parameters:
        maxSizePerLedgerMb - the maxSizePerLedgerMb to set
      • getMinimumRolloverTimeMs

        public int getMinimumRolloverTimeMs()
        Returns:
        the minimum rollover time
      • setMinimumRolloverTime

        public void setMinimumRolloverTime​(int minimumRolloverTime,
                                           java.util.concurrent.TimeUnit unit)
        Set the minimum rollover time for ledgers in this managed ledger.

        If this time is > 0, a ledger will not be rolled over more frequently than the specified time, even if it has reached the maximum number of entries or maximum size. This parameter can be used to reduce the amount of rollovers on managed ledger with high write throughput.

        Parameters:
        minimumRolloverTime - the minimum rollover time
        unit - the time unit
      • getMaximumRolloverTimeMs

        public long getMaximumRolloverTimeMs()
        Returns:
        the maximum rollover time.
      • setMaximumRolloverTime

        public void setMaximumRolloverTime​(int maximumRolloverTime,
                                           java.util.concurrent.TimeUnit unit)
        Set the maximum rollover time for ledgers in this managed ledger.

        If the ledger is not rolled over until this time, even if it has not reached the number of entry or size limit, this setting will trigger rollover. This parameter can be used for topics with low request rate to force rollover, so recovery failure does not have to go far back.

        Parameters:
        maximumRolloverTime - the maximum rollover time
        unit - the time unit
      • getEnsembleSize

        public int getEnsembleSize()
        Returns:
        the ensembleSize
      • setEnsembleSize

        public ManagedLedgerConfig setEnsembleSize​(int ensembleSize)
        Parameters:
        ensembleSize - the ensembleSize to set
      • getAckQuorumSize

        public int getAckQuorumSize()
        Returns:
        the ackQuorumSize
      • getWriteQuorumSize

        public int getWriteQuorumSize()
        Returns:
        the writeQuorumSize
      • setWriteQuorumSize

        public ManagedLedgerConfig setWriteQuorumSize​(int writeQuorumSize)
        Parameters:
        writeQuorumSize - the writeQuorumSize to set
      • setAckQuorumSize

        public ManagedLedgerConfig setAckQuorumSize​(int ackQuorumSize)
        Parameters:
        ackQuorumSize - the ackQuorumSize to set
      • getDigestType

        public org.apache.bookkeeper.client.api.DigestType getDigestType()
        Returns:
        the digestType
      • setDigestType

        public ManagedLedgerConfig setDigestType​(org.apache.bookkeeper.client.api.DigestType digestType)
        Parameters:
        digestType - the digestType to set
      • getPassword

        public byte[] getPassword()
        Returns:
        the password
      • setPassword

        public ManagedLedgerConfig setPassword​(java.lang.String password)
        Parameters:
        password - the password to set
      • isUnackedRangesOpenCacheSetEnabled

        public boolean isUnackedRangesOpenCacheSetEnabled()
        should use ConcurrentOpenLongPairRangeSet to store unacked ranges.
        Returns:
      • setUnackedRangesOpenCacheSetEnabled

        public ManagedLedgerConfig setUnackedRangesOpenCacheSetEnabled​(boolean unackedRangesOpenCacheSetEnabled)
      • getMetadataEnsemblesize

        public int getMetadataEnsemblesize()
        Returns:
        the metadataEnsemblesize
      • setMetadataEnsembleSize

        public ManagedLedgerConfig setMetadataEnsembleSize​(int metadataEnsembleSize)
        Parameters:
        metadataEnsembleSize - the metadataEnsembleSize to set
      • getMetadataAckQuorumSize

        public int getMetadataAckQuorumSize()
        Returns:
        the metadataAckQuorumSize
      • getMetadataWriteQuorumSize

        public int getMetadataWriteQuorumSize()
        Returns:
        the metadataWriteQuorumSize
      • setMetadataAckQuorumSize

        public ManagedLedgerConfig setMetadataAckQuorumSize​(int metadataAckQuorumSize)
        Parameters:
        metadataAckQuorumSize - the metadataAckQuorumSize to set
      • setMetadataWriteQuorumSize

        public ManagedLedgerConfig setMetadataWriteQuorumSize​(int metadataWriteQuorumSize)
        Parameters:
        metadataWriteQuorumSize - the metadataWriteQuorumSize to set
      • getMetadataMaxEntriesPerLedger

        public int getMetadataMaxEntriesPerLedger()
        Returns:
        the metadataMaxEntriesPerLedger
      • setMetadataMaxEntriesPerLedger

        public ManagedLedgerConfig setMetadataMaxEntriesPerLedger​(int metadataMaxEntriesPerLedger)
        Parameters:
        metadataMaxEntriesPerLedger - the metadataMaxEntriesPerLedger to set
      • getLedgerRolloverTimeout

        public int getLedgerRolloverTimeout()
        Returns:
        the ledgerRolloverTimeout
      • setLedgerRolloverTimeout

        public ManagedLedgerConfig setLedgerRolloverTimeout​(int ledgerRolloverTimeout)
        Parameters:
        ledgerRolloverTimeout - the ledgerRolloverTimeout to set
      • getThrottleMarkDelete

        public double getThrottleMarkDelete()
        Returns:
        the throttling rate limit for mark-delete calls
      • setThrottleMarkDelete

        public ManagedLedgerConfig setThrottleMarkDelete​(double throttleMarkDelete)
        Set the rate limiter on how many mark-delete calls per second are allowed. If the value is set to 0, the rate limiter is disabled. Default is 0.
        Parameters:
        throttleMarkDelete - the max number of mark-delete calls allowed per second
      • setRetentionTime

        public ManagedLedgerConfig setRetentionTime​(int retentionTime,
                                                    java.util.concurrent.TimeUnit unit)
        Set the retention time for the ManagedLedger.

        Retention time and retention size (setRetentionSizeInMB(long)) are together used to retain the ledger data when when there are no cursors or when all the cursors have marked the data for deletion. Data will be deleted in this case when both retention time and retention size settings don't prevent deleting the data marked for deletion.

        A retention time of 0 (default) will make data to be deleted immediately.

        A retention time of -1 , means to have an unlimited retention time.

        Parameters:
        retentionTime - duration for which messages should be retained
        unit - time unit for retention time
      • getRetentionTimeMillis

        public long getRetentionTimeMillis()
        Returns:
        duration for which messages are retained
      • setRetentionSizeInMB

        public ManagedLedgerConfig setRetentionSizeInMB​(long retentionSizeInMB)
        The retention size is used to set a maximum retention size quota on the ManagedLedger.

        Retention size and retention time (setRetentionTime(int, TimeUnit)) are together used to retain the ledger data when when there are no cursors or when all the cursors have marked the data for deletion. Data will be deleted in this case when both retention time and retention size settings don't prevent deleting the data marked for deletion.

        A retention size of 0 (default) will make data to be deleted immediately.

        A retention size of -1 , means to have an unlimited retention size.

        Parameters:
        retentionSizeInMB - quota for message retention
      • getRetentionSizeInMB

        public long getRetentionSizeInMB()
        Returns:
        quota for message retention
      • isAutoSkipNonRecoverableData

        public boolean isAutoSkipNonRecoverableData()
        Skip reading non-recoverable/unreadable data-ledger under managed-ledger's list. It helps when data-ledgers gets corrupted at bookkeeper and managed-cursor is stuck at that ledger.
      • setAutoSkipNonRecoverableData

        public void setAutoSkipNonRecoverableData​(boolean skipNonRecoverableData)
      • getMaxUnackedRangesToPersist

        public int getMaxUnackedRangesToPersist()
        Returns:
        max unacked message ranges that will be persisted and recovered.
      • getMaxBatchDeletedIndexToPersist

        public int getMaxBatchDeletedIndexToPersist()
        Returns:
        max batch deleted index that will be persisted and recoverd.
      • setMaxUnackedRangesToPersist

        public ManagedLedgerConfig setMaxUnackedRangesToPersist​(int maxUnackedRangesToPersist)
        Parameters:
        maxUnackedRangesToPersist - max unacked message ranges that will be persisted and receverd.
      • getMaxUnackedRangesToPersistInZk

        public int getMaxUnackedRangesToPersistInZk()
        Returns:
        max unacked message ranges up to which it can store in Zookeeper
      • setMaxUnackedRangesToPersistInZk

        public void setMaxUnackedRangesToPersistInZk​(int maxUnackedRangesToPersistInZk)
      • getLedgerOffloader

        public LedgerOffloader getLedgerOffloader()
        Get ledger offloader which will be used to offload ledgers to longterm storage. The default offloader throws an exception on any attempt to offload.
        Returns:
        a ledger offloader
      • setLedgerOffloader

        public ManagedLedgerConfig setLedgerOffloader​(LedgerOffloader offloader)
        Set ledger offloader to use for offloading ledgers to longterm storage.
        Parameters:
        offloader - the ledger offloader to use
      • getClock

        public java.time.Clock getClock()
        Get clock to use to time operations
        Returns:
        a clock
      • setClock

        public ManagedLedgerConfig setClock​(java.time.Clock clock)
        Set clock to use for time operations
        Parameters:
        clock - the clock to use
      • getMetadataOperationsTimeoutSeconds

        public long getMetadataOperationsTimeoutSeconds()
        Ledger-Op (Create/Delete) timeout
        Returns:
      • setMetadataOperationsTimeoutSeconds

        public ManagedLedgerConfig setMetadataOperationsTimeoutSeconds​(long metadataOperationsTimeoutSeconds)
        Ledger-Op (Create/Delete) timeout after which callback will be completed with failure
        Parameters:
        metadataOperationsTimeoutSeconds -
      • getReadEntryTimeoutSeconds

        public long getReadEntryTimeoutSeconds()
        Ledger read-entry timeout
        Returns:
      • setReadEntryTimeoutSeconds

        public ManagedLedgerConfig setReadEntryTimeoutSeconds​(long readEntryTimeoutSeconds)
        Ledger read entry timeout after which callback will be completed with failure. (disable timeout by setting readTimeoutSeconds <= 0)
        Parameters:
        readEntryTimeoutSeconds -
        Returns:
      • getAddEntryTimeoutSeconds

        public long getAddEntryTimeoutSeconds()
      • setAddEntryTimeoutSeconds

        public ManagedLedgerConfig setAddEntryTimeoutSeconds​(long addEntryTimeoutSeconds)
        Add-entry timeout after which add-entry callback will be failed if add-entry is not succeeded.
        Parameters:
        addEntryTimeoutSeconds -
      • getBookKeeperEnsemblePlacementPolicyClassName

        public java.lang.Class<? extends org.apache.bookkeeper.client.EnsemblePlacementPolicy> getBookKeeperEnsemblePlacementPolicyClassName()
        Managed-ledger can setup different custom EnsemblePlacementPolicy (eg: affinity to write ledgers to only setup of group of bookies).
        Returns:
      • setBookKeeperEnsemblePlacementPolicyClassName

        public void setBookKeeperEnsemblePlacementPolicyClassName​(java.lang.Class<? extends org.apache.bookkeeper.client.EnsemblePlacementPolicy> bookKeeperEnsemblePlacementPolicyClassName)
        Returns EnsemblePlacementPolicy configured for the Managed-ledger.
        Parameters:
        bookKeeperEnsemblePlacementPolicyClassName -
      • getBookKeeperEnsemblePlacementPolicyProperties

        public java.util.Map<java.lang.String,​java.lang.Object> getBookKeeperEnsemblePlacementPolicyProperties()
        Returns properties required by configured bookKeeperEnsemblePlacementPolicy.
        Returns:
      • setBookKeeperEnsemblePlacementPolicyProperties

        public void setBookKeeperEnsemblePlacementPolicyProperties​(java.util.Map<java.lang.String,​java.lang.Object> bookKeeperEnsemblePlacementPolicyProperties)
        Managed-ledger can setup different custom EnsemblePlacementPolicy which needs bookKeeperEnsemblePlacementPolicy-Properties.
        Parameters:
        bookKeeperEnsemblePlacementPolicyProperties -
      • isDeletionAtBatchIndexLevelEnabled

        public boolean isDeletionAtBatchIndexLevelEnabled()
      • setDeletionAtBatchIndexLevelEnabled

        public void setDeletionAtBatchIndexLevelEnabled​(boolean deletionAtBatchIndexLevelEnabled)
      • getNewEntriesCheckDelayInMillis

        public int getNewEntriesCheckDelayInMillis()
      • setNewEntriesCheckDelayInMillis

        public void setNewEntriesCheckDelayInMillis​(int newEntriesCheckDelayInMillis)
      • setManagedLedgerInterceptor

        public void setManagedLedgerInterceptor​(ManagedLedgerInterceptor managedLedgerInterceptor)