Skip to content

Commit 658de78

Browse files
adamcrownclaude
andcommitted
Merge upstream go-mysql-org/go-mysql into instructure fork
Resolves all merge conflicts while preserving fork-specific features: - MCE-18894: Load binlog position from Redis (MasterInfoLoader interface) - MCE-18519: Retriable sync with handleRetriableSync and syncErrorCh channel - MCE-18274: FsInfoLoader for file-based master info persistence - Custom column type handling (TYPE_TEXT, TYPE_BLOB) - instructure/mc-go-mysql import paths throughout Upstream changes incorporated: - Security dependency updates (edwards25519, klauspost/compress, etc.) - Replaced DataDog/zstd and siddontang/* with modern equivalents - New utils.Now() for testability, slog-based structured logging - New server authentication handler/provider architecture - MySQL 8.4 semi-sync variable support, MariaDB GTID improvements - EventCacheCount and FillZeroLogPos config options - Removed failover package (upstream deleted) - Various bug fixes: unsigned int decoding, binlog GTID parsing, etc. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2 parents 0739a7a + 7492178 commit 658de78

168 files changed

Lines changed: 15563 additions & 5569 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 90 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
name: runTestsAndLinters
22
on: [push, pull_request]
33

4+
permissions:
5+
contents: read
6+
# Write is needed for golangci-lint annotations
7+
checks: write
8+
49
jobs:
510
test:
611
strategy:
712
matrix:
8-
go: [ 1.19, 1.18, 1.17, 1.16 ]
9-
os: [ ubuntu-22.04, ubuntu-20.04 ]
10-
name: Tests Go ${{ matrix.go }} # This name is used in main branch protection rules
13+
go: [ "1.26", "1.25" ]
14+
os: [ ubuntu-latest, ubuntu-24.04, ubuntu-22.04, ubuntu-24.04-arm ]
15+
name: Tests Go ${{ matrix.go }} on ${{ matrix.os }} # This name is used in main branch protection rules
1116
runs-on: ${{ matrix.os }}
1217

1318
steps:
@@ -17,35 +22,108 @@ jobs:
1722
echo -n "mysqldump -V: " ; mysqldump -V
1823
1924
echo -e '[mysqld]\nserver-id=1\nlog-bin=mysql\nbinlog-format=row\ngtid-mode=ON\nenforce_gtid_consistency=ON\n' | sudo tee /etc/mysql/conf.d/replication.cnf
25+
26+
# bind to :: for dual-stack listening
27+
sudo sed -i 's/bind-address.*= 127.0.0.1/bind-address = ::/' /etc/mysql/mysql.conf.d/mysqld.cnf
28+
sudo sed -i 's/mysqlx-bind-address.*= 127.0.0.1/mysqlx-bind-address = ::/' /etc/mysql/mysql.conf.d/mysqld.cnf
29+
2030
sudo service mysql start
21-
31+
2232
# apply this for mysql5 & mysql8 compatibility
2333
sudo mysql -h 127.0.0.1 -uroot -proot -e "DROP USER IF EXISTS 'mysql.infoschema'@'localhost'; CREATE USER IF NOT EXISTS 'mysql.infoschema'@'localhost' IDENTIFIED BY ''; GRANT SELECT ON *.* TO 'mysql.infoschema'@'localhost';"
24-
34+
2535
sudo mysql -h 127.0.0.1 -uroot -proot -e "use mysql; update user set authentication_string=null where User='root'; update user set plugin='mysql_native_password'; FLUSH PRIVILEGES;"
26-
# create ssl/rsa files for mysql ssl support
27-
sudo mysql_ssl_rsa_setup --uid=mysql
2836
mysql -e "CREATE DATABASE IF NOT EXISTS test;" -uroot
2937
mysql -e "SHOW VARIABLES LIKE 'log_bin'" -uroot
3038
- name: Prepare for Go
3139
run: |
3240
sudo apt-get install -y make gcc
41+
- name: Checkout code
42+
uses: actions/checkout@v6
3343
- name: Install Go
34-
uses: actions/setup-go@v2
44+
uses: actions/setup-go@v6
3545
with:
3646
go-version: ${{ matrix.go }}
47+
- name: Run tests
48+
run: |
49+
# separate test to avoid RESET MASTER conflict
50+
go test -race $(go list ./... | grep -v canal)
51+
go test -race $(go list ./... | grep canal)
52+
53+
mysqltest:
54+
strategy:
55+
matrix:
56+
mysql_version:
57+
- 8.0.45
58+
- 8.4.8
59+
- 9.7.0
60+
name: Tests with MySQL ${{ matrix.mysql_version }}
61+
runs-on: ubuntu-latest
62+
services:
63+
mysql:
64+
image: mysql:${{ matrix.mysql_version }}
65+
env:
66+
MYSQL_ALLOW_EMPTY_PASSWORD: yes
67+
ports:
68+
- 3306:3306
69+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
70+
71+
steps:
72+
- name: MySQL versions
73+
run: |
74+
echo -n "mysql -v: " ; mysql -V
75+
echo -n "mysqldump -V: " ; mysqldump -V
76+
echo -n "MySQL Server (SELECT VERSION()): " ; mysql -h 127.0.0.1 -u root -BNe 'SELECT VERSION()'
77+
- name: Prepare for Go
78+
run: |
79+
sudo apt-get install -y make gcc
3780
- name: Checkout code
38-
uses: actions/checkout@v1
81+
uses: actions/checkout@v6
82+
- name: Install Go
83+
uses: actions/setup-go@v6
84+
with:
85+
go-version: stable
3986
- name: Run tests
40-
run: go test ./...
87+
run: |
88+
# separate test to avoid RESET MASTER conflict
89+
# TODO: Fix "dump/" and "canal/": mysqldump tries to run SHOW MASTER STATUS on v8.4.0
90+
go test $(go list ./... | grep -v canal | grep -v dump)
91+
# go test $(go list ./... | grep canal | grep -v dump)
4192
4293
golangci:
4394
name: golangci
4495
runs-on: ubuntu-latest
4596
steps:
46-
- uses: actions/checkout@v2
97+
- uses: actions/checkout@v6
98+
- uses: actions/setup-go@v6
99+
with:
100+
go-version: stable
47101
- name: golangci-lint
48-
uses: golangci/golangci-lint-action@v2
102+
uses: golangci/golangci-lint-action@v9
49103
with:
50104
version: latest
51105
args: --timeout=3m
106+
107+
platforms:
108+
strategy:
109+
matrix:
110+
arch: [ "amd64", "arm64", "arm" ]
111+
os: [ "linux", "freebsd", "darwin" ]
112+
exclude:
113+
- arch: "arm"
114+
os: "darwin"
115+
name: platforms
116+
runs-on: ubuntu-latest
117+
steps:
118+
- name: Prepare for Go
119+
run: |
120+
sudo apt-get install -y make gcc
121+
- name: Checkout code
122+
uses: actions/checkout@v6
123+
- name: Install Go
124+
uses: actions/setup-go@v6
125+
with:
126+
go-version: stable
127+
128+
- name: Build on ${{ matrix.os }}/${{ matrix.arch }}
129+
run: GOARCH=${{ matrix.arch }} GOOS=${{ matrix.os }} go build ./...

.golangci.yml

Lines changed: 47 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,54 @@
1+
version: "2"
12
linters:
2-
disable-all: true
3+
default: none
34
enable:
4-
# All code is ready for:
5-
- deadcode
65
- errcheck
7-
- staticcheck
8-
- structcheck
9-
- typecheck
10-
- unused
11-
- varcheck
6+
- govet
7+
- ineffassign
128
- misspell
13-
- nolintlint
14-
- goimports
159
- nakedret
10+
- nolintlint
11+
- staticcheck
1612
- unconvert
13+
- unused
1714
- whitespace
18-
- govet
19-
- gosimple
20-
- ineffassign
21-
# ToDo:
22-
#- gocritic
23-
#- golint
24-
linters-settings:
25-
nolintlint:
26-
allow-unused: false
27-
allow-leading-space: false
28-
require-specific: true
29-
30-
govet:
31-
enable-all: true
32-
disable:
33-
- fieldalignment
34-
- lostcancel
35-
- shadow
15+
- modernize
16+
- revive
17+
settings:
18+
govet:
19+
disable:
20+
- fieldalignment
21+
- lostcancel
22+
- shadow
23+
enable-all: true
24+
nolintlint:
25+
require-specific: true
26+
allow-unused: false
27+
revive:
28+
enable-default-rules: true
29+
rules:
30+
- name: unused-parameter
31+
disabled: true
32+
exclusions:
33+
generated: lax
34+
presets:
35+
- comments
36+
- common-false-positives
37+
- legacy
38+
- std-error-handling
39+
paths:
40+
- client/examples_test.go
41+
- third_party$
42+
- builtin$
43+
- examples$
44+
formatters:
45+
enable:
46+
- gofumpt
47+
- goimports
48+
exclusions:
49+
generated: lax
50+
paths:
51+
- client/examples_test.go
52+
- third_party$
53+
- builtin$
54+
- examples$

0 commit comments

Comments
 (0)