Skip to content

Commit 6b8624c

Browse files
committed
update README.md
1 parent a3bdfa2 commit 6b8624c

File tree

2 files changed

+24
-15
lines changed

2 files changed

+24
-15
lines changed

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,29 @@ Default: 0
267267

268268
I/O read timeout. The value must be a decimal number with a unit suffix (*"ms"*, *"s"*, *"m"*, *"h"*), such as *"30s"*, *"0.5m"* or *"1m30s"*.
269269

270+
##### `rejectReadOnly`
271+
272+
```
273+
Type: bool
274+
Valid Values: true, false
275+
Default: false
276+
```
277+
278+
279+
RejectreadOnly causes mysql driver to reject read-only connections. This is
280+
specifically for AWS Aurora: During a failover, there seems to be a race
281+
condition on Aurora, where we get connected to the [old master before
282+
failover], i.e. the [new read-only slave after failover].
283+
284+
Note that this should be a fairly rare case, as automatic failover normally
285+
happens when master is down, and the race condition shouldn't happen unless it
286+
comes back up online as soon as the failover is kicked off. But it's pretty
287+
easy to reproduce using a manual failover. In case this happens, we should
288+
reconnect to the Aurora cluster by returning a driver.ErrBadConnection.
289+
290+
tl;dr: Set this if you are using Aurora.
291+
292+
270293
##### `strict`
271294

272295
```

dsn.go

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,8 @@ type Config struct {
5353
InterpolateParams bool // Interpolate placeholders into query string
5454
MultiStatements bool // Allow multiple statements in one query
5555
ParseTime bool // Parse time values to time.Time
56+
RejectReadOnly bool // Reject read-only connections; see README.md
5657
Strict bool // Return warnings as errors
57-
58-
// RejectreadOnly causes mysql driver to reject read-only connections. This
59-
// is specifically for AWS Aurora: During a failover, there seems to be a
60-
// race condition on Aurora, where we get connected to the [old master
61-
// before failover], i.e. the [new read-only slave after failover].
62-
//
63-
// Note that this should be a fairly rare case, as automatic failover
64-
// normally happens when master is down, and the race condition shouldn't
65-
// happen unless it comes back up online as soon as the failover is kicked
66-
// off. But it's pretty easy to reproduce using a manual failover. In case
67-
// this happens, we should reconnect to the Aurora cluster by returning a
68-
// driver.ErrBadConnection.
69-
//
70-
// tl;dr: Set this if you are using Aurora.
71-
RejectReadOnly bool
7258
}
7359

7460
// FormatDSN formats the given Config into a DSN string which can be passed to

0 commit comments

Comments
 (0)