Skip to content

Commit 5ca6740

Browse files
authored
Merge pull request #99 from SihangYu/sihang-mysql8
fix(mysql): Replace the deprecated system variable tx_isolation in MySQL 8.0
2 parents a76ce32 + 4c5b73f commit 5ca6740

8 files changed

+16
-16
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ services:
1313
- docker
1414

1515
install:
16-
- docker pull mysql:5.6
16+
- docker pull mysql:8.0
1717
- go get golang.org/x/lint/golint
1818
- go get github.com/kisielk/errcheck
1919

docs/How-to-deploy.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ for other users to get up and running quickly.
66
## Prerequisites
77

88
* [Spinnaker]
9-
* MySQL (5.6 or later)
9+
* MySQL (8.0 or later)
1010

1111
To use this version of Chaos Monkey, you must be using [Spinnaker] to manage your applications. Spinnaker is the
1212
continuous delivery platform that we use at Netflix.
1313

14-
Chaos Monkey also requires a MySQL-compatible database, version 5.6 or later.
14+
Chaos Monkey also requires a MySQL-compatible database, version 8.0 or later.
1515

1616
[Spinnaker]: http://www.spinnaker.io/
1717

docs/Running-locally.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ describes how to start both of those up using Docker containers
88
This will start up a MySQL container with the root password as `password`.
99

1010
```bash
11-
docker run -e MYSQL_ROOT_PASSWORD=password -p3306:3306 mysql:5.6
11+
docker run -e MYSQL_ROOT_PASSWORD=password -p3306:3306 mysql:8.0
1212
```

docs/dev/Running-tests.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@ root:password@tcp(127.0.0.1:3306)/
1818
### Testing with Docker
1919

2020
The simplest way to run these tests is to install Docker on your local machine.
21-
These tests use the `mysql:5.6` container (version 5.6 is used to ensure
21+
These tests use the `mysql:8.0` container (version 8.0 is used to ensure
2222
compatibility with [Amazon Aurora][1]).
2323

2424
Note that if you are on macOS, you must use [Docker for Mac][2], not Docker
2525
Toolbox. Otherwise, the Docker containers will not be accessible at 127.0.0.1.
2626

2727

2828
If you want to run these tests, ensure you have Docker installed locally, and
29-
grab the mysql:5.6 container:
29+
grab the mysql:8.0 container:
3030

3131
```bash
32-
docker pull mysql:5.6
32+
docker pull mysql:8.0
3333
```
3434

3535
Then run the tests with the `docker` tag, like this:

mysql/checker_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
//go:build docker
1616
// +build docker
1717

18-
// The tests in this package use docker to test against a mysql:5.6 database
18+
// The tests in this package use docker to test against a mysql:8.0 database
1919
// By default, the tests are off unless you pass the "-tags docker" flag
2020
// when running the test.
2121

mysql/mysql.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func TxDeadlock(err error) bool {
4646
switch err := errors.Cause(err).(type) {
4747
case *mysql.MySQLError:
4848
// ER_LOCK_DEADLOCK
49-
// See: https://dev.mysql.com/doc/refman/5.6/en/error-messages-server.html
49+
// See: https://dev.mysql.com/doc/mysql-errors/8.0/en/server-error-reference.html#error_er_lock_deadlock
5050
return err.Number == 1213
5151
default:
5252
return false
@@ -242,10 +242,10 @@ func schedExists(tx *sql.Tx, date time.Time) (result bool, err error) {
242242
// See: https://github.com/go-sql-driver/mysql#dsn-data-source-name
243243
func dsn(host string, port int, user string, password string, dbname string) string {
244244
params := map[string]string{
245-
"tx_isolation": "SERIALIZABLE", // we need serializable transactions for atomic test & set behavior
246-
"parseTime": "true", // enable us to use sql.Rows.Scan to read time.Time objects from queries
247-
"loc": "UTC", // Scan'd time.Times should be treated as being in UTC time zone
248-
"time_zone": "UTC", // MySQL should interpret DATETIME values as being in UTC
245+
"transaction_isolation": "SERIALIZABLE", // we need serializable transactions for atomic test & set behavior
246+
"parseTime": "true", // enable us to use sql.Rows.Scan to read time.Time objects from queries
247+
"loc": "UTC", // Scan'd time.Times should be treated as being in UTC time zone
248+
"time_zone": "UTC", // MySQL should interpret DATETIME values as being in UTC
249249
}
250250

251251
var ss []string

mysql/mysql_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
//go:build docker
1616
// +build docker
1717

18-
// The tests in this package use docker to test against a mysql:5.6 database
18+
// The tests in this package use docker to test against a mysql:8.0 database
1919
// By default, the tests are off unless you pass the "-tags docker" flag
2020
// when running the test.
2121
//
@@ -107,7 +107,7 @@ func TestMain(m *testing.M) {
107107
// startMySQLContainer starts a MySQL docker container
108108
// Returns the Cmd object associated with the process
109109
func startMySQLContainer() (*exec.Cmd, error) {
110-
cmd := exec.Command("docker", "run", "-e", "MYSQL_ROOT_PASSWORD="+password, fmt.Sprintf("-p3306:%d", port), "mysql:5.6")
110+
cmd := exec.Command("docker", "run", "-e", "MYSQL_ROOT_PASSWORD="+password, fmt.Sprintf("-p3306:%d", port), "mysql:8.0")
111111
pipe, err := cmd.StderrPipe()
112112
if err != nil {
113113
return nil, err

mysql/schedstore_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
//go:build docker
1616
// +build docker
1717

18-
// The tests in this package use docker to test against a mysql:5.6 database
18+
// The tests in this package use docker to test against a mysql:8.0 database
1919
// By default, the tests are off unless you pass the "-tags docker" flag
2020
// when running the test.
2121

0 commit comments

Comments
 (0)