Class ServerConfiguration

java.lang.Object
org.apache.commons.configuration2.event.BaseEventSource
org.apache.commons.configuration2.AbstractConfiguration
org.apache.commons.configuration2.CompositeConfiguration
org.apache.bookkeeper.conf.AbstractConfiguration<ServerConfiguration>
org.apache.bookkeeper.conf.ServerConfiguration
All Implemented Interfaces:
Cloneable, org.apache.commons.configuration2.Configuration, org.apache.commons.configuration2.event.EventSource, org.apache.commons.configuration2.ImmutableConfiguration, org.apache.commons.configuration2.sync.SynchronizerSupport

public class ServerConfiguration extends AbstractConfiguration<ServerConfiguration>
Configuration manages server-side settings.
  • Field Details

  • Constructor Details

    • ServerConfiguration

      public ServerConfiguration()
      Construct a default configuration object.
    • ServerConfiguration

      public ServerConfiguration(AbstractConfiguration conf)
      Construct a configuration based on other configuration.
      Parameters:
      conf - Other configuration
  • Method Details

    • getEntryLogSizeLimit

      public long getEntryLogSizeLimit()
      Get entry logger size limitation.
      Returns:
      entry logger size limitation
    • setEntryLogSizeLimit

      public ServerConfiguration setEntryLogSizeLimit(long logSizeLimit)
      Set entry logger size limitation.
      Parameters:
      logSizeLimit - new log size limitation
    • isEntryLogFilePreAllocationEnabled

      public boolean isEntryLogFilePreAllocationEnabled()
      Is entry log file preallocation enabled.
      Returns:
      whether entry log file preallocation is enabled or not.
    • setEntryLogFilePreAllocationEnabled

      public ServerConfiguration setEntryLogFilePreAllocationEnabled(boolean enabled)
      Enable/disable entry log file preallocation.
      Parameters:
      enabled - enable/disable entry log file preallocation.
      Returns:
      server configuration object.
    • getGcWaitTime

      public long getGcWaitTime()
      Get Garbage collection wait time. Default value is 10 minutes. The guideline is not to set a too low value for this, if using zookeeper based ledger manager. And it would be nice to align with the average lifecycle time of ledgers in the system.
      Returns:
      gc wait time
    • setGcWaitTime

      public ServerConfiguration setGcWaitTime(long gcWaitTime)
      Set garbage collection wait time.
      Parameters:
      gcWaitTime - gc wait time
      Returns:
      server configuration
    • getGcOverreplicatedLedgerWaitTimeMillis

      public long getGcOverreplicatedLedgerWaitTimeMillis()
      Get wait time in millis for garbage collection of overreplicated ledgers.
      Returns:
      gc wait time
    • setGcOverreplicatedLedgerWaitTime

      public ServerConfiguration setGcOverreplicatedLedgerWaitTime(long gcWaitTime, TimeUnit unit)
      Set wait time for garbage collection of overreplicated ledgers. Default: 1 day

      A ledger can be overreplicated under the following circumstances: 1. The ledger with few entries has bk1 and bk2 as its ensemble. 2. bk1 crashes. 3. bk3 replicates the ledger from bk2 and updates the ensemble to bk2 and bk3. 4. bk1 comes back up. 5. Now there are 3 copies of the ledger.

      Parameters:
      gcWaitTime -
      Returns:
      server configuration
    • getGcOverreplicatedLedgerMaxConcurrentRequests

      public int getGcOverreplicatedLedgerMaxConcurrentRequests()
      Max number of concurrent requests in garbage collection of overreplicated ledgers.
      Returns:
      max number of concurrent requests
    • setGcOverreplicatedLedgerMaxConcurrentRequests

      public ServerConfiguration setGcOverreplicatedLedgerMaxConcurrentRequests(int gcOverreplicatedLedgerMaxConcurrentRequests)
      Max number of concurrent requests in garbage collection of overreplicated ledgers. Default: 1000
      Parameters:
      gcOverreplicatedLedgerMaxConcurrentRequests -
      Returns:
      server configuration
    • getGcMetadataOpRateLimit

      public int getGcMetadataOpRateLimit()
      Get the rate limit of metadata operations in garbage collection.
      Returns:
      rate limit of metadata operations in garbage collection
    • setGcMetadataOpRateLimit

      public ServerConfiguration setGcMetadataOpRateLimit(int gcRateLimit)
      Set the rate limit of metadata operations in garbage collection.
      Parameters:
      gcRateLimit -
      Returns:
      server configuration
    • getUseTransactionalCompaction

      public boolean getUseTransactionalCompaction()
      Get whether to use transactional compaction and using a separate log for compaction or not.
      Returns:
      use transactional compaction
    • setUseTransactionalCompaction

      public ServerConfiguration setUseTransactionalCompaction(boolean useTransactionalCompaction)
      Set whether to use transactional compaction and using a separate log for compaction or not.
      Parameters:
      useTransactionalCompaction -
      Returns:
      server configuration
    • getVerifyMetadataOnGC

      public boolean getVerifyMetadataOnGC()
      Get whether the bookie is configured to double check prior to gc.
      Returns:
      use transactional compaction
    • setVerifyMetadataOnGc

      public ServerConfiguration setVerifyMetadataOnGc(boolean verifyMetadataOnGC)
      Set whether the bookie is configured to double check prior to gc.
      Parameters:
      verifyMetadataOnGC -
      Returns:
      server configuration
    • isGcEntryLogMetadataCacheEnabled

      public boolean isGcEntryLogMetadataCacheEnabled()
      Get whether the bookie is configured to use persistent entrylogMetadataMap.
      Returns:
      use persistent entry-log metadata map
    • setGcEntryLogMetadataCacheEnabled

      public ServerConfiguration setGcEntryLogMetadataCacheEnabled(boolean gcEntryLogMetadataCacheEnabled)
      Set whether the bookie is configured to use persistent entrylogMetadataMap.
      Parameters:
      gcEntryLogMetadataCacheEnabled -
      Returns:
      server configuration
    • getGcEntryLogMetadataCachePath

      public String getGcEntryLogMetadataCachePath()
      Get directory to persist Entrylog metadata if gcPersistentEntrylogMetadataMapEnabled is true.
      Returns:
      entrylog metadata-map persistent store dir path.(default: it creates a sub-directory under each ledger directory with name "metadata-cache". If it set, it only works for one ledger directory configured for ledgerDirectories).
    • setGcEntryLogMetadataCachePath

      public ServerConfiguration setGcEntryLogMetadataCachePath(String gcEntrylogMetadataCachePath)
      Set directory to persist Entrylog metadata if gcPersistentEntrylogMetadataMapEnabled is true. If it set, it only works for one ledger directory configured for ledgerDirectories. For multi ledgerDirectory configured, keep the default value is the best practice.
      Parameters:
      gcEntrylogMetadataCachePath -
      Returns:
      server configuration.
    • isUseTargetEntryLogSizeForGc

      public boolean isUseTargetEntryLogSizeForGc()
    • setUseTargetEntryLogSizeForGc

      public ServerConfiguration setUseTargetEntryLogSizeForGc(boolean useTargetEntryLogSizeForGc)
    • isLocalScrubEnabled

      public boolean isLocalScrubEnabled()
      Get whether local scrub is enabled.
      Returns:
      Whether local scrub is enabled.
    • getLocalScrubPeriod

      public long getLocalScrubPeriod()
      Get local scrub interval.
      Returns:
      Number of seconds between scrubs, <=0 for disabled.
    • setLocalScrubPeriod

      public void setLocalScrubPeriod(long period)
      Set local scrub period in seconds (<=0 for disabled). Scrub will be scheduled at delays chosen from the interval (.5 * interval, 1.5 * interval)
    • getLocalScrubRateLimit

      public double getLocalScrubRateLimit()
      Get local scrub rate limit (entries/second).
      Returns:
      Max number of entries to scrub per second, 0 for disabled.
    • setLocalScrubRateLimit

      public void setLocalScrubRateLimit(double scrubRateLimit)
      Get local scrub rate limit (entries/second).
      Parameters:
      scrubRateLimit - Max number of entries per second to scan.
    • getFlushInterval

      public int getFlushInterval()
      Get flush interval. Default value is 10 second. It isn't useful to decrease this value, since ledger storage only checkpoints when an entry logger file is rolled.
      Returns:
      flush interval
    • setFlushInterval

      public ServerConfiguration setFlushInterval(int flushInterval)
      Set flush interval.
      Parameters:
      flushInterval - Flush Interval
      Returns:
      server configuration
    • getFlushIntervalInBytes

      public long getFlushIntervalInBytes()
      Set entry log flush interval in bytes.

      Default is 0. 0 or less disables this feature and effectively flush happens on log rotation.

      Flushing in smaller chunks but more frequently reduces spikes in disk I/O. Flushing too frequently may also affect performance negatively.

      Returns:
      Entry log flush interval in bytes
    • setFlushIntervalInBytes

      public ServerConfiguration setFlushIntervalInBytes(long flushInterval)
      Set entry log flush interval in bytes.
      Parameters:
      flushInterval - in bytes
      Returns:
      server configuration
    • getDeathWatchInterval

      public int getDeathWatchInterval()
      Get bookie death watch interval.
      Returns:
      watch interval
    • getOpenFileLimit

      public int getOpenFileLimit()
      Get open file limit. Default value is 20000.
      Returns:
      max number of files to open
    • setOpenFileLimit

      public ServerConfiguration setOpenFileLimit(int fileLimit)
      Set limitation of number of open files.
      Parameters:
      fileLimit - Limitation of number of open files.
      Returns:
      server configuration
    • getPageLimit

      public int getPageLimit()
      Get limitation number of index pages in ledger cache.
      Returns:
      max number of index pages in ledger cache
    • setPageLimit

      public ServerConfiguration setPageLimit(int pageLimit)
      Set limitation number of index pages in ledger cache.
      Parameters:
      pageLimit - Limitation of number of index pages in ledger cache.
      Returns:
      server configuration
    • getPageSize

      public int getPageSize()
      Get page size.
      Returns:
      page size in ledger cache
    • setPageSize

      public ServerConfiguration setPageSize(int pageSize)
      Set page size.
      Parameters:
      pageSize - Page Size
      Returns:
      Server Configuration
      See Also:
    • getFileInfoCacheInitialCapacity

      public int getFileInfoCacheInitialCapacity()
      Get the minimum total size for the internal file info cache tables. Providing a large enough estimate at construction time avoids the need for expensive resizing operations later, but setting this value unnecessarily high wastes memory.
      Returns:
      minimum size of initial file info cache.
    • setFileInfoCacheInitialCapacity

      public ServerConfiguration setFileInfoCacheInitialCapacity(int initialCapacity)
      Set the minimum total size for the internal file info cache tables for initialization.
      Parameters:
      initialCapacity - Initial capacity of file info cache table.
      Returns:
      server configuration instance.
    • getFileInfoMaxIdleTime

      public long getFileInfoMaxIdleTime()
      Get the max idle time allowed for a open file info existed in file info cache. If the file info is idle for a long time, exceed the given time period. The file info will be evicted and closed. If the value is zero, the file info is evicted only when opened files reached openFileLimit.
      Returns:
      max idle time of a file info in the file info cache.
      See Also:
    • setFileInfoMaxIdleTime

      public ServerConfiguration setFileInfoMaxIdleTime(long idleTime)
      Set the max idle time allowed for a open file info existed in file info cache.
      Parameters:
      idleTime - Idle time, in seconds.
      Returns:
      server configuration object.
      See Also:
    • getFileInfoFormatVersionToWrite

      public int getFileInfoFormatVersionToWrite()
      Get fileinfo format version to write.
      Returns:
      fileinfo format version to write.
    • setFileInfoFormatVersionToWrite

      public ServerConfiguration setFileInfoFormatVersionToWrite(int version)
      Set fileinfo format version to write.
      Parameters:
      version - fileinfo format version to write.
      Returns:
      server configuration.
    • getMaxJournalSizeMB

      public long getMaxJournalSizeMB()
      Max journal file size.
      Returns:
      max journal file size
    • setMaxJournalSizeMB

      public ServerConfiguration setMaxJournalSizeMB(long maxJournalSize)
      Set new max journal file size.
      Parameters:
      maxJournalSize - new max journal file size
      Returns:
      server configuration
    • getJournalPreAllocSizeMB

      public int getJournalPreAllocSizeMB()
      How much space should we pre-allocate at a time in the journal.
      Returns:
      journal pre-allocation size in MB
    • getJournalWriteBufferSizeKB

      public int getJournalWriteBufferSizeKB()
      Size of the write buffers used for the journal.
      Returns:
      journal write buffer size in KB
    • setJournalWriteBufferSizeKB

      public ServerConfiguration setJournalWriteBufferSizeKB(int bufferSizeKB)
      Set the size of the write buffers used for the journal.
      Parameters:
      bufferSizeKB - the size of the write buffer used for the journal, in KB.
      Returns:
      server configuration
    • getMaxBackupJournals

      public int getMaxBackupJournals()
      Max number of older journal files kept.
      Returns:
      max number of older journal files to kept
    • setMaxBackupJournals

      public ServerConfiguration setMaxBackupJournals(int maxBackupJournals)
      Set max number of older journal files to kept.
      Parameters:
      maxBackupJournals - Max number of older journal files
      Returns:
      server configuration
    • getJournalAlignmentSize

      public int getJournalAlignmentSize()
      All the journal writes and commits should be aligned to given size. If not, zeros will be padded to align to given size.
      Returns:
      journal alignment size
    • setJournalAlignmentSize

      public ServerConfiguration setJournalAlignmentSize(int size)
      Set journal alignment size.
      Parameters:
      size - journal alignment size.
      Returns:
      server configuration.
    • getJournalFormatVersionToWrite

      public int getJournalFormatVersionToWrite()
      Get journal format version to write.
      Returns:
      journal format version to write.
    • setJournalFormatVersionToWrite

      public ServerConfiguration setJournalFormatVersionToWrite(int version)
      Set journal format version to write.
      Parameters:
      version - journal format version to write.
      Returns:
      server configuration.
    • setJournalQueueSize

      public ServerConfiguration setJournalQueueSize(int journalQueueSize)
      Set the size of the journal queue.
      Parameters:
      journalQueueSize - the max size of journal queue
      Returns:
      server configuration.
    • getJournalQueueSize

      public int getJournalQueueSize()
      Get size of journal queue.
      Returns:
      the max size of journal queue.
    • setJournalMaxMemorySizeMb

      public ServerConfiguration setJournalMaxMemorySizeMb(long journalMaxMemorySizeMb)
      Set the max amount of memory that can be used by the journal.
      Parameters:
      journalMaxMemorySizeMb - the max amount of memory for the journal
      Returns:
      server configuration.
    • getJournalMaxMemorySizeMb

      public long getJournalMaxMemorySizeMb()
      Get the max amount of memory that can be used by the journal.
      Returns:
      the max amount of memory for the journal
    • setJournalPageCacheFlushIntervalMSec

      public ServerConfiguration setJournalPageCacheFlushIntervalMSec(long journalPageCacheFlushIntervalMSec)
      Set PageCache flush interval in second.
      Returns:
      server configuration.
    • getJournalPageCacheFlushIntervalMSec

      public long getJournalPageCacheFlushIntervalMSec()
      Get journal pageCache flush interval.
      Returns:
      journal pageCache flush interval.
    • setJournalChannelProvider

      public ServerConfiguration setJournalChannelProvider(String journalChannelProvider)
      Set JournalChannelProvider classname.
      Parameters:
      journalChannelProvider - The JournalChannelProvider classname. The class must implements FileChannelProvider and no args constructor is needed.
      Returns:
    • getJournalChannelProvider

      public String getJournalChannelProvider()
      Returns:
    • getJournalReuseFiles

      public boolean getJournalReuseFiles()
      Get reuse journal files.
      Returns:
    • setJournalReuseFiles

      public ServerConfiguration setJournalReuseFiles(boolean journalReuseFiles)
      Set reuse journal files.
      Parameters:
      journalReuseFiles -
      Returns:
    • getMaxAddsInProgressLimit

      public int getMaxAddsInProgressLimit()
      Get max number of adds in progress. 0 == unlimited.
      Returns:
      Max number of adds in progress.
    • setMaxAddsInProgressLimit

      public ServerConfiguration setMaxAddsInProgressLimit(int value)
      Set max number of adds in progress. 0 == unlimited.
      Parameters:
      value - max number of adds in progress.
      Returns:
      server configuration.
    • getMaxReadsInProgressLimit

      public int getMaxReadsInProgressLimit()
      Get max number of reads in progress. 0 == unlimited.
      Returns:
      Max number of reads in progress.
    • setMaxReadsInProgressLimit

      public ServerConfiguration setMaxReadsInProgressLimit(int value)
      Set max number of reads in progress. 0 == unlimited.
      Parameters:
      value - max number of reads in progress.
      Returns:
      server configuration.
    • getCloseChannelOnResponseTimeout

      public boolean getCloseChannelOnResponseTimeout()
      Configures action in case if server timed out sending response to the client. true == close the channel and drop response false == drop response Requires waitTimeoutOnBackpressureMs >= 0 otherwise ignored.
      Returns:
      value indicating if channel should be closed.
    • setCloseChannelOnResponseTimeout

      public ServerConfiguration setCloseChannelOnResponseTimeout(boolean value)
      Configures action in case if server timed out sending response to the client. true == close the channel and drop response false == drop response Requires waitTimeoutOnBackpressureMs >= 0 otherwise ignored.
      Parameters:
      value -
      Returns:
      server configuration.
    • getWaitTimeoutOnResponseBackpressureMillis

      public long getWaitTimeoutOnResponseBackpressureMillis()
      Timeout controlling wait on response send in case of unresponsive client (i.e. client in long GC etc.)
      Returns:
      timeout value negative value disables the feature 0 to allow request to fail immediately Default is -1 (disabled)
    • setWaitTimeoutOnResponseBackpressureMillis

      public ServerConfiguration setWaitTimeoutOnResponseBackpressureMillis(long value)
      Timeout controlling wait on response send in case of unresponsive client (i.e. client in long GC etc.)
      Parameters:
      value - negative value disables the feature 0 to allow request to fail immediately Default is -1 (disabled)
      Returns:
      client configuration.
    • getBookiePort

      public int getBookiePort()
      Get bookie port that bookie server listen on.
      Returns:
      bookie port
    • setBookiePort

      public ServerConfiguration setBookiePort(int port)
      Set new bookie port that bookie server listen on.
      Parameters:
      port - Port to listen on
      Returns:
      server configuration
    • getListeningInterface

      public String getListeningInterface()
      Get the network interface that the bookie should listen for connections on. If this is null, then the bookie will listen for connections on all interfaces.
      Returns:
      the network interface to listen on, e.g. eth0, or null if none is specified
    • setListeningInterface

      public ServerConfiguration setListeningInterface(String iface)
      Set the network interface that the bookie should listen on. If not set, the bookie will listen on all interfaces.
      Parameters:
      iface - the interface to listen on
    • getAllowLoopback

      public boolean getAllowLoopback()
      Is the bookie allowed to use a loopback interface as its primary interface(i.e. the interface it uses to establish its identity)?

      By default, loopback interfaces are not allowed as the primary interface.

      Using a loopback interface as the primary interface usually indicates a configuration error. For example, its fairly common in some VPS setups to not configure a hostname, or to have the hostname resolve to 127.0.0.1. If this is the case, then all bookies in the cluster will establish their identities as 127.0.0.1:3181, and only one will be able to join the cluster. For VPSs configured like this, you should explicitly set the listening interface.

      Returns:
      whether a loopback interface can be used as the primary interface
      See Also:
    • setAllowLoopback

      public ServerConfiguration setAllowLoopback(boolean allow)
      Configure the bookie to allow loopback interfaces to be used as the primary bookie interface.
      Parameters:
      allow - whether to allow loopback interfaces
      Returns:
      server configuration
      See Also:
    • getBookieId

      public String getBookieId()
      Get the configured BookieId for the bookie.

      If present, this setting will take precedence over the automatic BookieId generation, based on Network Addresses.

      Returns:
      the configure address to be advertised
      See Also:
    • setBookieId

      public ServerConfiguration setBookieId(String bookieId)
      Configure the bookie to advertise a specific BookieId.

      By default, a bookie will advertise a BookieId computed from the primary network endpoint address.

      Parameters:
      bookieId - the bookie id
      Returns:
      server configuration
      See Also:
    • removeBookieId

      public ServerConfiguration removeBookieId()
      Remove the configured BookieId for the bookie.
      Returns:
      server configuration
    • getAdvertisedAddress

      public String getAdvertisedAddress()
      Get the configured advertised address for the bookie.

      If present, this setting will take precedence over the setListeningInterface(String) and setUseHostNameAsBookieID(boolean).

      Returns:
      the configure address to be advertised
      See Also:
    • setAdvertisedAddress

      public ServerConfiguration setAdvertisedAddress(String advertisedAddress)
      Configure the bookie to advertise a specific address.

      By default, a bookie will advertise either its own IP or hostname, depending on the getUseHostNameAsBookieID() setting.

      When the advertised is set to a non-empty string, the bookie will register and advertise using this address.

      If present, this setting will take precedence over the setListeningInterface(String) and setUseHostNameAsBookieID(boolean).

      Parameters:
      advertisedAddress - whether to allow loopback interfaces
      Returns:
      server configuration
      See Also:
    • getAllowEphemeralPorts

      public boolean getAllowEphemeralPorts()
      Is the bookie allowed to use an ephemeral port (port 0) as its server port.

      By default, an ephemeral port is not allowed. Using an ephemeral port as the service port usually indicates a configuration error. However, in unit tests, using ephemeral port will address port conflicts problem and allow running tests in parallel.

      Returns:
      whether is allowed to use an ephemeral port.
    • setAllowEphemeralPorts

      public ServerConfiguration setAllowEphemeralPorts(boolean allow)
      Configure the bookie to allow using an ephemeral port.
      Parameters:
      allow - whether to allow using an ephemeral port.
      Returns:
      server configuration
    • getAllowStorageExpansion

      public boolean getAllowStorageExpansion()
      Return whether we should allow addition of ledger/index dirs to an existing bookie.
      Returns:
      true if the addition is allowed; false otherwise
    • setAllowStorageExpansion

      public ServerConfiguration setAllowStorageExpansion(boolean val)
      Change the setting of whether or not we should allow ledger/index dirs to be added to the current set of dirs.
      Parameters:
      val - - true if new ledger/index dirs can be added; false otherwise.
      Returns:
      server configuration
    • getJournalDirNames

      public String[] getJournalDirNames()
      Get dir names to store journal files.
      Returns:
      journal dir name
    • getJournalDirName

      @Deprecated public String getJournalDirName()
      Deprecated.
      Get dir name to store journal files.
      Returns:
      journal dir name
    • getJournalDirNameWithoutDefault

      public String getJournalDirNameWithoutDefault()
      Get dir name to store journal files.
      Returns:
      journal dir name
    • setJournalDirName

      public ServerConfiguration setJournalDirName(String journalDir)
      Set dir name to store journal files.
      Parameters:
      journalDir - Dir to store journal files
      Returns:
      server configuration
    • setJournalDirsName

      public ServerConfiguration setJournalDirsName(String[] journalDirs)
      Set dir names to store journal files.
      Parameters:
      journalDirs - Dir to store journal files
      Returns:
      server configuration
    • getJournalDirs

      public File[] getJournalDirs()
      Get dirs to store journal files.
      Returns:
      journal dirs, if no journal dir provided return null
    • getLedgerDirWithoutDefault

      public String[] getLedgerDirWithoutDefault()
      Get dir names to store ledger data.
      Returns:
      ledger dir names, if not provided return null
    • getLedgerDirNames

      public String[] getLedgerDirNames()
      Get dir names to store ledger data.
      Returns:
      ledger dir names, if not provided return null
    • setLedgerDirNames

      public ServerConfiguration setLedgerDirNames(String[] ledgerDirs)
      Set dir names to store ledger data.
      Parameters:
      ledgerDirs - Dir names to store ledger data
      Returns:
      server configuration
    • getLedgerDirs

      public File[] getLedgerDirs()
      Get dirs that stores ledger data.
      Returns:
      ledger dirs
    • getIndexDirNames

      public String[] getIndexDirNames()
      Get dir name to store index files.
      Returns:
      ledger index dir name, if no index dirs provided return null
    • setIndexDirName

      public ServerConfiguration setIndexDirName(String[] indexDirs)
      Set dir name to store index files.
      Parameters:
      indexDirs - Index dir names
      Returns:
      server configuration.
    • getIndexDirs

      public File[] getIndexDirs()
      Get index dir to store ledger index files.
      Returns:
      index dirs, if no index dirs provided return null
    • getServerTcpNoDelay

      public boolean getServerTcpNoDelay()
      Is tcp connection no delay.
      Returns:
      tcp socket nodelay setting
    • setServerTcpNoDelay

      public ServerConfiguration setServerTcpNoDelay(boolean noDelay)
      Set socket nodelay setting.
      Parameters:
      noDelay - NoDelay setting
      Returns:
      server configuration
    • getServerNumIOThreads

      public int getServerNumIOThreads()
      Get the number of IO threads. This is the number of threads used by Netty to handle TCP connections.
      Returns:
      the number of IO threads
    • getServerNumAcceptorThreads

      public int getServerNumAcceptorThreads()
      Get the number of Acceptor threads.
      Returns:
      the number of Acceptor threads
    • setServerNumIOThreads

      public ServerConfiguration setServerNumIOThreads(int numThreads)
      Set the number of IO threads.

      This is the number of threads used by Netty to handle TCP connections.

      Parameters:
      numThreads - number of IO threads used for bookkeeper
      Returns:
      client configuration
      See Also:
    • getServerSockLinger

      public int getServerSockLinger()
      Timeout to drain the socket on close.
      Returns:
      socket linger setting
    • setServerSockLinger

      public ServerConfiguration setServerSockLinger(int linger)
      Set socket linger timeout on close.

      When enabled, a close or shutdown will not return until all queued messages for the socket have been successfully sent or the linger timeout has been reached. Otherwise, the call returns immediately and the closing is done in the background.

      Parameters:
      linger - NoDelay setting
      Returns:
      server configuration
    • getServerSockKeepalive

      public boolean getServerSockKeepalive()
      Get socket keepalive.
      Returns:
      socket keepalive setting
    • setServerSockKeepalive

      public ServerConfiguration setServerSockKeepalive(boolean keepalive)
      Set socket keepalive setting.

      This setting is used to send keep-alive messages on connection-oriented sockets.

      Parameters:
      keepalive - KeepAlive setting
      Returns:
      server configuration
    • getZkRetryBackoffStartMs

      public int getZkRetryBackoffStartMs()
      Get zookeeper client backoff retry start time in millis.
      Returns:
      zk backoff retry start time in millis.
    • setZkRetryBackoffStartMs

      public ServerConfiguration setZkRetryBackoffStartMs(int retryMs)
      Set zookeeper client backoff retry start time in millis.
      Parameters:
      retryMs - backoff retry start time in millis.
      Returns:
      server configuration.
    • getZkRetryBackoffMaxMs

      public int getZkRetryBackoffMaxMs()
      Get zookeeper client backoff retry max time in millis.
      Returns:
      zk backoff retry max time in millis.
    • setZkRetryBackoffMaxMs

      public ServerConfiguration setZkRetryBackoffMaxMs(int retryMs)
      Set zookeeper client backoff retry max time in millis.
      Parameters:
      retryMs - backoff retry max time in millis.
      Returns:
      server configuration.
    • isStatisticsEnabled

      public boolean isStatisticsEnabled()
      Is statistics enabled.
      Returns:
      is statistics enabled
    • setStatisticsEnabled

      public ServerConfiguration setStatisticsEnabled(boolean enabled)
      Turn on/off statistics.
      Parameters:
      enabled - Whether statistics enabled or not.
      Returns:
      server configuration
    • setForceAllowCompaction

      public ServerConfiguration setForceAllowCompaction(boolean enable)
      Allow manually force compact the entry log or not.
      Parameters:
      enable - whether allow manually force compact the entry log or not.
      Returns:
      service configuration.
    • isForceAllowCompaction

      public boolean isForceAllowCompaction()
      The force compaction is allowed or not when disabling the entry log compaction.
      Returns:
      the force compaction is allowed or not when disabling the entry log compaction.
    • getMinorCompactionThreshold

      public double getMinorCompactionThreshold()
      Get threshold of minor compaction.

      For those entry log files whose remaining size percentage reaches below this threshold will be compacted in a minor compaction.

      If it is set to less than zero, the minor compaction is disabled.

      Returns:
      threshold of minor compaction
    • setMinorCompactionThreshold

      public ServerConfiguration setMinorCompactionThreshold(double threshold)
      Set threshold of minor compaction.
      Parameters:
      threshold - Threshold for minor compaction
      Returns:
      server configuration
      See Also:
    • getMajorCompactionThreshold

      public double getMajorCompactionThreshold()
      Get threshold of major compaction.

      For those entry log files whose remaining size percentage reaches below this threshold will be compacted in a major compaction.

      If it is set to less than zero, the major compaction is disabled.

      Returns:
      threshold of major compaction
    • setMajorCompactionThreshold

      public ServerConfiguration setMajorCompactionThreshold(double threshold)
      Set threshold of major compaction.
      Parameters:
      threshold - Threshold of major compaction
      Returns:
      server configuration
      See Also:
    • getMajorCompactionMaxTimeMillis

      public long getMajorCompactionMaxTimeMillis()
      Get the maximum milliseconds to run major compaction. If <=0 the thread will run until all compaction is completed.
      Returns:
      limit The number of milliseconds to run compaction.
    • setMajorCompactionMaxTimeMillis

      public ServerConfiguration setMajorCompactionMaxTimeMillis(long majorCompactionMaxTimeMillis)
      Set the maximum milliseconds to run major compaction. If <=0 the thread will run until all compaction is completed.
      Parameters:
      majorCompactionMaxTimeMillis - The number of milliseconds to run compaction.
      Returns:
      server configuration
      See Also:
    • getMinorCompactionInterval

      public long getMinorCompactionInterval()
      Get interval to run minor compaction, in seconds.

      If it is set to less than zero, the minor compaction is disabled.

      Returns:
      threshold of minor compaction
    • setMinorCompactionInterval

      public ServerConfiguration setMinorCompactionInterval(long interval)
      Set interval to run minor compaction.
      Parameters:
      interval - Interval to run minor compaction
      Returns:
      server configuration
      See Also:
    • getMajorCompactionInterval

      public long getMajorCompactionInterval()
      Get interval to run major compaction, in seconds.

      If it is set to less than zero, the major compaction is disabled.

      Returns:
      high water mark
    • setMajorCompactionInterval

      public ServerConfiguration setMajorCompactionInterval(long interval)
      Set interval to run major compaction.
      Parameters:
      interval - Interval to run major compaction
      Returns:
      server configuration
      See Also:
    • getMinorCompactionMaxTimeMillis

      public long getMinorCompactionMaxTimeMillis()
      Get the maximum milliseconds to run minor compaction. If <=0 the thread will run until all compaction is completed.
      Returns:
      limit The number of milliseconds to run compaction.
    • setMinorCompactionMaxTimeMillis

      public ServerConfiguration setMinorCompactionMaxTimeMillis(long minorCompactionMaxTimeMillis)
      Set the maximum milliseconds to run minor compaction. If <=0 the thread will run until all compaction is completed.
      Parameters:
      minorCompactionMaxTimeMillis - The number of milliseconds to run compaction.
      Returns:
      server configuration
      See Also:
    • getIsForceGCAllowWhenNoSpace

      public boolean getIsForceGCAllowWhenNoSpace()
      Get whether force compaction is allowed when disk full or almost full.

      Force GC may get some space back, but may also fill up disk space more quickly. This is because new log files are created before GC, while old garbage log files deleted after GC.

      Returns:
      true - do force GC when disk full, false - suspend GC when disk full.
    • setIsForceGCAllowWhenNoSpace

      public ServerConfiguration setIsForceGCAllowWhenNoSpace(boolean force)
      Set whether force GC is allowed when disk full or almost full.
      Parameters:
      force - true to allow force GC; false to suspend GC
      Returns:
      ServerConfiguration
    • setOpenLedgerRereplicationGracePeriod

      public void setOpenLedgerRereplicationGracePeriod(String waitTime)
      Set the grace period which the rereplication worker will wait before fencing and rereplicating a ledger fragment which is still being written to, on bookie failure.

      The grace period allows the writer to detect the bookie failure, and and start writing to another ledger fragment. If the writer writes nothing during the grace period, the rereplication worker assumes that it has crashed and therefore fences the ledger, preventing any further writes to that ledger.

      Parameters:
      waitTime - time to wait before replicating ledger fragment
      See Also:
    • getOpenLedgerRereplicationGracePeriod

      public long getOpenLedgerRereplicationGracePeriod()
      Get the grace period which the rereplication worker to wait before fencing and rereplicating a ledger fragment which is still being written to, on bookie failure.
      Returns:
      long
    • setLockReleaseOfFailedLedgerGracePeriod

      public void setLockReleaseOfFailedLedgerGracePeriod(String waitTime)
      Set the grace period, in milliseconds, which the replication worker has to wait before releasing the lock after it failed to replicate a ledger. For the first ReplicationWorker.NUM_OF_EXPONENTIAL_BACKOFF_RETRIALS failures it will do exponential backoff then it will bound at LOCK_RELEASE_OF_FAILED_LEDGER_GRACE_PERIOD.

      On replication failure, instead of releasing the lock immediately after failed attempt, it will hold under replicated ledger lock for the grace period and then it will release the lock.

      Parameters:
      waitTime -
    • getLockReleaseOfFailedLedgerGracePeriod

      public long getLockReleaseOfFailedLedgerGracePeriod()
      Get the grace period, in milliseconds, which the replication worker has to wait before releasing the lock after it failed to replicate a ledger. For the first ReplicationWorker.NUM_OF_EXPONENTIAL_BACKOFF_RETRIALS failures it will do exponential backoff then it will bound at LOCK_RELEASE_OF_FAILED_LEDGER_GRACE_PERIOD.
      Returns:
    • getReadBufferBytes

      public int getReadBufferBytes()
      Get the number of bytes we should use as capacity for org.apache.bookkeeper.bookie.BufferedReadChannel. Default is 512 bytes
      Returns:
      read buffer size
    • setReadBufferBytes

      public ServerConfiguration setReadBufferBytes(int readBufferSize)
      Set the number of bytes we should use as capacity for org.apache.bookkeeper.bookie.BufferedReadChannel.
      Parameters:
      readBufferSize - Read Buffer Size
      Returns:
      server configuration
    • setNumAddWorkerThreads

      public ServerConfiguration setNumAddWorkerThreads(int numThreads)
      Set the number of threads that would handle write requests.
      Parameters:
      numThreads - number of threads to handle write requests.
      Returns:
      server configuration
    • getNumAddWorkerThreads

      public int getNumAddWorkerThreads()
      Get the number of threads that should handle write requests.
      Returns:
      the number of threads that handle write requests.
    • setNumLongPollWorkerThreads

      public ServerConfiguration setNumLongPollWorkerThreads(int numThreads)
      Set the number of threads that should handle long poll requests.
      Parameters:
      numThreads - number of threads to handle long poll requests.
      Returns:
      server configuration
    • getNumLongPollWorkerThreads

      public int getNumLongPollWorkerThreads()
      Get the number of threads that should handle long poll requests.

      If the number of threads is zero or negative, bookie will fallback to use read threads. If there is no read threads used, it will create a thread pool with Runtime.availableProcessors() threads.

      Returns:
      the number of threads that should handle long poll requests, default value is 0.
    • setNumHighPriorityWorkerThreads

      public ServerConfiguration setNumHighPriorityWorkerThreads(int numThreads)
      Set the number of threads that should be used for high priority requests (i.e. recovery reads and adds, and fencing)
      Parameters:
      numThreads - number of threads to handle high priority requests.
      Returns:
      server configuration
    • getNumHighPriorityWorkerThreads

      public int getNumHighPriorityWorkerThreads()
      Get the number of threads that should be used for high priority requests (i.e. recovery reads and adds, and fencing)
      Returns:
    • setReadWorkerThreadsThrottlingEnabled

      public ServerConfiguration setReadWorkerThreadsThrottlingEnabled(boolean throttle)
      Use auto-throttling of the read-worker threads. This is done to ensure the bookie is not using unlimited amount of memory to respond to read-requests.
      Parameters:
      throttle - whether to throttle the read workers threads
      Returns:
      server configuration
    • isReadWorkerThreadsThrottlingEnabled

      public boolean isReadWorkerThreadsThrottlingEnabled()
      Get the auto-throttling status of the read-worker threads.
      Returns:
    • setNumReadWorkerThreads

      public ServerConfiguration setNumReadWorkerThreads(int numThreads)
      Set the number of threads that would handle read requests.
      Parameters:
      numThreads - Number of threads to handle read requests.
      Returns:
      server configuration
    • getNumReadWorkerThreads

      public int getNumReadWorkerThreads()
      Get the number of threads that should handle read requests.
    • setRequestTimerTickDurationMs

      public ServerConfiguration setRequestTimerTickDurationMs(int tickDuration)
      Set the tick duration in milliseconds.
      Parameters:
      tickDuration - tick duration in milliseconds.
      Returns:
      server configuration
    • setMaxPendingReadRequestPerThread

      public ServerConfiguration setMaxPendingReadRequestPerThread(int maxPendingReadRequestsPerThread)
      Set the max number of pending read requests for each read worker thread. After the quota is reached, new requests will be failed immediately.
      Parameters:
      maxPendingReadRequestsPerThread -
      Returns:
      server configuration
    • getMaxPendingReadRequestPerThread

      public int getMaxPendingReadRequestPerThread()
      If read workers threads are enabled, limit the number of pending requests, to avoid the executor queue to grow indefinitely (default: 10000 entries).
    • setMaxPendingAddRequestPerThread

      public ServerConfiguration setMaxPendingAddRequestPerThread(int maxPendingAddRequestsPerThread)
      Set the max number of pending add requests for each add worker thread. After the quota is reached, new requests will be failed immediately.
      Parameters:
      maxPendingAddRequestsPerThread -
      Returns:
      server configuration
    • getMaxPendingAddRequestPerThread

      public int getMaxPendingAddRequestPerThread()
      If add workers threads are enabled, limit the number of pending requests, to avoid the executor queue to grow indefinitely (default: 10000 entries).
    • getRequestTimerTickDurationMs

      public int getRequestTimerTickDurationMs()
      Get the tick duration in milliseconds.
      Returns:
    • setRequestTimerNumTicks

      public ServerConfiguration setRequestTimerNumTicks(int tickCount)
      Set the number of ticks per wheel for the request timer.
      Parameters:
      tickCount - number of ticks per wheel for the request timer.
      Returns:
      server configuration
    • getRequestTimerNumTicks

      public int getRequestTimerNumTicks()
      Get the number of ticks per wheel for the request timer.
      Returns:
    • getWriteBufferBytes

      public int getWriteBufferBytes()
      Get the number of bytes used as capacity for the write buffer. Default is 64KB. NOTE: Make sure this value is greater than the maximum message size.
      Returns:
      the size of the write buffer in bytes
    • setWriteBufferBytes

      public ServerConfiguration setWriteBufferBytes(int writeBufferBytes)
      Set the number of bytes used as capacity for the write buffer.
      Parameters:
      writeBufferBytes - Write Buffer Bytes
      Returns:
      server configuration
    • setNumJournalCallbackThreads

      @Deprecated public ServerConfiguration setNumJournalCallbackThreads(int numThreads)
      Deprecated.
      Set the number of threads that would handle journal callbacks.
      Parameters:
      numThreads - number of threads to handle journal callbacks.
      Returns:
      server configuration
    • getNumJournalCallbackThreads

      @Deprecated public int getNumJournalCallbackThreads()
      Deprecated.
      Get the number of threads that should handle journal callbacks.
      Returns:
      the number of threads that handle journal callbacks.
    • setSortedLedgerStorageEnabled

      public ServerConfiguration setSortedLedgerStorageEnabled(boolean enabled)
      Deprecated.
      Use setLedgerStorageClass(String) to configure the implementation class
      Set sorted-ledger storage enabled or not.
      Parameters:
      enabled -
    • getSortedLedgerStorageEnabled

      public boolean getSortedLedgerStorageEnabled()
      Check if sorted-ledger storage enabled (default true).
      Returns:
      true if sorted ledger storage is enabled, false otherwise
    • getSkipListSizeLimit

      public long getSkipListSizeLimit()
      Get skip list data size limitation (default 64MB). Max value is 1,073,741,823
      Returns:
      skip list data size limitation
    • setSkipListSizeLimit

      public ServerConfiguration setSkipListSizeLimit(int size)
      Set skip list size limit.
      Parameters:
      size - skip list size limit.
      Returns:
      server configuration object.
    • getSkipListArenaChunkSize

      public int getSkipListArenaChunkSize()
      Get the number of bytes we should use as chunk allocation for org.apache.bookkeeper.bookie.SkipListArena. Default is 4 MB
      Returns:
      the number of bytes to use for each chunk in the skiplist arena
    • setSkipListArenaChunkSize

      public ServerConfiguration setSkipListArenaChunkSize(int size)
      Set the number of bytes we used as chunk allocation for org.apache.bookkeeper.bookie.SkipListArena.
      Parameters:
      size - chunk size.
      Returns:
      server configuration object.
    • getSkipListArenaMaxAllocSize

      public int getSkipListArenaMaxAllocSize()
      Get the max size we should allocate from the skiplist arena. Allocations larger than this should be allocated directly by the VM to avoid fragmentation.
      Returns:
      max size allocatable from the skiplist arena (Default is 128 KB)
    • setSkipListArenaMaxAllocSize

      public ServerConfiguration setSkipListArenaMaxAllocSize(int size)
      Set the max size we should allocate from the skiplist arena. Allocations larger than this should be allocated directly by the VM to avoid fragmentation.
      Parameters:
      size - max alloc size.
      Returns:
      server configuration object.
    • getJournalSyncData

      public boolean getJournalSyncData()
      Should the data be fsynced on journal before acknowledgment.

      Default is true

      Returns:
    • getJournalWriteData

      public boolean getJournalWriteData()
      Should the data be written to journal before acknowledgment.

      Default is true

      Returns:
    • setJournalWriteData

      public ServerConfiguration setJournalWriteData(boolean journalWriteData)
      Should the data be written to journal before acknowledgment.

      Default is true

      Returns:
    • setJournalSyncData

      public ServerConfiguration setJournalSyncData(boolean syncData)
      Enable or disable journal syncs.

      By default, data sync is enabled to guarantee durability of writes.

      Beware: while disabling data sync in the Bookie journal might improve the bookie write performance, it will also introduce the possibility of data loss. With no sync, the journal entries are written in the OS page cache but not flushed to disk. In case of power failure, the affected bookie might lose the unflushed data. If the ledger is replicated to multiple bookies, the chances of data loss are reduced though still present.

      Parameters:
      syncData - whether to sync data on disk before acknowledgement
      Returns:
      server configuration object
    • getJournalAdaptiveGroupWrites

      public boolean getJournalAdaptiveGroupWrites()
      Should we group journal force writes.
      Returns:
      group journal force writes
    • setJournalAdaptiveGroupWrites

      public ServerConfiguration setJournalAdaptiveGroupWrites(boolean enabled)
      Enable/disable group journal force writes.
      Parameters:
      enabled - flag to enable/disable group journal force writes
    • getJournalMaxGroupWaitMSec

      public long getJournalMaxGroupWaitMSec()
      Maximum latency to impose on a journal write to achieve grouping. Default is 2ms.
      Returns:
      max wait for grouping
    • setJournalMaxGroupWaitMSec

      public ServerConfiguration setJournalMaxGroupWaitMSec(long journalMaxGroupWaitMSec)
      Sets the maximum latency to impose on a journal write to achieve grouping.
      Parameters:
      journalMaxGroupWaitMSec - maximum time to wait in milliseconds.
      Returns:
      server configuration.
    • getJournalBufferedWritesThreshold

      public long getJournalBufferedWritesThreshold()
      Maximum bytes to buffer to impose on a journal write to achieve grouping.
      Returns:
      max bytes to buffer
    • setJournalBufferedWritesThreshold

      public ServerConfiguration setJournalBufferedWritesThreshold(long maxBytes)
      Set maximum bytes to buffer to impose on a journal write to achieve grouping.
      Parameters:
      maxBytes - maximum bytes to buffer to impose on a journal write
      Returns:
      max bytes to buffer
    • getJournalBufferedEntriesThreshold

      public long getJournalBufferedEntriesThreshold()
      Maximum entries to buffer to impose on a journal write to achieve grouping. Use getJournalBufferedWritesThreshold() if this is set to zero or less than zero.
      Returns:
      max entries to buffer.
    • setJournalBufferedEntriesThreshold

      public ServerConfiguration setJournalBufferedEntriesThreshold(int maxEntries)
      Set maximum entries to buffer to impose on a journal write to achieve grouping. Use getJournalBufferedWritesThreshold() set this to zero or less than zero.
      Parameters:
      maxEntries - maximum entries to buffer.
      Returns:
      server configuration.
    • setJournalFlushWhenQueueEmpty

      public ServerConfiguration setJournalFlushWhenQueueEmpty(boolean enabled)
      Set if we should flush the journal when queue is empty.
    • getJournalFlushWhenQueueEmpty

      public boolean getJournalFlushWhenQueueEmpty()
      Should we flush the journal when queue is empty.
      Returns:
      flush when queue is empty
    • setReadOnlyModeEnabled

      public ServerConfiguration setReadOnlyModeEnabled(boolean enabled)
      Set whether the bookie is able to go into read-only mode. If this is set to false, the bookie will shutdown on encountering an error condition.
      Parameters:
      enabled - whether to enable read-only mode.
      Returns:
      ServerConfiguration
    • isReadOnlyModeEnabled

      public boolean isReadOnlyModeEnabled()
      Get whether read-only mode is enabled. The default is true.
      Returns:
      boolean
    • setReadOnlyModeOnAnyDiskFullEnabled

      public ServerConfiguration setReadOnlyModeOnAnyDiskFullEnabled(boolean enabled)
      Set whether the bookie is able to go into read-only mode when any disk is full. If this set to false, it will behave to READ_ONLY_MODE_ENABLED flag.
      Parameters:
      enabled - whether to enable read-only mode when any disk is full.
      Returns:
    • isReadOnlyModeOnAnyDiskFullEnabled

      public boolean isReadOnlyModeOnAnyDiskFullEnabled()
      Get whether read-only mode is enable when any disk is full. The default is true.
      Returns:
      boolean
    • setDiskUsageWarnThreshold

      public ServerConfiguration setDiskUsageWarnThreshold(float threshold)
      Set the warning threshold for disk usage.
      Parameters:
      threshold - warning threshold to force gc.
      Returns:
      ServerConfiguration
    • getDiskUsageWarnThreshold

      public float getDiskUsageWarnThreshold()
      Returns the warning threshold for disk usage. If disk usage goes beyond this, a garbage collection cycle will be forced.
      Returns:
      the percentage at which a disk usage warning will trigger
    • setPersistBookieStatusEnabled

      public ServerConfiguration setPersistBookieStatusEnabled(boolean enabled)
      Whether to persist the bookie status so that when bookie server restarts, it will continue using the previous status.
      Parameters:
      enabled - - true if persist the bookie status. Otherwise false.
      Returns:
      ServerConfiguration
    • isPersistBookieStatusEnabled

      public boolean isPersistBookieStatusEnabled()
      Get whether to persist the bookie status so that when bookie server restarts, it will continue using the previous status.
      Returns:
      true - if need to start a bookie in read only mode. Otherwise false.
    • setDiskUsageThreshold

      public ServerConfiguration setDiskUsageThreshold(float threshold)
      Set the Disk free space threshold as a fraction of the total after which disk will be considered as full during disk check.
      Parameters:
      threshold - threshold to declare a disk full
      Returns:
      ServerConfiguration
    • getDiskUsageThreshold

      public float getDiskUsageThreshold()
      Returns disk free space threshold. By default it is 0.95.
      Returns:
      the percentage at which a disk will be considered full
    • setDiskLowWaterMarkUsageThreshold

      public ServerConfiguration setDiskLowWaterMarkUsageThreshold(float threshold)
      Set the disk free space low water mark threshold. Disk is considered full when usage threshold is exceeded. Disk returns back to non-full state when usage is below low water mark threshold. This prevents it from going back and forth between these states frequently when concurrent writes and compaction are happening. This also prevent bookie from switching frequently between read-only and read-writes states in the same cases.
      Parameters:
      threshold - threshold to declare a disk full
      Returns:
      ServerConfiguration
    • getDiskLowWaterMarkUsageThreshold

      public float getDiskLowWaterMarkUsageThreshold()
      Returns disk free space low water mark threshold. By default it is the same as usage threshold (for backwards-compatibility).
      Returns:
      the percentage below which a disk will NOT be considered full
    • setDiskCheckInterval

      public ServerConfiguration setDiskCheckInterval(int interval)
      Set the disk checker interval to monitor ledger disk space.
      Parameters:
      interval - interval between disk checks for space.
      Returns:
      ServerConfiguration
    • getDiskCheckInterval

      public int getDiskCheckInterval()
      Get the disk checker interval.
      Returns:
      int
    • setAuditorPeriodicCheckInterval

      public void setAuditorPeriodicCheckInterval(long interval)
      Set the regularity at which the auditor will run a check of all ledgers. This should not be run very often, and at most, once a day. Setting this to 0 will completely disable the periodic check.
      Parameters:
      interval - The interval in seconds. e.g. 86400 = 1 day, 604800 = 1 week
    • getAuditorPeriodicCheckInterval

      public long getAuditorPeriodicCheckInterval()
      Get the regularity at which the auditor checks all ledgers.
      Returns:
      The interval in seconds. Default is 604800 (1 week).
    • setAuditorPeriodicBookieCheckInterval

      public void setAuditorPeriodicBookieCheckInterval(long interval)
      Set the interval between auditor bookie checks. The auditor bookie check, checks ledger metadata to see which bookies contain entries for each ledger. If a bookie which should contain entries is unavailable, then the ledger containing that entry is marked for recovery. Setting this to 0 disabled the periodic check. Bookie checks will still run when a bookie fails.
      Parameters:
      interval - The period in seconds.
    • getAuditorPeriodicBookieCheckInterval

      public long getAuditorPeriodicBookieCheckInterval()
      Get the interval between auditor bookie check runs.
      Returns:
      the interval between bookie check runs, in seconds. Default is 86400 (= 1 day)
      See Also:
    • setAuditorPeriodicPlacementPolicyCheckInterval

      public void setAuditorPeriodicPlacementPolicyCheckInterval(long interval)
      Sets the regularity/interval at which the auditor will run a placement policy check of all ledgers, which are closed. This should not be run very often, and should be run at most once a day. Setting this to 0 will completely disable the periodic metadata check.
      Parameters:
      interval - The interval in seconds. e.g. 86400 = 1 day, 604800 = 1 week
    • getAuditorPeriodicPlacementPolicyCheckInterval

      public long getAuditorPeriodicPlacementPolicyCheckInterval()
      Get the regularity at which the auditor does placement policy check of all ledgers, which are closed.
      Returns:
      The interval in seconds. By default, it is disabled.
    • setRepairedPlacementPolicyNotAdheringBookieEnable

      public void setRepairedPlacementPolicyNotAdheringBookieEnable(boolean enabled)
    • isRepairedPlacementPolicyNotAdheringBookieEnable

      public boolean isRepairedPlacementPolicyNotAdheringBookieEnable()
      Now the feature only support RackawareEnsemblePlacementPolicy. In Auditor, it combines with getAuditorPeriodicPlacementPolicyCheckInterval(), to control is marked ledger id to under replication managed when found a ledger ensemble not adhere to placement policy. In ReplicationWorker, to control is to repair the ledger which the ensemble does not adhere to the placement policy. By default, it is disabled. If you want to enable this feature, there maybe lots of ledger will be mark underreplicated. The replicationWorker will replicate lots of ledger, it will increase read request and write request in bookie server. You should set a suitable rereplicationEntryBatchSize to avoid bookie server pressure.
    • setUnderreplicatedLedgerRecoveryGracePeriod

      public void setUnderreplicatedLedgerRecoveryGracePeriod(long gracePeriod)
      Sets the grace period (in seconds) for underreplicated ledgers recovery. If ledger is marked underreplicated for more than this period then it will be reported by placementPolicyCheck in Auditor. Setting this to 0 will disable this check.
      Parameters:
      gracePeriod - The interval in seconds. e.g. 3600 = 1 hour
    • getUnderreplicatedLedgerRecoveryGracePeriod

      public long getUnderreplicatedLedgerRecoveryGracePeriod()
      Gets the grace period (in seconds) for underreplicated ledgers recovery. If ledger is marked underreplicated for more than this period then it will be reported by placementPolicyCheck in Auditor. Setting this to 0 will disable this check.
      Returns:
      The interval in seconds. By default it is disabled.
    • setAuditorPeriodicReplicasCheckInterval

      public void setAuditorPeriodicReplicasCheckInterval(long interval)
      Sets the interval at which the auditor will run a replicas check of all ledgers. This should not be run very often since it validates availability of replicas of all ledgers by querying bookies. Setting this to 0 will disable the periodic replicas check.
      Parameters:
      interval - The interval in seconds. e.g. 86400 = 1 day, 604800 = 1 week
    • getAuditorPeriodicReplicasCheckInterval

      public long getAuditorPeriodicReplicasCheckInterval()
      Get the interval at which the auditor does replicas check of all ledgers.
      Returns:
      The interval in seconds. By default it is disabled.
    • getAuditorMaxNumberOfConcurrentOpenLedgerOperations

      public int getAuditorMaxNumberOfConcurrentOpenLedgerOperations()
      Get the semaphore limit value of getting ledger from zookeeper in auto recovery.
      Returns:
      The semaphore value. By default it is 500.
    • setAuditorMaxNumberOfConcurrentOpenLedgerOperations

      public void setAuditorMaxNumberOfConcurrentOpenLedgerOperations(int semaphore)
      Set the semaphore limit value for getting ledger from zookeeper in auto recovery.
      Parameters:
      semaphore -
    • getAuditorAcquireConcurrentOpenLedgerOperationsTimeoutMSec

      public int getAuditorAcquireConcurrentOpenLedgerOperationsTimeoutMSec()
      Get the acquire concurrent open ledger operations timeout.
      Returns:
      The timeout values. By default it is 120000ms
    • setAuditorAcquireConcurrentOpenLedgerOperationsTimeoutMSec

      public void setAuditorAcquireConcurrentOpenLedgerOperationsTimeoutMSec(int timeoutMs)
      Set the acquire concurrent open ledger operations timeout.
      Parameters:
      timeoutMs -
    • setAuditorLedgerVerificationPercentage

      public ServerConfiguration setAuditorLedgerVerificationPercentage(long auditorLedgerVerificationPercentage)
      Set what percentage of a ledger (fragment)'s entries will be verified. 0 - only the first and last entry of each ledger fragment would be verified 100 - the entire ledger fragment would be verified anything else - randomly picked entries from over the fragment would be verifiec
      Parameters:
      auditorLedgerVerificationPercentage - The verification proportion as a percentage
      Returns:
      ServerConfiguration
    • getAuditorLedgerVerificationPercentage

      public long getAuditorLedgerVerificationPercentage()
      Get what percentage of a ledger (fragment)'s entries will be verified.
      Returns:
      percentage of a ledger (fragment)'s entries will be verified. Default is 0.
      See Also:
    • setAutoRecoveryDaemonEnabled

      public ServerConfiguration setAutoRecoveryDaemonEnabled(boolean enabled)
      Sets that whether the auto-recovery service can start along with Bookie server itself or not.
      Parameters:
      enabled - - true if need to start auto-recovery service. Otherwise false.
      Returns:
      ServerConfiguration
    • isAutoRecoveryDaemonEnabled

      public boolean isAutoRecoveryDaemonEnabled()
      Get whether the Bookie itself can start auto-recovery service also or not.
      Returns:
      true - if Bookie should start auto-recovery service along with it. false otherwise.
    • getLostBookieRecoveryDelay

      public int getLostBookieRecoveryDelay()
      Get how long to delay the recovery of ledgers of a lost bookie.
      Returns:
      delay interval in seconds
    • setLostBookieRecoveryDelay

      public void setLostBookieRecoveryDelay(int interval)
      Set the delay interval for starting recovery of a lost bookie.
    • getRwRereplicateBackoffMs

      public int getRwRereplicateBackoffMs()
      Get how long to backoff when encountering exception on rereplicating a ledger.
      Returns:
      backoff time in milliseconds
    • setRwRereplicateBackoffMs

      public void setRwRereplicateBackoffMs(int backoffMs)
      Set how long to backoff when encountering exception on rereplicating a ledger.
      Parameters:
      backoffMs - backoff time in milliseconds
    • setForceReadOnlyBookie

      public ServerConfiguration setForceReadOnlyBookie(boolean enabled)
      Sets that whether force start a bookie in readonly mode.
      Parameters:
      enabled - - true if need to start a bookie in read only mode. Otherwise false.
      Returns:
      ServerConfiguration
    • isForceReadOnlyBookie

      public boolean isForceReadOnlyBookie()
      Get whether the Bookie is force started in read only mode or not.
      Returns:
      true - if need to start a bookie in read only mode. Otherwise false.
    • getIsThrottleByBytes

      public boolean getIsThrottleByBytes()
      Get whether use bytes to throttle garbage collector compaction or not.
      Returns:
      true - use Bytes, false - use Entries.
    • setIsThrottleByBytes

      public ServerConfiguration setIsThrottleByBytes(boolean byBytes)
      Set whether use bytes to throttle garbage collector compaction or not.
      Parameters:
      byBytes - true to use by bytes; false to use by entries
      Returns:
      ServerConfiguration
    • getCompactionMaxOutstandingRequests

      public int getCompactionMaxOutstandingRequests()
      Get the maximum number of entries which can be compacted without flushing. Default is 100,000.
      Returns:
      the maximum number of unflushed entries
    • setCompactionMaxOutstandingRequests

      public ServerConfiguration setCompactionMaxOutstandingRequests(int maxOutstandingRequests)
      Set the maximum number of entries which can be compacted without flushing.

      When compacting, the entries are written to the entrylog and the new offsets are cached in memory. Once the entrylog is flushed the index is updated with the new offsets. This parameter controls the number of entries added to the entrylog before a flush is forced. A higher value for this parameter means more memory will be used for offsets. Each offset consists of 3 longs.

      This parameter should _not_ be modified unless you know what you're doing. The default is 100,000.

      Parameters:
      maxOutstandingRequests - number of entries to compact before flushing
      Returns:
      ServerConfiguration
    • getCompactionRate

      @Deprecated public int getCompactionRate()
      Deprecated.
      Get the rate of compaction adds. Default is 1,000.
      Returns:
      rate of compaction (adds per second)
    • setCompactionRate

      public ServerConfiguration setCompactionRate(int rate)
      Set the rate of compaction adds.
      Parameters:
      rate - rate of compaction adds (adds entries per second)
      Returns:
      ServerConfiguration
    • getCompactionRateByEntries

      public int getCompactionRateByEntries()
      Get the rate of compaction adds. Default is 1,000.
      Returns:
      rate of compaction (adds entries per second)
    • setCompactionRateByEntries

      public ServerConfiguration setCompactionRateByEntries(int rate)
      Set the rate of compaction adds.
      Parameters:
      rate - rate of compaction adds (adds entries per second)
      Returns:
      ServerConfiguration
    • getCompactionRateByBytes

      public int getCompactionRateByBytes()
      Get the rate of compaction adds. Default is 1,000,000.
      Returns:
      rate of compaction (adds bytes per second)
    • setCompactionRateByBytes

      public ServerConfiguration setCompactionRateByBytes(int rate)
      Set the rate of compaction adds.
      Parameters:
      rate - rate of compaction adds (adds bytes per second)
      Returns:
      ServerConfiguration
    • getEntryLocationCompactionInterval

      public long getEntryLocationCompactionInterval()
      Get interval to run entry location compaction, in seconds.

      If it is set to less than zero, the entry location compaction is disabled.

      Returns:
      high water mark.
    • setEntryLocationCompactionInterval

      public ServerConfiguration setEntryLocationCompactionInterval(long interval)
      Set interval to run entry location compaction.
      Parameters:
      interval - Interval to run entry location compaction
      Returns:
      server configuration
      See Also:
    • getJournalRemovePagesFromCache

      @Beta public boolean getJournalRemovePagesFromCache()
      Should we remove pages from page cache after force write.
      Returns:
      remove pages from cache
    • setJournalRemovePagesFromCache

      public ServerConfiguration setJournalRemovePagesFromCache(boolean enabled)
      Sets that whether should we remove pages from page cache after force write.
      Parameters:
      enabled - - true if we need to remove pages from page cache. otherwise, false
      Returns:
      ServerConfiguration
    • getLedgerStorageClass

      public String getLedgerStorageClass()
    • setLedgerStorageClass

      public ServerConfiguration setLedgerStorageClass(String ledgerStorageClass)
      Set the LedgerStorage implementation class name.
      Parameters:
      ledgerStorageClass - the class name
      Returns:
      ServerConfiguration
    • getUseHostNameAsBookieID

      public boolean getUseHostNameAsBookieID()
      Get whether bookie is using hostname for registration and in ledger metadata. Defaults to false.
      Returns:
      true, then bookie will be registered with its hostname and hostname will be used in ledger metadata. Otherwise bookie will use its ipaddress
    • setUseHostNameAsBookieID

      public ServerConfiguration setUseHostNameAsBookieID(boolean useHostName)
      Configure the bookie to use its hostname to register with the co-ordination service(eg: zookeeper) and in ledger metadata.
      Parameters:
      useHostName - whether to use hostname for registration and in ledgermetadata
      Returns:
      server configuration
      See Also:
    • getUseShortHostName

      public boolean getUseShortHostName()
      If bookie is using hostname for registration and in ledger metadata then whether to use short hostname or FQDN hostname. Defaults to false.
      Returns:
      true, then bookie will be registered with its short hostname and short hostname will be used in ledger metadata. Otherwise bookie will use its FQDN hostname
    • setUseShortHostName

      public ServerConfiguration setUseShortHostName(boolean useShortHostName)
      Configure the bookie to use its short hostname or FQDN hostname to register with the co-ordination service(eg: zookeeper) and in ledger metadata.
      Parameters:
      useShortHostName - whether to use short hostname for registration and in ledgermetadata
      Returns:
      server configuration
      See Also:
    • isEnableLocalTransport

      public boolean isEnableLocalTransport()
      Get whether to listen for local JVM clients. Defaults to false.
      Returns:
      true, then bookie will be listen for local JVM clients
    • setEnableLocalTransport

      public ServerConfiguration setEnableLocalTransport(boolean enableLocalTransport)
      Configure the bookie to listen for BookKeeper clients executed on the local JVM.
      Parameters:
      enableLocalTransport - whether to use listen for local JVM clients
      Returns:
      server configuration
      See Also:
    • isDisableServerSocketBind

      public boolean isDisableServerSocketBind()
      Get whether to disable bind of server-side sockets. Defaults to false.
      Returns:
      true, then bookie will not listen for network connections
    • setDisableServerSocketBind

      public ServerConfiguration setDisableServerSocketBind(boolean disableServerSocketBind)
      Configure the bookie to disable bind on network interfaces, this bookie will be available only to BookKeeper clients executed on the local JVM.
      Parameters:
      disableServerSocketBind - whether to disable binding on network interfaces
      Returns:
      server configuration
      See Also:
    • getStatsProviderClass

      public Class<? extends StatsProvider> getStatsProviderClass() throws org.apache.commons.configuration2.ex.ConfigurationException
      Get the stats provider used by bookie.
      Returns:
      stats provider class
      Throws:
      org.apache.commons.configuration2.ex.ConfigurationException
    • setStatsProviderClass

      public ServerConfiguration setStatsProviderClass(Class<? extends StatsProvider> providerClass)
      Set the stats provider used by bookie.
      Parameters:
      providerClass - stats provider class
      Returns:
      server configuration
    • isSanityCheckMetricsEnabled

      public boolean isSanityCheckMetricsEnabled()
      Flag to enable sanity check metrics in bookie stats. Defaults to false/disabled.
      Returns:
      true, if bookie collects sanity check metrics in stats
    • setSanityCheckMetricsEnabled

      public ServerConfiguration setSanityCheckMetricsEnabled(boolean sanityCheckMetricsEnabled)
      Enable sanity check metrics in bookie stats.
      Parameters:
      sanityCheckMetricsEnabled - flag to enable sanity check metrics
      Returns:
      server configuration
    • validate

      public void validate() throws org.apache.commons.configuration2.ex.ConfigurationException
      Validate the configuration.
      Throws:
      org.apache.commons.configuration2.ex.ConfigurationException
    • getRecvByteBufAllocatorSizeInitial

      public int getRecvByteBufAllocatorSizeInitial()
      Get Recv ByteBuf allocator initial buf size.
      Returns:
      initial byteBuf size
    • setRecvByteBufAllocatorSizeInitial

      public void setRecvByteBufAllocatorSizeInitial(int size)
      Set Recv ByteBuf allocator initial buf size.
      Parameters:
      size - buffer size
    • getRecvByteBufAllocatorSizeMin

      public int getRecvByteBufAllocatorSizeMin()
      Get Recv ByteBuf allocator min buf size.
      Returns:
      min byteBuf size
    • setRecvByteBufAllocatorSizeMin

      public void setRecvByteBufAllocatorSizeMin(int size)
      Set Recv ByteBuf allocator min buf size.
      Parameters:
      size - buffer size
    • getRecvByteBufAllocatorSizeMax

      public int getRecvByteBufAllocatorSizeMax()
      Get Recv ByteBuf allocator max buf size.
      Returns:
      max byteBuf size
    • setRecvByteBufAllocatorSizeMax

      public void setRecvByteBufAllocatorSizeMax(int size)
      Set Recv ByteBuf allocator max buf size.
      Parameters:
      size - buffer size
    • setBookieAuthProviderFactoryClass

      public void setBookieAuthProviderFactoryClass(String factoryClass)
      Set the bookie authentication provider factory class name. If this is not set, no authentication will be used.
      Parameters:
      factoryClass - the bookie authentication provider factory class name
    • getBookieAuthProviderFactoryClass

      public String getBookieAuthProviderFactoryClass()
      Get the bookie authentication provider factory class name. If this returns null, no authentication will take place.
      Returns:
      the bookie authentication provider factory class name or null.
    • setNettyMaxFrameSizeBytes

      public ServerConfiguration setNettyMaxFrameSizeBytes(int maxSize)
      Set the max number of bytes a single message can be that is read by the bookie. Any message larger than that size will be rejected.
      Overrides:
      setNettyMaxFrameSizeBytes in class AbstractConfiguration<ServerConfiguration>
      Parameters:
      maxSize - the max size in bytes
      Returns:
      server configuration
    • getTLSTrustStoreType

      public String getTLSTrustStoreType()
      Get the truststore type for client. Default is JKS.
      Returns:
    • setTLSKeyStoreType

      public ServerConfiguration setTLSKeyStoreType(String arg)
      Set the keystore type for client.
      Returns:
    • getTLSKeyStore

      public String getTLSKeyStore()
      Get the keystore path for the client.
      Returns:
    • setTLSKeyStore

      public ServerConfiguration setTLSKeyStore(String arg)
      Set the keystore path for the client.
      Returns:
    • getTLSKeyStorePasswordPath

      public String getTLSKeyStorePasswordPath()
      Get the path to file containing keystore password if the client keystore is password protected. Default is null.
      Returns:
    • setTLSKeyStorePasswordPath

      public ServerConfiguration setTLSKeyStorePasswordPath(String arg)
      Set the path to file containing keystore password, if the client keystore is password protected.
      Returns:
    • getTLSKeyStoreType

      public String getTLSKeyStoreType()
      Get the keystore type for client. Default is JKS.
      Returns:
    • setTLSTrustStoreType

      public ServerConfiguration setTLSTrustStoreType(String arg)
      Set the truststore type for client.
      Returns:
    • getTLSTrustStore

      public String getTLSTrustStore()
      Get the truststore path for the client.
      Returns:
    • setTLSTrustStore

      public ServerConfiguration setTLSTrustStore(String arg)
      Set the truststore path for the client.
      Returns:
    • getTLSTrustStorePasswordPath

      public String getTLSTrustStorePasswordPath()
      Get the path to file containing truststore password if the client truststore is password protected. Default is null.
      Returns:
    • setTLSTrustStorePasswordPath

      public ServerConfiguration setTLSTrustStorePasswordPath(String arg)
      Set the path to file containing truststore password, if the client truststore is password protected.
      Returns:
    • getTLSCertificatePath

      public String getTLSCertificatePath()
      Get the path to file containing TLS Certificate.
      Returns:
    • setTLSCertificatePath

      public ServerConfiguration setTLSCertificatePath(String arg)
      Set the path to file containing TLS Certificate.
      Returns:
    • getEnableTaskExecutionStats

      public boolean getEnableTaskExecutionStats()
      Whether to enable recording task execution stats.
      Returns:
      flag to enable/disable recording task execution stats.
    • setEnableTaskExecutionStats

      public ServerConfiguration setEnableTaskExecutionStats(boolean enabled)
      Enable/Disable recording task execution stats.
      Parameters:
      enabled - flag to enable/disable recording task execution stats.
      Returns:
      client configuration.
    • getMinUsableSizeForIndexFileCreation

      public long getMinUsableSizeForIndexFileCreation()
      Gets the minimum safe Usable size to be available in index directory for Bookie to create Index File while replaying journal at the time of Bookie Start in Readonly Mode (in bytes).
      Returns:
      minimum safe usable size to be available in index directory for bookie to create index files.
      See Also:
    • setMinUsableSizeForIndexFileCreation

      public ServerConfiguration setMinUsableSizeForIndexFileCreation(long minUsableSizeForIndexFileCreation)
      Sets the minimum safe Usable size to be available in index directory for Bookie to create Index File while replaying journal at the time of Bookie Start in Readonly Mode (in bytes).

      This parameter allows creating index files when there are enough disk spaces, even when the bookie is running at readonly mode because of the disk usage is exceeding getDiskUsageThreshold(). Because compaction, journal replays can still write index files to disks when a bookie is readonly.

      Parameters:
      minUsableSizeForIndexFileCreation - min usable size for index file creation
      Returns:
      server configuration
    • getMinUsableSizeForEntryLogCreation

      public long getMinUsableSizeForEntryLogCreation()
      Gets the minimum safe usable size to be available in ledger directory for Bookie to create entry log files.
      Returns:
      minimum safe usable size to be available in ledger directory for entry log file creation.
      See Also:
    • setMinUsableSizeForEntryLogCreation

      public ServerConfiguration setMinUsableSizeForEntryLogCreation(long minUsableSizeForEntryLogCreation)
      Sets the minimum safe usable size to be available in ledger directory for Bookie to create entry log files.

      This parameter allows creating entry log files when there are enough disk spaces, even when the bookie is running at readonly mode because of the disk usage is exceeding getDiskUsageThreshold(). Because compaction, journal replays can still write data to disks when a bookie is readonly.

      Parameters:
      minUsableSizeForEntryLogCreation - minimum safe usable size to be available in ledger directory
      Returns:
      server configuration
    • getMinUsableSizeForHighPriorityWrites

      public long getMinUsableSizeForHighPriorityWrites()
      Gets the minimum safe usable size to be available in ledger directory for Bookie to accept high priority writes.

      If not set, it is the value of getMinUsableSizeForEntryLogCreation().

      Returns:
      the minimum safe usable size per ledger directory for bookie to accept high priority writes.
    • setMinUsableSizeForHighPriorityWrites

      public ServerConfiguration setMinUsableSizeForHighPriorityWrites(long minUsableSizeForHighPriorityWrites)
      Sets the minimum safe usable size to be available in ledger directory for Bookie to accept high priority writes.
      Parameters:
      minUsableSizeForHighPriorityWrites - minimum safe usable size per ledger directory for Bookie to accept high priority writes
      Returns:
      server configuration.
    • isAllowMultipleDirsUnderSameDiskPartition

      public boolean isAllowMultipleDirsUnderSameDiskPartition()
      returns whether it is allowed to have multiple ledger/index/journal Directories in the same filesystem diskpartition.
      Returns:
    • setAllowMultipleDirsUnderSameDiskPartition

      public ServerConfiguration setAllowMultipleDirsUnderSameDiskPartition(boolean allow)
      Configure the Bookie to allow/disallow multiple ledger/index/journal directories in the same filesystem diskpartition.
      Parameters:
      allow -
      Returns:
      server configuration object.
    • isHttpServerEnabled

      public boolean isHttpServerEnabled()
      Get whether to start the http server or not.
      Returns:
      true - if http server should start
    • setHttpServerEnabled

      public ServerConfiguration setHttpServerEnabled(boolean enabled)
      Set whether to start the http server or not.
      Parameters:
      enabled - - true if we should start http server
      Returns:
      ServerConfiguration
    • getHttpServerPort

      public int getHttpServerPort()
      Get the http server port.
      Returns:
      http server port
    • setHttpServerPort

      public ServerConfiguration setHttpServerPort(int port)
      Set Http server port listening on.
      Parameters:
      port - Port to listen on
      Returns:
      server configuration
    • getHttpServerHost

      public String getHttpServerHost()
      Get the http server host.
      Returns:
      http server host
    • setHttpServerHost

      public ServerConfiguration setHttpServerHost(String host)
      Set Http server host listening on.
      Parameters:
      host - host to listen on
      Returns:
      server configuration
    • isHttpServerTlsEnable

      public boolean isHttpServerTlsEnable()
      Get if Http Server Tls enable.
      Returns:
    • setHttpServerTlsEnable

      public ServerConfiguration setHttpServerTlsEnable(boolean tlsEnable)
      Set if Http Server Tls enable.
      Parameters:
      tlsEnable -
      Returns:
      server configuration
    • getHttpServerKeystorePath

      public String getHttpServerKeystorePath()
      Get the http server keystore path.
      Returns:
      http server keystore path
    • setHttpServerKeystorePath

      public ServerConfiguration setHttpServerKeystorePath(String keystorePath)
      Set Http server keystore path.
      Parameters:
      keystorePath - http server keystore path
      Returns:
      server configuration
    • getHttpServerKeystorePassword

      public String getHttpServerKeystorePassword()
      Get the http server keyStore password.
      Returns:
      http server keyStore password
    • setHttpServerKeyStorePassword

      public ServerConfiguration setHttpServerKeyStorePassword(String keyStorePassword)
      Set Http server keyStore password.
      Parameters:
      keyStorePassword - http server keyStore password
      Returns:
      server configuration
    • getHttpServerTrustStorePath

      public String getHttpServerTrustStorePath()
      Get the http server trustStore path.
      Returns:
      http server trustStore path
    • setHttpServerTrustStorePath

      public ServerConfiguration setHttpServerTrustStorePath(String trustStorePath)
      Set Http server trustStore path.
      Parameters:
      trustStorePath - http server trustStore path
      Returns:
      server configuration
    • getHttpServerTrustStorePassword

      public String getHttpServerTrustStorePassword()
      Get the http server trustStore password.
      Returns:
      http server trustStore password
    • setHttpServerTrustStorePasswordPassword

      public ServerConfiguration setHttpServerTrustStorePasswordPassword(String trustStorePassword)
      Set Http server trustStore password.
      Parameters:
      trustStorePassword - http server trustStore password
      Returns:
      server configuration
    • getExtraServerComponents

      public String[] getExtraServerComponents()
      Get the extra list of server lifecycle components to enable on a bookie server.
      Returns:
      the extra list of server lifecycle components to enable on a bookie server.
    • setExtraServerComponents

      public ServerConfiguration setExtraServerComponents(String[] componentClasses)
      Set the extra list of server lifecycle components to enable on a bookie server.
      Parameters:
      componentClasses - the list of server lifecycle components to enable on a bookie server.
      Returns:
      server configuration.
    • getIgnoreExtraServerComponentsStartupFailures

      public boolean getIgnoreExtraServerComponentsStartupFailures()
      Return the flag whether to ignore startup failures on loading server components specified at getExtraServerComponents().
      Returns:
      the flag whether to ignore startup failures on loading server components specified at getExtraServerComponents(). The default value is false.
    • setIgnoreExtraServerComponentsStartupFailures

      public ServerConfiguration setIgnoreExtraServerComponentsStartupFailures(boolean enabled)
      Set the flag whether to ignore startup failures on loading server components specified at getExtraServerComponents().
      Parameters:
      enabled - flag to enable/disable ignoring startup failures on loading server components.
      Returns:
      server configuration.
    • getServerWriteBufferLowWaterMark

      public int getServerWriteBufferLowWaterMark()
      Get server netty channel write buffer low water mark.
      Returns:
      netty channel write buffer low water mark.
    • setServerWriteBufferLowWaterMark

      public ServerConfiguration setServerWriteBufferLowWaterMark(int waterMark)
      Set server netty channel write buffer low water mark.
      Parameters:
      waterMark - netty channel write buffer low water mark.
      Returns:
      client configuration.
    • getServerWriteBufferHighWaterMark

      public int getServerWriteBufferHighWaterMark()
      Get server netty channel write buffer high water mark.
      Returns:
      netty channel write buffer high water mark.
    • setServerWriteBufferHighWaterMark

      public ServerConfiguration setServerWriteBufferHighWaterMark(int waterMark)
      Set server netty channel write buffer high water mark.
      Parameters:
      waterMark - netty channel write buffer high water mark.
      Returns:
      client configuration.
    • setRegistrationManagerClass

      @Deprecated public void setRegistrationManagerClass(Class<? extends RegistrationManager> regManagerClass)
      Deprecated.
      Set registration manager class.
      Parameters:
      regManagerClass - ManagerClass
    • getRegistrationManagerClass

      @Deprecated public Class<? extends RegistrationManager> getRegistrationManagerClass() throws org.apache.commons.configuration2.ex.ConfigurationException
      Deprecated.
      since 4.7.0, in favor of using AbstractConfiguration.getMetadataServiceUri()
      Get Registration Manager Class.
      Returns:
      registration manager class.
      Throws:
      org.apache.commons.configuration2.ex.ConfigurationException
    • getThis

      protected ServerConfiguration getThis()
      Description copied from class: AbstractConfiguration
      Trickery to allow inheritance with fluent style.
      Specified by:
      getThis in class AbstractConfiguration<ServerConfiguration>
    • isEntryLogPerLedgerEnabled

      public boolean isEntryLogPerLedgerEnabled()
    • setEntryLogPerLedgerEnabled

      public ServerConfiguration setEntryLogPerLedgerEnabled(boolean entryLogPerLedgerEnabled)
    • getNumOfMemtableFlushThreads

      public int getNumOfMemtableFlushThreads()
    • setNumOfMemtableFlushThreads

      public ServerConfiguration setNumOfMemtableFlushThreads(int numOfMemtableFlushThreads)
    • getEntrylogMapAccessExpiryTimeInSeconds

      public int getEntrylogMapAccessExpiryTimeInSeconds()
    • setEntrylogMapAccessExpiryTimeInSeconds

      public ServerConfiguration setEntrylogMapAccessExpiryTimeInSeconds(int entrylogMapAccessExpiryTimeInSeconds)
    • getMaximumNumberOfActiveEntryLogs

      public int getMaximumNumberOfActiveEntryLogs()
    • setMaximumNumberOfActiveEntryLogs

      public ServerConfiguration setMaximumNumberOfActiveEntryLogs(int maximumNumberOfActiveEntryLogs)
    • getEntryLogPerLedgerCounterLimitsMultFactor

      public int getEntryLogPerLedgerCounterLimitsMultFactor()
    • setEntryLogPerLedgerCounterLimitsMultFactor

      public ServerConfiguration setEntryLogPerLedgerCounterLimitsMultFactor(int entryLogPerLedgerCounterLimitsMultFactor)
    • isLocalConsistencyCheckOnStartup

      public boolean isLocalConsistencyCheckOnStartup()
      True if a local consistency check should be performed on startup.
    • getAuthorizedRoles

      public String[] getAuthorizedRoles()
      Get the authorized roles.
      Returns:
      String array of configured auth roles.
    • setAuthorizedRoles

      public ServerConfiguration setAuthorizedRoles(String roles)
      Set authorized roles.
      Returns:
      Configuration Object with roles set
    • getInFlightReadEntryNumInLedgerChecker

      public int getInFlightReadEntryNumInLedgerChecker()
      Get in flight read entry number when ledger checker. Default value is -1 which it is unlimited when ledger checker.
      Returns:
      read entry number of in flight.
    • setDataIntegrityCheckingEnabled

      public ServerConfiguration setDataIntegrityCheckingEnabled(boolean enabled)
      Enabled data integrity checker. The data integrity checker checks that the bookie has all the entries which ledger metadata asserts it has. The checker runs on startup (periodic will be added later). The changes how cookies are handled. If a directory is found to be missing a cookie, the check runs. The check is divided into two parts, preboot and full. The preboot check ensures that it is safe to boot the bookie; the bookie will not vote in any operation that contradicts a previous vote. The full check ensures that any ledger that claims to have entries on the bookie, truly does have data on the bookie. Any missing entries are copies from available replicas.
    • isDataIntegrityCheckingEnabled

      public boolean isDataIntegrityCheckingEnabled()
      See Also:
    • setDataIntegrityStampMissingCookiesEnabled

      public ServerConfiguration setDataIntegrityStampMissingCookiesEnabled(boolean enabled)
      When this config is set to true and the data integrity checker is also enabled then any missing cookie files in the ledger directories do not prevent the bookie from booting. Missing cookie files usually indicate an empty disk has been mounted, which might be after a disk failure (all data lost) or a provisioning error (wrong disk mounted). If there are missing cookie files then: - a new cookie is stamped (written to each ledger directory and to the co-ordination service, eg: zookeeper). - the data integrity checker will attempt to repair any lost data by sourcing the lost entries from other bookies If any cookies do not match the master cookie, then cookie validation still fails as normal.
    • isDataIntegrityStampMissingCookiesEnabled

      public boolean isDataIntegrityStampMissingCookiesEnabled()
      See Also:
    • setSkipReplayJournalInvalidRecord

      public ServerConfiguration setSkipReplayJournalInvalidRecord(boolean skipReplayJournalInvalidRecord)
      When this config is set to true,if we replay journal failed, we will skip.
      Parameters:
      skipReplayJournalInvalidRecord -
      Returns:
    • isSkipReplayJournalInvalidRecord

      public boolean isSkipReplayJournalInvalidRecord()
      See Also:
    • getDefaultRocksDBConf

      public String getDefaultRocksDBConf()
      Get default rocksdb conf.
      Returns:
      String configured default rocksdb conf.
    • setDefaultRocksDBConf

      public ServerConfiguration setDefaultRocksDBConf(String defaultRocksdbConf)
      Set default rocksdb conf.
      Returns:
      Configuration Object with default rocksdb conf
    • getEntryLocationRocksdbConf

      public String getEntryLocationRocksdbConf()
      Get entry Location rocksdb conf.
      Returns:
      String configured entry Location rocksdb conf.
    • setEntryLocationRocksdbConf

      public ServerConfiguration setEntryLocationRocksdbConf(String entryLocationRocksdbConf)
      Set entry Location rocksdb conf.
      Returns:
      Configuration Object with entry Location rocksdb conf
    • getLedgerMetadataRocksdbConf

      public String getLedgerMetadataRocksdbConf()
      Get ledger metadata rocksdb conf.
      Returns:
      String configured ledger metadata rocksdb conf.
    • setLedgerMetadataRocksdbConf

      public ServerConfiguration setLedgerMetadataRocksdbConf(String ledgerMetadataRocksdbConf)
      Set ledger metadata rocksdb conf.
      Returns:
      Configuration Object with ledger metadata rocksdb conf
    • setOperationMaxNumbersInSingleRocksDBWriteBatch

      public ServerConfiguration setOperationMaxNumbersInSingleRocksDBWriteBatch(int maxNumbersInSingleRocksDBBatch)
      Set the max operation numbers in a single rocksdb write batch. The rocksdb write batch is related to the memory usage. If the batch is too large, it will cause the OOM.
      Parameters:
      maxNumbersInSingleRocksDBBatch -
      Returns:
    • getMaxOperationNumbersInSingleRocksDBBatch

      public int getMaxOperationNumbersInSingleRocksDBBatch()
      Get the max operation numbers in a single rocksdb write batch.
      Returns:
    • setMaxBatchReadSize

      public ServerConfiguration setMaxBatchReadSize(long maxBatchReadSize)
      Set the max batch read size.
      Parameters:
      maxBatchReadSize -
      Returns:
    • getMaxBatchReadSize

      public long getMaxBatchReadSize()
      Get the max batch read size.
      Returns: