Class ManagedLedgerConfig
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintlongClass<? extends EnsemblePlacementPolicy>Managed-ledger can setup different custom EnsemblePlacementPolicy (eg: affinity to write ledgers to only setup of group of bookies).Returns properties required by configured bookKeeperEnsemblePlacementPolicy.getClock()Get clock to use to time operations.org.apache.bookkeeper.client.api.DigestTypeintintGet ledger offloader which will be used to offload ledgers to longterm storage.intintMax backlog gap between backlogged cursors while caching to avoid caching entry which can be invalidated before other backlog cursor can reuse it from cache.intintlongintintintintintintlongLedger-Op (Create/Delete) timeout.intintMinimum cursors with backlog after which broker is allowed to cache read entries to reuse them for other cursors' backlog reads.intMinimum backlog should exist to leverage caching for backlog reads.intintbyte[]longLedger read-entry timeout.longlongdoubleintbooleanSkip reading non-recoverable/unreadable data-ledger under managed-ledger's list.booleanbooleanbooleanbooleanbooleanshould useConcurrentOpenLongPairRangeSetto store unacked ranges.setAckQuorumSize(int ackQuorumSize) setAddEntryTimeoutSeconds(long addEntryTimeoutSeconds) Add-entry timeout after which add-entry callback will be failed if add-entry is not succeeded.voidsetAutoSkipNonRecoverableData(boolean skipNonRecoverableData) voidsetBookKeeperEnsemblePlacementPolicyClassName(Class<? extends EnsemblePlacementPolicy> bookKeeperEnsemblePlacementPolicyClassName) Returns EnsemblePlacementPolicy configured for the Managed-ledger.voidsetBookKeeperEnsemblePlacementPolicyProperties(Map<String, Object> bookKeeperEnsemblePlacementPolicyProperties) Managed-ledger can setup different custom EnsemblePlacementPolicy which needs bookKeeperEnsemblePlacementPolicy-Properties.Set clock to use for time operations.setCreateIfMissing(boolean createIfMissing) voidsetDeletionAtBatchIndexLevelEnabled(boolean deletionAtBatchIndexLevelEnabled) setDigestType(org.apache.bookkeeper.client.api.DigestType digestType) setEnsembleSize(int ensembleSize) voidsetInactiveLedgerRollOverTime(int inactiveLedgerRollOverTimeMs, TimeUnit unit) Set rollOver time for inactive ledgers.setLazyCursorRecovery(boolean lazyCursorRecovery) Whether to recover cursors lazily when trying to recover a managed ledger backing a persistent topic.setLedgerOffloader(LedgerOffloader offloader) Set ledger offloader to use for offloading ledgers to longterm storage.setLedgerRolloverTimeout(int ledgerRolloverTimeout) voidsetManagedLedgerInterceptor(ManagedLedgerInterceptor managedLedgerInterceptor) voidsetMaxBacklogBetweenCursorsForCaching(int maxBacklogBetweenCursorsForCaching) Set maximum backlog distance between backlogged curosr to avoid caching unused entry.setMaxEntriesPerLedger(int maxEntriesPerLedger) voidsetMaximumRolloverTime(int maximumRolloverTime, TimeUnit unit) Set the maximum rollover time for ledgers in this managed ledger.setMaxSizePerLedgerMb(int maxSizePerLedgerMb) setMaxUnackedRangesToPersist(int maxUnackedRangesToPersist) voidsetMaxUnackedRangesToPersistInMetadataStore(int maxUnackedRangesToPersistInMetadataStore) setMetadataAckQuorumSize(int metadataAckQuorumSize) setMetadataEnsembleSize(int metadataEnsembleSize) setMetadataMaxEntriesPerLedger(int metadataMaxEntriesPerLedger) setMetadataOperationsTimeoutSeconds(long metadataOperationsTimeoutSeconds) Ledger-Op (Create/Delete) timeout after which callback will be completed with failure.setMetadataWriteQuorumSize(int metadataWriteQuorumSize) voidsetMinimumBacklogCursorsForCaching(int minimumBacklogCursorsForCaching) Set Minimum cursors with backlog after which broker is allowed to cache read entries to reuse them for other cursors' backlog reads.voidsetMinimumBacklogEntriesForCaching(int minimumBacklogEntriesForCaching) Set Minimum backlog after that broker will start caching backlog reads.voidsetMinimumRolloverTime(int minimumRolloverTime, TimeUnit unit) Set the minimum rollover time for ledgers in this managed ledger.voidsetNewEntriesCheckDelayInMillis(int newEntriesCheckDelayInMillis) setPassword(String password) voidsetPersistentUnackedRangesWithMultipleEntriesEnabled(boolean multipleEntriesEnabled) voidsetProperties(Map<String, String> properties) setReadEntryTimeoutSeconds(long readEntryTimeoutSeconds) Ledger read entry timeout after which callback will be completed with failure.setRetentionSizeInMB(long retentionSizeInMB) The retention size is used to set a maximum retention size quota on the ManagedLedger.setRetentionTime(int retentionTime, TimeUnit unit) Set the retention time for the ManagedLedger.setThrottleMarkDelete(double throttleMarkDelete) Set the rate limiter on how many mark-delete calls per second are allowed.setUnackedRangesOpenCacheSetEnabled(boolean unackedRangesOpenCacheSetEnabled) setWriteQuorumSize(int writeQuorumSize)
-
Field Details
-
PROPERTY_SOURCE_TOPIC_KEY
- See Also:
-
-
Constructor Details
-
ManagedLedgerConfig
public ManagedLedgerConfig()
-
-
Method Details
-
isCreateIfMissing
public boolean isCreateIfMissing() -
setCreateIfMissing
-
isLazyCursorRecovery
public boolean isLazyCursorRecovery()- Returns:
- the lazyCursorRecovery
-
setLazyCursorRecovery
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
- Parameters:
maxEntriesPerLedger- the maxEntriesPerLedger to set
-
getMaxSizePerLedgerMb
public int getMaxSizePerLedgerMb()- Returns:
- the maxSizePerLedgerMb
-
setMaxSizePerLedgerMb
- Parameters:
maxSizePerLedgerMb- the maxSizePerLedgerMb to set
-
getMinimumRolloverTimeMs
public int getMinimumRolloverTimeMs()- Returns:
- the minimum rollover time
-
setMinimumRolloverTime
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 timeunit- the time unit
-
getMaximumRolloverTimeMs
public long getMaximumRolloverTimeMs()- Returns:
- the maximum rollover time.
-
setMaximumRolloverTime
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 timeunit- the time unit
-
getEnsembleSize
public int getEnsembleSize()- Returns:
- the ensembleSize
-
setEnsembleSize
- Parameters:
ensembleSize- the ensembleSize to set
-
getAckQuorumSize
public int getAckQuorumSize()- Returns:
- the ackQuorumSize
-
getWriteQuorumSize
public int getWriteQuorumSize()- Returns:
- the writeQuorumSize
-
setWriteQuorumSize
- Parameters:
writeQuorumSize- the writeQuorumSize to set
-
setAckQuorumSize
- Parameters:
ackQuorumSize- the ackQuorumSize to set
-
getDigestType
public org.apache.bookkeeper.client.api.DigestType getDigestType()- Returns:
- the digestType
-
setDigestType
- Parameters:
digestType- the digestType to set
-
getPassword
public byte[] getPassword()- Returns:
- the password
-
setPassword
- Parameters:
password- the password to set
-
isUnackedRangesOpenCacheSetEnabled
public boolean isUnackedRangesOpenCacheSetEnabled()should useConcurrentOpenLongPairRangeSetto store unacked ranges.- Returns:
-
setUnackedRangesOpenCacheSetEnabled
public ManagedLedgerConfig setUnackedRangesOpenCacheSetEnabled(boolean unackedRangesOpenCacheSetEnabled) -
getMetadataEnsemblesize
public int getMetadataEnsemblesize()- Returns:
- the metadataEnsemblesize
-
setMetadataEnsembleSize
- Parameters:
metadataEnsembleSize- the metadataEnsembleSize to set
-
getMetadataAckQuorumSize
public int getMetadataAckQuorumSize()- Returns:
- the metadataAckQuorumSize
-
getMetadataWriteQuorumSize
public int getMetadataWriteQuorumSize()- Returns:
- the metadataWriteQuorumSize
-
setMetadataAckQuorumSize
- Parameters:
metadataAckQuorumSize- the metadataAckQuorumSize to set
-
setMetadataWriteQuorumSize
- Parameters:
metadataWriteQuorumSize- the metadataWriteQuorumSize to set
-
getMetadataMaxEntriesPerLedger
public int getMetadataMaxEntriesPerLedger()- Returns:
- the metadataMaxEntriesPerLedger
-
setMetadataMaxEntriesPerLedger
- Parameters:
metadataMaxEntriesPerLedger- the metadataMaxEntriesPerLedger to set
-
getLedgerRolloverTimeout
public int getLedgerRolloverTimeout()- Returns:
- the ledgerRolloverTimeout
-
setLedgerRolloverTimeout
- Parameters:
ledgerRolloverTimeout- the ledgerRolloverTimeout to set
-
getThrottleMarkDelete
public double getThrottleMarkDelete()- Returns:
- the throttling rate limit for mark-delete calls
-
setThrottleMarkDelete
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
Set the retention time for the ManagedLedger.Retention time and retention size (
setRetentionSizeInMB(long)) are together used to retain the ledger data 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 retainedunit- time unit for retention time
-
getRetentionTimeMillis
public long getRetentionTimeMillis()- Returns:
- duration for which messages are retained
-
setRetentionSizeInMB
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 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.
-
isPersistentUnackedRangesWithMultipleEntriesEnabled
public boolean isPersistentUnackedRangesWithMultipleEntriesEnabled() -
setPersistentUnackedRangesWithMultipleEntriesEnabled
public void setPersistentUnackedRangesWithMultipleEntriesEnabled(boolean multipleEntriesEnabled) -
setMaxUnackedRangesToPersist
- Parameters:
maxUnackedRangesToPersist- max unacked message ranges that will be persisted and receverd.
-
getMaxUnackedRangesToPersistInMetadataStore
public int getMaxUnackedRangesToPersistInMetadataStore()- Returns:
- max unacked message ranges up to which it can store in Zookeeper
-
setMaxUnackedRangesToPersistInMetadataStore
public void setMaxUnackedRangesToPersistInMetadataStore(int maxUnackedRangesToPersistInMetadataStore) -
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
Set ledger offloader to use for offloading ledgers to longterm storage.- Parameters:
offloader- the ledger offloader to use
-
getClock
Get clock to use to time operations.- Returns:
- a clock
-
setClock
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
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
Add-entry timeout after which add-entry callback will be failed if add-entry is not succeeded.- Parameters:
addEntryTimeoutSeconds-
-
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(Class<? extends EnsemblePlacementPolicy> bookKeeperEnsemblePlacementPolicyClassName) Returns EnsemblePlacementPolicy configured for the Managed-ledger.- Parameters:
bookKeeperEnsemblePlacementPolicyClassName-
-
getBookKeeperEnsemblePlacementPolicyProperties
Returns properties required by configured bookKeeperEnsemblePlacementPolicy.- Returns:
-
setBookKeeperEnsemblePlacementPolicyProperties
public void setBookKeeperEnsemblePlacementPolicyProperties(Map<String, Object> bookKeeperEnsemblePlacementPolicyProperties) Managed-ledger can setup different custom EnsemblePlacementPolicy which needs bookKeeperEnsemblePlacementPolicy-Properties.- Parameters:
bookKeeperEnsemblePlacementPolicyProperties-
-
getProperties
-
setProperties
-
isDeletionAtBatchIndexLevelEnabled
public boolean isDeletionAtBatchIndexLevelEnabled() -
setDeletionAtBatchIndexLevelEnabled
public void setDeletionAtBatchIndexLevelEnabled(boolean deletionAtBatchIndexLevelEnabled) -
getNewEntriesCheckDelayInMillis
public int getNewEntriesCheckDelayInMillis() -
setNewEntriesCheckDelayInMillis
public void setNewEntriesCheckDelayInMillis(int newEntriesCheckDelayInMillis) -
getManagedLedgerInterceptor
-
setManagedLedgerInterceptor
-
getInactiveLedgerRollOverTimeMs
public int getInactiveLedgerRollOverTimeMs() -
setInactiveLedgerRollOverTime
Set rollOver time for inactive ledgers.- Parameters:
inactiveLedgerRollOverTimeMs-unit-
-
getMinimumBacklogCursorsForCaching
public int getMinimumBacklogCursorsForCaching()Minimum cursors with backlog after which broker is allowed to cache read entries to reuse them for other cursors' backlog reads. (Default = 0, broker will not cache backlog reads)- Returns:
-
setMinimumBacklogCursorsForCaching
public void setMinimumBacklogCursorsForCaching(int minimumBacklogCursorsForCaching) Set Minimum cursors with backlog after which broker is allowed to cache read entries to reuse them for other cursors' backlog reads.- Parameters:
minimumBacklogCursorsForCaching-
-
getMinimumBacklogEntriesForCaching
public int getMinimumBacklogEntriesForCaching()Minimum backlog should exist to leverage caching for backlog reads.- Returns:
-
setMinimumBacklogEntriesForCaching
public void setMinimumBacklogEntriesForCaching(int minimumBacklogEntriesForCaching) Set Minimum backlog after that broker will start caching backlog reads.- Parameters:
minimumBacklogEntriesForCaching-
-
getMaxBacklogBetweenCursorsForCaching
public int getMaxBacklogBetweenCursorsForCaching()Max backlog gap between backlogged cursors while caching to avoid caching entry which can be invalidated before other backlog cursor can reuse it from cache.- Returns:
-
setMaxBacklogBetweenCursorsForCaching
public void setMaxBacklogBetweenCursorsForCaching(int maxBacklogBetweenCursorsForCaching) Set maximum backlog distance between backlogged curosr to avoid caching unused entry.- Parameters:
maxBacklogBetweenCursorsForCaching-
-
getShadowSource
-