Class DatabaseOptions


  • public class DatabaseOptions
    extends java.lang.Object
    A set of options that can be set on a Database.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      OptionConsumer getOptionConsumer()
      Returns the object on which these options are being set.
      void setDatacenterId​(java.lang.String value)
      Specify the datacenter ID that was passed to fdbserver processes running in the same datacenter as this client, for better location-aware load balancing.
      void setLocationCacheSize​(long value)
      Set the size of the client location cache.
      void setMachineId​(java.lang.String value)
      Specify the machine ID that was passed to fdbserver processes running on the same machine as this client, for better location-aware load balancing.
      void setMaxWatches​(long value)
      Set the maximum number of watches allowed to be outstanding on a database connection.
      void setSnapshotRywDisable()
      Snapshot read operations will not see the results of writes done in the same transaction.
      void setSnapshotRywEnable()
      Snapshot read operations will see the results of writes done in the same transaction.
      void setTestCausalReadRisky()
      An integer between 0 and 100 (default is 0) expressing the probability that a client will verify it can't read stale data whenever it detects a recovery.
      void setTransactionBypassUnreadable()
      Allows get operations to read from sections of keyspace that have become unreadable because of versionstamp operations.
      void setTransactionCausalReadRisky()
      The read version will be committed, and usually will be the latest committed, but might not be the latest committed in the event of a simultaneous fault and misbehaving clock.
      void setTransactionIncludePortInAddress()
      Deprecated.
      void setTransactionLoggingMaxFieldLength​(long value)
      Sets the maximum escaped length of key and value fields to be logged to the trace file via the LOG_TRANSACTION option.
      void setTransactionMaxRetryDelay​(long value)
      Set the maximum amount of backoff delay incurred in the call to onError if the error is retryable.
      void setTransactionRetryLimit​(long value)
      Set a maximum number of retries after which additional calls to onError will throw the most recently seen error code.
      void setTransactionSizeLimit​(long value)
      Set the maximum transaction size in bytes.
      void setTransactionTimeout​(long value)
      Set a timeout in milliseconds which, when elapsed, will cause each transaction automatically to be cancelled.
      void setUseConfigDatabase()
      Use configuration database.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DatabaseOptions

        public DatabaseOptions​(OptionConsumer consumer)
    • Method Detail

      • setLocationCacheSize

        public void setLocationCacheSize​(long value)
        Set the size of the client location cache. Raising this value can boost performance in very large databases where clients access data in a near-random pattern. Defaults to 100000.
        Parameters:
        value - Max location cache entries
      • setMaxWatches

        public void setMaxWatches​(long value)
        Set the maximum number of watches allowed to be outstanding on a database connection. Increasing this number could result in increased resource usage. Reducing this number will not cancel any outstanding watches. Defaults to 10000 and cannot be larger than 1000000.
        Parameters:
        value - Max outstanding watches
      • setMachineId

        public void setMachineId​(java.lang.String value)
        Specify the machine ID that was passed to fdbserver processes running on the same machine as this client, for better location-aware load balancing.
        Parameters:
        value - Hexadecimal ID
      • setDatacenterId

        public void setDatacenterId​(java.lang.String value)
        Specify the datacenter ID that was passed to fdbserver processes running in the same datacenter as this client, for better location-aware load balancing.
        Parameters:
        value - Hexadecimal ID
      • setSnapshotRywEnable

        public void setSnapshotRywEnable()
        Snapshot read operations will see the results of writes done in the same transaction. This is the default behavior.
      • setSnapshotRywDisable

        public void setSnapshotRywDisable()
        Snapshot read operations will not see the results of writes done in the same transaction. This was the default behavior prior to API version 300.
      • setTransactionLoggingMaxFieldLength

        public void setTransactionLoggingMaxFieldLength​(long value)
        Sets the maximum escaped length of key and value fields to be logged to the trace file via the LOG_TRANSACTION option. This sets the transaction_logging_max_field_length option of each transaction created by this database. See the transaction option description for more information.
        Parameters:
        value - Maximum length of escaped key and value fields.
      • setTransactionTimeout

        public void setTransactionTimeout​(long value)
        Set a timeout in milliseconds which, when elapsed, will cause each transaction automatically to be cancelled. This sets the timeout option of each transaction created by this database. See the transaction option description for more information. Using this option requires that the API version is 610 or higher.
        Parameters:
        value - value in milliseconds of timeout
      • setTransactionRetryLimit

        public void setTransactionRetryLimit​(long value)
        Set a maximum number of retries after which additional calls to onError will throw the most recently seen error code. This sets the retry_limit option of each transaction created by this database. See the transaction option description for more information.
        Parameters:
        value - number of times to retry
      • setTransactionMaxRetryDelay

        public void setTransactionMaxRetryDelay​(long value)
        Set the maximum amount of backoff delay incurred in the call to onError if the error is retryable. This sets the max_retry_delay option of each transaction created by this database. See the transaction option description for more information.
        Parameters:
        value - value in milliseconds of maximum delay
      • setTransactionSizeLimit

        public void setTransactionSizeLimit​(long value)
        Set the maximum transaction size in bytes. This sets the size_limit option on each transaction created by this database. See the transaction option description for more information.
        Parameters:
        value - value in bytes
      • setTransactionCausalReadRisky

        public void setTransactionCausalReadRisky()
        The read version will be committed, and usually will be the latest committed, but might not be the latest committed in the event of a simultaneous fault and misbehaving clock.
      • setTransactionIncludePortInAddress

        @Deprecated
        public void setTransactionIncludePortInAddress()
        Deprecated.
        Deprecated. Addresses returned by get_addresses_for_key include the port when enabled. As of api version 630, this option is enabled by default and setting this has no effect.
      • setTransactionBypassUnreadable

        public void setTransactionBypassUnreadable()
        Allows get operations to read from sections of keyspace that have become unreadable because of versionstamp operations. This sets the bypass_unreadable option of each transaction created by this database. See the transaction option description for more information.
      • setUseConfigDatabase

        public void setUseConfigDatabase()
        Use configuration database.
      • setTestCausalReadRisky

        public void setTestCausalReadRisky()
        An integer between 0 and 100 (default is 0) expressing the probability that a client will verify it can't read stale data whenever it detects a recovery.
      • getOptionConsumer

        public OptionConsumer getOptionConsumer()
        Returns the object on which these options are being set. Rarely used by client code, since all options should be top-level methods on extending classes.
        Returns:
        target of option set calls