File tree Expand file tree Collapse file tree 4 files changed +55
-0
lines changed
java/com/datastax/oss/driver/api/core/config Expand file tree Collapse file tree 4 files changed +55
-0
lines changed Original file line number Diff line number Diff line change @@ -141,6 +141,17 @@ public enum DefaultDriverOption implements DriverOption {
141141 * <p>Value-type: boolean
142142 */
143143 CONNECTION_WARN_INIT_ERROR ("advanced.connection.warn-on-init-error" ),
144+ /**
145+ * Whether to use advanced shard awareness.
146+ *
147+ * <p>Value-type: boolean
148+ */
149+ CONNECTION_ADVANCED_SHARD_AWARENESS_ENABLED (
150+ "advanced.connection.advanced-shard-awareness.enabled" ),
151+ /** Inclusive lower bound of port range to use in advanced shard awareness */
152+ ADVANCED_SHARD_AWARENESS_PORT_LOW ("advanced.connection.advanced-shard-awareness.port-low" ),
153+ /** Inclusive upper bound of port range to use in advanced shard awareness */
154+ ADVANCED_SHARD_AWARENESS_PORT_HIGH ("advanced.connection.advanced-shard-awareness.port-high" ),
144155 /**
145156 * The number of connections in the LOCAL pool.
146157 *
Original file line number Diff line number Diff line change @@ -276,6 +276,9 @@ protected static void fillWithDriverDefaults(OptionsMap map) {
276276 map .put (TypedDriverOption .CONNECTION_MAX_REQUESTS , 1024 );
277277 map .put (TypedDriverOption .CONNECTION_MAX_ORPHAN_REQUESTS , 256 );
278278 map .put (TypedDriverOption .CONNECTION_WARN_INIT_ERROR , true );
279+ map .put (TypedDriverOption .CONNECTION_ADVANCED_SHARD_AWARENESS_ENABLED , true );
280+ map .put (TypedDriverOption .ADVANCED_SHARD_AWARENESS_PORT_LOW , 10000 );
281+ map .put (TypedDriverOption .ADVANCED_SHARD_AWARENESS_PORT_HIGH , 60000 );
279282 map .put (TypedDriverOption .RECONNECT_ON_INIT , false );
280283 map .put (TypedDriverOption .RECONNECTION_POLICY_CLASS , "ExponentialReconnectionPolicy" );
281284 map .put (TypedDriverOption .RECONNECTION_BASE_DELAY , Duration .ofSeconds (1 ));
Original file line number Diff line number Diff line change @@ -175,6 +175,18 @@ public String toString() {
175175 /** Whether to log non-fatal errors when the driver tries to open a new connection. */
176176 public static final TypedDriverOption <Boolean > CONNECTION_WARN_INIT_ERROR =
177177 new TypedDriverOption <>(DefaultDriverOption .CONNECTION_WARN_INIT_ERROR , GenericType .BOOLEAN );
178+ /** Whether to use advanced shard awareness */
179+ public static final TypedDriverOption <Boolean > CONNECTION_ADVANCED_SHARD_AWARENESS_ENABLED =
180+ new TypedDriverOption <>(
181+ DefaultDriverOption .CONNECTION_ADVANCED_SHARD_AWARENESS_ENABLED , GenericType .BOOLEAN );
182+ /** Inclusive lower bound of port range to use in advanced shard awareness */
183+ public static final TypedDriverOption <Integer > ADVANCED_SHARD_AWARENESS_PORT_LOW =
184+ new TypedDriverOption <>(
185+ DefaultDriverOption .ADVANCED_SHARD_AWARENESS_PORT_LOW , GenericType .INTEGER );
186+ /** Inclusive upper bound of port range to use in advanced shard awareness */
187+ public static final TypedDriverOption <Integer > ADVANCED_SHARD_AWARENESS_PORT_HIGH =
188+ new TypedDriverOption <>(
189+ DefaultDriverOption .ADVANCED_SHARD_AWARENESS_PORT_HIGH , GenericType .INTEGER );
178190 /** The number of connections in the LOCAL pool. */
179191 public static final TypedDriverOption <Integer > CONNECTION_POOL_LOCAL_SIZE =
180192 new TypedDriverOption <>(DefaultDriverOption .CONNECTION_POOL_LOCAL_SIZE , GenericType .INTEGER );
Original file line number Diff line number Diff line change @@ -535,6 +535,35 @@ datastax-java-driver {
535535 # change.
536536 # Overridable in a profile: no
537537 warn-on-init-error = true
538+
539+
540+ advanced-shard-awareness {
541+ # Whether to use advanced shard awareness when trying to open new connections.
542+ #
543+ # If set to false the driver will not attempt to use this feature.
544+ # If set to true the driver will attempt to use it but depending on result may fall back to
545+ # not using it.
546+ # TODO: expand this description a bit with examples
547+ # Required: yes
548+ # Modifiable at runtime: yes, the new value will be used for connections created after the
549+ # change.
550+ # Overridable in a profile: no
551+ enabled = true
552+
553+ # Inclusive lower bound of port range to use in advanced shard awareness
554+ # The driver will attempt to reserve ports for connection only within the range.
555+ # Required: yes
556+ # Modifiable at runtime: yes, the new value will be used for calls after the
557+ # change.
558+ port-low = 10000
559+
560+ # Inclusive upper bound of port range to use in advanced shard awareness.
561+ # The driver will attempt to reserve ports for connection only within the range.
562+ # Required: yes
563+ # Modifiable at runtime: yes, the new value will be used for calls after the
564+ # change.
565+ port-high = 60000
566+ }
538567 }
539568
540569 # Advanced options for the built-in load-balancing policies.
You can’t perform that action at this time.
0 commit comments