Skip to content

Conversation

@sergiyvamz
Copy link
Contributor

Summary

Introduce new configuration parameter "failoverMode"

Additional Reviewers

@karenc-bq
@aaron-congo
@davecramer

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@sergiyvamz sergiyvamz changed the title [WIP] Introduce new configuration parameter failoverMode Introduce new configuration parameter failoverMode May 9, 2023
@crystall-bitquill
Copy link
Contributor

The failover parameters table will also need to be updated.

this.failoverReaderConnectTimeoutMsSetting =
FAILOVER_READER_CONNECT_TIMEOUT_MS.getInteger(this.properties);
this.enableFailoverStrictReaderSetting = ENABLE_FAILOVER_STRICT_READER.getBoolean(this.properties);
this.failoverModeSetting = FailoverMode.fromValue(FAILOVER_MODE.getString(this.properties));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it work to remove the failoverModeSetting variable and just set set this.failoverMode to the value in the props? It looks like we set failoverMode to failoverModeSetting in initHostProvider anyways so I'm not sure if we need both variables

| `enableFailoverStrictReader` | Boolean | No | Set to `true` to only allow failover to reader nodes during the reader failover process. If enabled, reader failover to a writer node will only be allowed for single-node clusters. This logic mimics the logic of the Aurora read-only cluster endpoint. | `false` |
| Parameter | Value | Required | Description | Default Value |
|----------------------------------------|:-------:|:--------------------------------------------------------------------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `failoverMode` | String | No | Defines a mode for failover process. Failover process may prioritize nodes with different roles and connect to them. Possible values: <br><br>- `strict-writer` - Failover process follows writer node and connects to a new writer when it changes.<br>- `reader-or-writer` - During failover the driver tries to connect to any available/accessing reader node. If no reader is available, the driver can connect to a writer node. This logic mimics the logic of the Aurora read-only cluster endpoint.<br>- `strict-reader` - The driver tries to connect to any available reader node. If no reader is available, the driver raises an error. Reader failover to a writer node will only be allowed for single-node clusters. This logic mimics the logic of the Aurora read-only cluster endpoint.<br><br>If this parameter is omitted, default value depends on connection url. For Aurora read-only cluster endpoint, it's set to `reader-or-writer`. Otherwise, it's `strict-writer`. | Default value depends on connection url. For Aurora read-only cluster endpoint, it's set to `reader-or-writer`. Otherwise, it's `strict-writer`. |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I'd just say 'accessible' instead of 'available/accessing'

| `enableFailoverStrictReader` | Boolean | No | Set to `true` to only allow failover to reader nodes during the reader failover process. If enabled, reader failover to a writer node will only be allowed for single-node clusters. This logic mimics the logic of the Aurora read-only cluster endpoint. | `false` |
| Parameter | Value | Required | Description | Default Value |
|----------------------------------------|:-------:|:--------------------------------------------------------------------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `failoverMode` | String | No | Defines a mode for failover process. Failover process may prioritize nodes with different roles and connect to them. Possible values: <br><br>- `strict-writer` - Failover process follows writer node and connects to a new writer when it changes.<br>- `reader-or-writer` - During failover the driver tries to connect to any available/accessing reader node. If no reader is available, the driver can connect to a writer node. This logic mimics the logic of the Aurora read-only cluster endpoint.<br>- `strict-reader` - The driver tries to connect to any available reader node. If no reader is available, the driver raises an error. Reader failover to a writer node will only be allowed for single-node clusters. This logic mimics the logic of the Aurora read-only cluster endpoint.<br><br>If this parameter is omitted, default value depends on connection url. For Aurora read-only cluster endpoint, it's set to `reader-or-writer`. Otherwise, it's `strict-writer`. | Default value depends on connection url. For Aurora read-only cluster endpoint, it's set to `reader-or-writer`. Otherwise, it's `strict-writer`. |
Copy link
Contributor

@aaronchung-bitquill aaronchung-bitquill May 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"reader-or-writer - During failover the driver tries to connect to any available/accessing reader node."

  • Should accessing instead be accessible?

"If no reader is available, the driver can connect to a writer node."

  • Should change can to will.

"strict-reader - The driver tries to connect to any available reader node...."

  • Might be good to begin this something like "During failover, the driver tries....".

fix RW split tests
fix writer failover
@sergiyvamz sergiyvamz merged commit 3de926c into main May 10, 2023
@sergiyvamz sergiyvamz deleted the failover-mode branch May 10, 2023 21:29
@yanw-bq yanw-bq mentioned this pull request May 17, 2023
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants