Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ In addition to the parameters that you can configure for the underlying driver,
| `failoverWriterReconnectIntervalMs` | Integer | No | Interval of time in milliseconds to wait between attempts to reconnect to a failed writer during a writer failover process. | `2000` |
| `enableConnectFailover` | Boolean | No | Enables/disables cluster-aware failover if the initial connection to the database fails due to a network exception. Note that this may result in a connection to a different instance in the cluster than was specified by the URL. | `false` |
| `skipFailoverOnInterruptedThread` | Boolean | No | Enable to skip failover if the current thread is interrupted. This may leave the Connection in an invalid state so the Connection should be disposed. | `false` |
| ~~`keepSessionStateOnFailover`~~ | Boolean | No | This parameter is no longer available. If specified, it will be ignored by the driver. See [Session State](../SessionState.md) for more details. | `false` |
| ~~`enableFailoverStrictReader`~~ | Boolean | No | This parameter is no longer available and, if specified, it will be ignored by the driver. See `failoverMode` (`reader-or-writer` or `strict-reader`) for more details. | |


## Host Pattern
When connecting to Aurora clusters, the [`clusterInstanceHostPattern`](#failover-parameters) parameter is required if the connection string does not provide enough information about the database cluster domain name. If the Aurora cluster endpoint is used directly, the AWS JDBC Driver will recognize the standard Aurora domain name and can re-build a proper Aurora instance name when needed. In cases where the connection string uses an IP address, a custom domain name, or localhost, the driver won't know how to build a proper domain name for a database instance endpoint. For example, if a custom domain was being used and the cluster instance endpoints followed a pattern of `instanceIdentifier1.customHost`, `instanceIdentifier2.customHost`, etc., the driver would need to know how to construct the instance endpoints using the specified custom domain. Since there isn't enough information from the custom domain alone to create the instance endpoints, you should set the `clusterInstanceHostPattern` to `?.customHost`, making the connection string `jdbc:aws-wrapper:postgresql://customHost:1234/test?clusterInstanceHostPattern=?.customHost`. Refer to [this diagram](../../images/failover_behavior.png) about AWS JDBC Driver behavior during failover for different connection URLs and more details and examples.
Expand Down
4 changes: 0 additions & 4 deletions examples/SpringTxFailoverExample/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,8 @@ spring:
max-lifetime: 1260000
auto-commit: false
maximum-pool-size: 3
data-source-properties:
keepSessionStateOnFailover: true
```

Please also note the use of the [`keepSessionStateOnFailover`](https://github.com/aws/aws-advanced-jdbc-wrapper/blob/main/docs/using-the-jdbc-driver/using-plugins/UsingTheFailoverPlugin.md#failover-parameters) property. When failover occurs, the connection's auto commit value is reset to true. When the auto commit value is set to false or transactions are used, further operations such as a rollback or commit on the same connection will cause errors. This parameter is used when connections cannot be reconfigured manually as seen in this [example](https://github.com/aws/aws-advanced-jdbc-wrapper/tree/main/examples/AWSDriverExample/src/main/java/software/amazon/PgFailoverSample.java).

## Step 4: Set up a data access object

Set up a simple data access object (DAO) interface and implementation. The data access object will be responsible for executing any queries. In this tutorial, only a get method will be included, but other methods are available within the sample code.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ spring:
max-lifetime: 1260000
auto-commit: false
maximum-pool-size: 3
data-source-properties:
keepSessionStateOnFailover: true

Original file line number Diff line number Diff line change
Expand Up @@ -505,11 +505,11 @@ public void test_takeOverConnectionProperties() throws SQLException {

/**
* Current writer dies, a reader instance is nominated to be a new writer, failover to the new
* writer. Autocommit is set to false and the keepSessionStateOnFailover property is set to true.
* writer. Autocommit is set to false.
*/
@TestTemplate
@EnableOnNumOfInstances(min = 2)
public void test_failFromWriterWhereKeepSessionStateOnFailoverIsTrue() throws SQLException {
public void test_failFromWriter() throws SQLException {

final String initialWriterId = this.currentWriter;
TestInstanceInfo initialWriterInstanceInfo =
Expand Down
Loading