Skip to content

Commit 62efa44

Browse files
committed
Merge branch 'master' into gavinfrazar/update-teleport
2 parents 63fa74e + 84c5e8e commit 62efa44

File tree

120 files changed

+5497
-2487
lines changed

Some content is hidden

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

120 files changed

+5497
-2487
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
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.22", "1.21" ]
9-
os: [ ubuntu-22.04, ubuntu-20.04 ]
13+
go: [ "1.24", "1.23" ]
14+
os: [ ubuntu-latest, ubuntu-24.04, ubuntu-22.04 ]
1015
name: Tests Go ${{ matrix.go }} on ${{ matrix.os }} # This name is used in main branch protection rules
1116
runs-on: ${{ matrix.os }}
1217

@@ -17,6 +22,11 @@ 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
2131
2232
# apply this for mysql5 & mysql8 compatibility
@@ -46,8 +56,9 @@ jobs:
4656
strategy:
4757
matrix:
4858
mysql_version:
49-
- 8.0.37
50-
- 8.4.0
59+
- 8.0.42
60+
- 8.4.5
61+
- 9.3.0
5162
name: Tests with MySQL ${{ matrix.mysql_version }}
5263
runs-on: ubuntu-latest
5364
services:
@@ -73,7 +84,7 @@ jobs:
7384
- name: Install Go
7485
uses: actions/setup-go@v5
7586
with:
76-
go-version: "1.22"
87+
go-version: stable
7788
- name: Run tests
7889
run: |
7990
# separate test to avoid RESET MASTER conflict
@@ -86,17 +97,23 @@ jobs:
8697
runs-on: ubuntu-latest
8798
steps:
8899
- uses: actions/checkout@v4
100+
- uses: actions/setup-go@v5
101+
with:
102+
go-version: stable
89103
- name: golangci-lint
90-
uses: golangci/golangci-lint-action@v6
104+
uses: golangci/golangci-lint-action@v7
91105
with:
92106
version: latest
93107
args: --timeout=3m
94108

95109
platforms:
96110
strategy:
97111
matrix:
98-
arch: [ "amd64", "arm64" ]
112+
arch: [ "amd64", "arm64", "arm" ]
99113
os: [ "linux", "freebsd", "darwin" ]
114+
exclude:
115+
- arch: "arm"
116+
os: "darwin"
100117
name: platforms
101118
runs-on: ubuntu-latest
102119
steps:
@@ -108,6 +125,7 @@ jobs:
108125
- name: Install Go
109126
uses: actions/setup-go@v5
110127
with:
111-
go-version: "1.22"
128+
go-version: stable
129+
112130
- name: Build on ${{ matrix.os }}/${{ matrix.arch }}
113131
run: GOARCH=${{ matrix.arch }} GOOS=${{ matrix.os }} go build ./...

.golangci.yml

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

CHANGELOG.md

Lines changed: 78 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,81 @@
1-
### Tag v1.9.0 (2024-09-12)
1+
### Tag v1.12.0 (2025-04-01)
2+
3+
> **Note:**
4+
> This version changes the logging framework to [`log/slog`](https://go.dev/blog/slog). If you use a custom logger then check the [Logging section](https://github.com/go-mysql-org/go-mysql?tab=readme-ov-file#logging) of the README.
5+
6+
* Server: Rework NewConn/defaultServer. [#1021](https://github.com/go-mysql-org/go-mysql/pull/1021) ([dveeden](https://github.com/dveeden))
7+
* Replication: add IsEmpty method to GTIDSet interface & implementations. [#1019](https://github.com/go-mysql-org/go-mysql/pull/1019) ([wesleywright](https://github.com/wesleywright))
8+
* Give `RowsEvent` a method to inspect the underlying event type.. [#1016](https://github.com/go-mysql-org/go-mysql/pull/1016) ([proton-lisandro-pin](https://github.com/proton-lisandro-pin))
9+
* Test: add test for TransactionPayloadEvent. [#1018](https://github.com/go-mysql-org/go-mysql/pull/1018) ([lance6716](https://github.com/lance6716))
10+
* CONTRIBUTING: Add note about testing locally. [#1014](https://github.com/go-mysql-org/go-mysql/pull/1014) ([dveeden](https://github.com/dveeden))
11+
* Replication: check hostname length. [#1013](https://github.com/go-mysql-org/go-mysql/pull/1013) ([dveeden](https://github.com/dveeden))
12+
* Initial contributor guide. [#1010](https://github.com/go-mysql-org/go-mysql/pull/1010) ([dveeden](https://github.com/dveeden))
13+
* Dump: Fix Unlick typo. [#1011](https://github.com/go-mysql-org/go-mysql/pull/1011) ([dveeden](https://github.com/dveeden))
14+
* Improve unit tests around `Hasresultset` and `WriteValue`. [#1006](https://github.com/go-mysql-org/go-mysql/pull/1006) ([stgarrity](https://github.com/stgarrity))
15+
* Replace github.com/siddontang/go-log with log/slog. [#993](https://github.com/go-mysql-org/go-mysql/pull/993) ([serprex](https://github.com/serprex))
16+
* Support MySQL vector type. [#1004](https://github.com/go-mysql-org/go-mysql/pull/1004) ([serprex](https://github.com/serprex))
17+
* Test: remove time-based checking. [#1002](https://github.com/go-mysql-org/go-mysql/pull/1002) ([lance6716](https://github.com/lance6716))
18+
* Replication: Add mysql::serialization based Gtid Log Event. [#990](https://github.com/go-mysql-org/go-mysql/pull/990) ([dveeden](https://github.com/dveeden))
19+
* Replication: Set `source_binlog_checksum` as well. [#1003](https://github.com/go-mysql-org/go-mysql/pull/1003) ([dveeden](https://github.com/dveeden))
20+
* Add support for MariaDB ED25519 plugin. [#998](https://github.com/go-mysql-org/go-mysql/pull/998) ([heavycrystal](https://github.com/heavycrystal))
21+
* Driver: context support. [#997](https://github.com/go-mysql-org/go-mysql/pull/997) ([serprex](https://github.com/serprex))
22+
* Use math/bits OnesCount to preallocate slices. [#995](https://github.com/go-mysql-org/go-mysql/pull/995) ([serprex](https://github.com/serprex))
23+
* Fix bug: context timeout inside for loop, it will case memory leak. [#999](https://github.com/go-mysql-org/go-mysql/pull/999) ([maaars](https://github.com/maaars))
24+
* Lint: gofumpt. [#996](https://github.com/go-mysql-org/go-mysql/pull/996) ([serprex](https://github.com/serprex))
25+
* Avoid utils.Now failing sometime around the year 2262. [#994](https://github.com/go-mysql-org/go-mysql/pull/994) ([serprex](https://github.com/serprex))
26+
* Client: Make example testable. [#987](https://github.com/go-mysql-org/go-mysql/pull/987) ([dveeden](https://github.com/dveeden))
27+
* CI: Update nolintlint config. [#991](https://github.com/go-mysql-org/go-mysql/pull/991) ([dveeden](https://github.com/dveeden))
28+
* CI: Remove Ubuntu 20.04. [#989](https://github.com/go-mysql-org/go-mysql/pull/989) ([dveeden](https://github.com/dveeden))
29+
* Server: Correctly handle `COM_STMT_EXECUTE` without rebind. [#984](https://github.com/go-mysql-org/go-mysql/pull/984) ([dveeden](https://github.com/dveeden))
30+
* README: add Platform Support section. [#981](https://github.com/go-mysql-org/go-mysql/pull/981) ([lance6716](https://github.com/lance6716))
31+
* Change how we import the mysql package. [#982](https://github.com/go-mysql-org/go-mysql/pull/982) ([dveeden](https://github.com/dveeden))
32+
* Server: Correct the check for Resultset. [#983](https://github.com/go-mysql-org/go-mysql/pull/983) ([dveeden](https://github.com/dveeden))
33+
* Client,mysql: Add support for Query Attributes. [#976](https://github.com/go-mysql-org/go-mysql/pull/976) ([dveeden](https://github.com/dveeden))
34+
* Use 4-byte UTF-8 by default. [#979](https://github.com/go-mysql-org/go-mysql/pull/979) ([dveeden](https://github.com/dveeden))
35+
* Client: Set `_client_version` connection attribute. [#978](https://github.com/go-mysql-org/go-mysql/pull/978) ([dveeden](https://github.com/dveeden))
36+
* Cleanup init functions. [#977](https://github.com/go-mysql-org/go-mysql/pull/977) ([serprex](https://github.com/serprex))
37+
* Server: set `CLIENT_CONNECT_ATTRS`. [#975](https://github.com/go-mysql-org/go-mysql/pull/975) ([dveeden](https://github.com/dveeden))
38+
* Mysql,client,driver: Add more docs/comments and update constants. [#974](https://github.com/go-mysql-org/go-mysql/pull/974) ([dveeden](https://github.com/dveeden))
39+
40+
## Tag v1.11.0 (2025-01-23)
41+
* Mysql: Fix GetInt() with negative NEWDECIMAL result. [#972](https://github.com/go-mysql-org/go-mysql/pull/972) ([dveeden](https://github.com/dveeden))
42+
* Client: Update docs. [#970](https://github.com/go-mysql-org/go-mysql/pull/970) ([dveeden](https://github.com/dveeden))
43+
* Cleanup: remove clear_vendor.sh. [#971](https://github.com/go-mysql-org/go-mysql/pull/971) ([dveeden](https://github.com/dveeden))
44+
* `*`: don't use zero value of mysql.Result. [#969](https://github.com/go-mysql-org/go-mysql/pull/969) ([lance6716](https://github.com/lance6716))
45+
* Mysql: Fix ColumnNumber() panic with nil Resultset. [#968](https://github.com/go-mysql-org/go-mysql/pull/968) ([dveeden](https://github.com/dveeden))
46+
* Replication: Improve COM_REGISTER_SLAVE. [#967](https://github.com/go-mysql-org/go-mysql/pull/967) ([dveeden](https://github.com/dveeden))
47+
* Use syscall.Gettimeofday to get current time. [#961](https://github.com/go-mysql-org/go-mysql/pull/961) ([hjweddie](https://github.com/hjweddie))
48+
* Remove duplicate SIGINT in signal handling. [#962](https://github.com/go-mysql-org/go-mysql/pull/962) ([soya111](https://github.com/soya111))
49+
* Feat: Added `time.Time` support for datetime format. [#957](https://github.com/go-mysql-org/go-mysql/pull/957) ([inoth](https://github.com/inoth))
50+
* Mysql field: expose API to modify field value. [#960](https://github.com/go-mysql-org/go-mysql/pull/960) ([walkline](https://github.com/walkline))
51+
* Replication: Support GTID tag in PreviousGTIDsEvent. [#952](https://github.com/go-mysql-org/go-mysql/pull/952) ([dveeden](https://github.com/dveeden))
52+
* Zeroalloc: don't use unsafe.Pointer. [#959](https://github.com/go-mysql-org/go-mysql/pull/959) ([serprex](https://github.com/serprex))
53+
* Driver: allow configuration of the driver name. [#958](https://github.com/go-mysql-org/go-mysql/pull/958) ([dveeden](https://github.com/dveeden))
54+
* Update README. [#950](https://github.com/go-mysql-org/go-mysql/pull/950) ([dveeden](https://github.com/dveeden))
55+
* README: fix example for database/sql. [#955](https://github.com/go-mysql-org/go-mysql/pull/955) ([dveeden](https://github.com/dveeden))
56+
* CI: Update Go, MySQL and Ubuntu versions. [#954](https://github.com/go-mysql-org/go-mysql/pull/954) ([dveeden](https://github.com/dveeden))
57+
* Canal,dump: Improve logging. [#953](https://github.com/go-mysql-org/go-mysql/pull/953) ([dveeden](https://github.com/dveeden))
58+
59+
## Tag v1.10.0 (2024-11-20)
60+
* replication,cmd: improve flavor handling [#946](https://github.com/go-mysql-org/go-mysql/pull/946) ([dveeden](https://github.com/dveeden))
61+
* Upgrade github.com/pingcap/tidb/pkg/parser. [#948](https://github.com/go-mysql-org/go-mysql/pull/948) ([Tang8330](https://github.com/Tang8330))
62+
* replication: Add GTID_TAGGED_LOG_EVENT [#947](https://github.com/go-mysql-org/go-mysql/pull/947) ([dveeden](https://github.com/dveeden))
63+
* canal: support ipv6 address [#943](https://github.com/go-mysql-org/go-mysql/pull/943) ([sinomoe](https://github.com/sinomoe))
64+
* Remove failover [#931](https://github.com/go-mysql-org/go-mysql/pull/931) ([dveeden](https://github.com/dveeden))
65+
* dump: use mariadb-dump when available [#942](https://github.com/go-mysql-org/go-mysql/pull/942) ([dveeden](https://github.com/dveeden))
66+
* go-mysqlbinlog: set to retry only 10 times [#945](https://github.com/go-mysql-org/go-mysql/pull/945) ([dveeden](https://github.com/dveeden))
67+
* go-mysqldump: Add option to skip binlog position [#941](https://github.com/go-mysql-org/go-mysql/pull/941) ([dveeden](https://github.com/dveeden))
68+
* server: Improve example [#936](https://github.com/go-mysql-org/go-mysql/pull/936) ([dveeden](https://github.com/dveeden))
69+
* dump: use --source-data based on version [#933](https://github.com/go-mysql-org/go-mysql/pull/933) ([dveeden](https://github.com/dveeden))
70+
* replication: Log info about server [#935](https://github.com/go-mysql-org/go-mysql/pull/935) ([dveeden](https://github.com/dveeden))
71+
* replication: fix uuid typo [#934](https://github.com/go-mysql-org/go-mysql/pull/934) ([dveeden](https://github.com/dveeden))
72+
* dump: Support newer mysqldump versions [#932](https://github.com/go-mysql-org/go-mysql/pull/932) ([dveeden](https://github.com/dveeden))
73+
* replication: Make ServerVersion a proper string [#930](https://github.com/go-mysql-org/go-mysql/pull/930) ([dveeden](https://github.com/dveeden))
74+
* Makefile: allow for gotip [#928](https://github.com/go-mysql-org/go-mysql/pull/928) ([dveeden](https://github.com/dveeden))
75+
* client: Fix timeout reset during TLS handshake [#925](https://github.com/go-mysql-org/go-mysql/pull/925) ([willdonnelly](https://github.com/willdonnelly))
76+
* Ensure ACKs are sent after backup [#921](https://github.com/go-mysql-org/go-mysql/pull/921) ([dt8269](https://github.com/dt8269))
77+
78+
### Tag v1.9.1 (2024-09-12)
279
* Fix can't connect to MySQL 8.0 with long password. [#914](https://github.com/go-mysql-org/go-mysql/pull/914) ([lance6716](https://github.com/lance6716))
380
* Fix actual master and add -race in CI. [#907](https://github.com/go-mysql-org/go-mysql/pull/907) ([atercattus](https://github.com/atercattus))
481
* export EventCacheCount on Canal Config. [#913](https://github.com/go-mysql-org/go-mysql/pull/913) ([tomwei7](https://github.com/tomwei7))

CONTRIBUTING.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# How to contribute
2+
3+
## Your first contribution
4+
5+
- Best to first create an issue and discuss the problem and possible solution.
6+
- This isn't needed for small/obvious fixes.
7+
- What is the context? e.g. what versions of go-mysql, MySQL, etc does this apply to?
8+
- Do you have a simple test case? This can just be example code, it doesn't have to be a full test case.
9+
- Why do you need this change?
10+
- Format your code with [gofumpt](https://github.com/mvdan/gofumpt) if possible. (`make fmt` does this for you)
11+
- Reference an issue in the PR if you have one.
12+
- Update the `README.md` if applicable.
13+
- Add tests where applicable.
14+
15+
## Asking for help
16+
17+
- Don't be afraid to ask for help in an issue or PR.
18+
19+
## Testing
20+
21+
Testing is done with GitHub actions.
22+
23+
If you want to run test locally you can use the following flags:
24+
25+
```
26+
-db string
27+
-host string
28+
-pass string
29+
-port string
30+
-user string
31+
```
32+
33+
Example:
34+
```
35+
$ cd client
36+
$ go test -args -db test2 -port 3307
37+
```
38+
39+
Testing locally with Docker or Podman can be done like this:
40+
```
41+
podman run \
42+
--rm \
43+
--env MYSQL_ALLOW_EMPTY_PASSWORD=1 \
44+
--env MYSQL_ROOT_HOST='%' \
45+
-p3307:3306 \
46+
-it \
47+
container-registry.oracle.com/mysql/community-server:8.0 \
48+
--gtid-mode=ON \
49+
--enforce-gtid-consistency=ON
50+
```
51+
52+
Substitude `podman` with `docker` if you're using docker. This uses `--rm` to remove the container when it stops. It also enabled GTID by passing options to `mysqld`.

Makefile

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
11
all: build
22

33
GO111MODULE=on
4+
MYSQL_VERSION ?= 8.0
5+
GO ?= go
46

57
build:
6-
go build -o bin/go-mysqlbinlog cmd/go-mysqlbinlog/main.go
7-
go build -o bin/go-mysqldump cmd/go-mysqldump/main.go
8-
go build -o bin/go-canal cmd/go-canal/main.go
9-
go build -o bin/go-binlogparser cmd/go-binlogparser/main.go
8+
${GO} build -o bin/go-mysqlbinlog cmd/go-mysqlbinlog/main.go
9+
${GO} build -o bin/go-mysqldump cmd/go-mysqldump/main.go
10+
${GO} build -o bin/go-canal cmd/go-canal/main.go
11+
${GO} build -o bin/go-binlogparser cmd/go-binlogparser/main.go
12+
${GO} build -o bin/go-mysqlserver cmd/go-mysqlserver/main.go
1013

1114
test:
12-
go test --race -timeout 2m ./...
15+
${GO} test --race -timeout 2m ./...
1316

14-
MYSQL_VERSION ?= 8.0
1517
test-local:
1618
docker run --rm -d --network=host --name go-mysql-server \
1719
-e MYSQL_ALLOW_EMPTY_PASSWORD=true \
1820
-e MYSQL_DATABASE=test \
1921
-v $${PWD}/docker/resources/replication.cnf:/etc/mysql/conf.d/replication.cnf \
2022
mysql:$(MYSQL_VERSION)
2123
docker/resources/waitfor.sh 127.0.0.1 3306 \
22-
&& go test -race -v -timeout 2m ./...
24+
&& ${GO} test -race -v -timeout 2m ./...
2325
docker stop go-mysql-server
2426

2527
fmt:
2628
golangci-lint run --fix
2729

2830
clean:
29-
go clean -i ./...
31+
${GO} clean -i ./...
3032
@rm -rf ./bin

0 commit comments

Comments
 (0)