Commit Graph

1499 Commits

Author SHA1 Message Date
dm-2
f2c203382b vendor github.com/openark/golib 2022-07-07 16:21:08 +01:00
Andrew Mason
f29e63bc71 Check RowsAffected when applying DML events to get more accurate statistics (#844)
* Check RowsAffected when applying DML events to get more accurate statistics

Addresses #600.

When applying a DML event, check the RowsAffected on the `Result`
struct. Since all DML event queries are point queries, this will only
ever be 0 or 1. The applier then takes this value and multiplies by
the `rowsDelta` of the event, resulting in a properly-signed, accurate
row delta to use in the statistics.

If an error occurs here, log it, but do not surface this as an
actual error .. simply assume the DML affected a row and move on. It
will be inaccurate, but this is already the case.

* Fix import

* update wording to warning log message

Co-authored-by: Tim Vaillancourt <timvaillancourt@github.com>
2022-07-07 16:21:08 +01:00
dm-2
0adb69781f v1.1.5 2022-07-07 16:21:08 +01:00
Andrew Mason
3e72f1bd65 Cancel any row count queries before attempting to cut over (#846)
* Cancel any row count queries before attempting to cut over

Closes #830. Switches from using `QueryRow` to `QueryRowContext`, and
stores a context.CancelFunc in the migration context, which is called to
halt any running row count query before beginning the cut over.

* Make it threadsafe

* Kill the count query on the database side as well

* Explicitly grab a connection to run the count, store its connection id
* When the query context is canceled, run a `KILL QUERY ?` on that connection id

* Rewrite these to use the threadsafe functions, stop exporting the cancel func

* Update logger

* Update logger

Co-authored-by: Tim Vaillancourt <timvaillancourt@github.com>
Co-authored-by: Tim Vaillancourt <tim@timvaillancourt.com>
Co-authored-by: dm-2 <45519614+dm-2@users.noreply.github.com>
2022-07-07 16:21:08 +01:00
Tim Vaillancourt
614b379528 Add context/timeout to HTTP throttle check (#1131)
* Add context/timeout to HTTP throttle check

* Dont run `.GetThrottleHTTPInterval()` on every loop

* Update help message

* Var rename

* 2022

* Add timeout flag

* Add unix/tcp server commands, use ParseInt() for string->int64

* Var rename

* Re-check http timeout on every loop iteration

* Remove stale comment

* Make throttle interval idempotent

* var rename

* Usage grammar

* Make http timeout idempotent too

* Parse time.Duration once

* Move timeout to NewThrottler

* Help update

* Set User-Agent header

* Re-add newline

Co-authored-by: dm-2 <45519614+dm-2@users.noreply.github.com>
2022-07-07 16:21:08 +01:00
Tim Vaillancourt
b4566dec40 Use switch statements for readability, simplify .NewGoMySQLReader() (#1135)
* Use `switch` statements for readability

* Simplify initBinlogReader()
2022-07-07 16:21:08 +01:00
Tim Vaillancourt
68b4085343 Ensure mysql rows responses are closed (#1132)
Co-authored-by: dm-2 <45519614+dm-2@users.noreply.github.com>
2022-07-07 16:21:08 +01:00
Shlomi Noach
9e0808afbe compound pk tests (#387)
* compound pk tests

* more details in failure diff

* more elaborate test; the pk-ts one consistently fails

* Fix merge conflict

Co-authored-by: Shlomi Noach <shlomi-noach@github.com>
Co-authored-by: Tim Vaillancourt <timvaillancourt@github.com>
Co-authored-by: Tim Vaillancourt <tim@timvaillancourt.com>
2022-07-07 16:21:08 +01:00
dm-2
fcda553ccb Run CodeQL analysis on PRs 2022-07-07 16:21:08 +01:00
shaohk
e0d31bad49 fix(lost data in mysql two-phase commit): lost data in mysql two-phase commit 2022-07-07 16:21:08 +01:00
Tim Vaillancourt
6598b345ca Fix integer divide by zero panic in migrator 2022-07-07 16:21:08 +01:00
Tim Vaillancourt
8dd1571f02 Add golangci-lint CI action, fix gosimple, govet + unused lint errors (#1127)
* Add `golangci-lint`, fix `gosimple`, `govet` and `unused` linter complaints

* Go 1.16

* Update copyright dates
2022-07-07 16:21:08 +01:00
jecepeda
63c171dc7a Add binaries for arm64 architectures 2022-07-07 16:21:08 +01:00
Tim Vaillancourt
869ed92400 Fix needless fmt.Sprintf call in go/logic/inspector.go 2022-07-07 10:20:59 +01:00
Tim Vaillancourt
9b27d9110e Use .String() for logging connection-config InstanceKey 2022-07-07 10:20:49 +01:00
dm-2
0ba4762e2d fix: update build script to explicitly build RPMs for linux 2022-02-25 14:34:33 +00:00
dm-2
7c9c1f04ef v1.1.4 2022-02-07 16:31:53 +00:00
Arthur Schreiber
62ac8974f5 Reduce the minimal chunk size from 100 to 10. 2022-02-07 16:31:53 +00:00
dm-2
dd919de4e3 Add docs for hooks-status-interval 2022-02-07 16:31:53 +00:00
Tyler Knodell
0a87c7af58 Add flag to customize the interval which the onStatus hook is called 2022-02-07 15:19:55 +00:00
Ed Toro
d8ccc1152a v1.1.3 2022-02-07 15:19:36 +00:00
Tim Vaillancourt
aef2a69903
v1.1.2 (#990) 2021-06-17 15:33:20 +02:00
Dirkjan Bussink
40acde0222
Set the ServerName for TLS configuration (#988)
When TLS hostname validation used for the MySQL connection, the
ServerName property needs to be set so that it knows which name to
validate on the certificate.

Without this option and with InsecureSkipVerify set to false, validation
will error here with a fatal error otherwise:

```
FATAL tls: either ServerName or InsecureSkipVerify must be specified in the tls.Config
```
2021-06-17 14:51:43 +02:00
Shlomi Noach
9bc508f068
Enum to varchar (#963)
* v1.1.0

* WIP: copying AUTO_INCREMENT value to ghost table
Initial commit: towards setting up a test suite

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* greping for 'expect_table_structure' content

* Adding simple test for 'expect_table_structure' scenario

* adding tests for AUTO_INCREMENT value after row deletes. Should initially fail

* clear event beforehand

* parsing AUTO_INCREMENT from alter query, reading AUTO_INCREMENT from original table, applying AUTO_INCREMENT value onto ghost table if applicable and user has not specified AUTO_INCREMENT in alter statement

* support GetUint64

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* minor update to test

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* adding test for user defined AUTO_INCREMENT statement

* Generated column as part of UNIQUE (or PRIMARY) KEY

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* skip analysis of generated column data type in unique key

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* All MySQL DBs limited to max 3 concurrent/idle connections

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* hooks: reporting GH_OST_ETA_SECONDS. ETA stored as part of migration context

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* GH_OST_ETA_NANOSECONDS

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* N/A denoted by negative value

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* ETAUnknown constant

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* Convering enum to varchar

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* test: not null

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* first attempt at setting enum-to-string right

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* fix insert query

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* store enum values, use when populating

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* apply EnumValues to mapped column

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* fix compilation error

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* gofmt

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
2021-06-10 17:17:49 +02:00
Shlomi Noach
f19f101610
hooks: reporting GH_OST_ETA_SECONDS. ETA as part of migration context (#936)
* v1.1.0

* WIP: copying AUTO_INCREMENT value to ghost table
Initial commit: towards setting up a test suite

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* greping for 'expect_table_structure' content

* Adding simple test for 'expect_table_structure' scenario

* adding tests for AUTO_INCREMENT value after row deletes. Should initially fail

* clear event beforehand

* parsing AUTO_INCREMENT from alter query, reading AUTO_INCREMENT from original table, applying AUTO_INCREMENT value onto ghost table if applicable and user has not specified AUTO_INCREMENT in alter statement

* support GetUint64

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* minor update to test

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* adding test for user defined AUTO_INCREMENT statement

* Generated column as part of UNIQUE (or PRIMARY) KEY

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* skip analysis of generated column data type in unique key

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* All MySQL DBs limited to max 3 concurrent/idle connections

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* hooks: reporting GH_OST_ETA_SECONDS. ETA stored as part of migration context

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* GH_OST_ETA_NANOSECONDS

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* N/A denoted by negative value

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* ETAUnknown constant

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
2021-05-31 14:15:51 +02:00
Shlomi Noach
c41823ecc9
All MySQL DBs limited to max 3 concurrent/idle connections #15 (#931)
* v1.1.0

* WIP: copying AUTO_INCREMENT value to ghost table
Initial commit: towards setting up a test suite

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* greping for 'expect_table_structure' content

* Adding simple test for 'expect_table_structure' scenario

* adding tests for AUTO_INCREMENT value after row deletes. Should initially fail

* clear event beforehand

* parsing AUTO_INCREMENT from alter query, reading AUTO_INCREMENT from original table, applying AUTO_INCREMENT value onto ghost table if applicable and user has not specified AUTO_INCREMENT in alter statement

* support GetUint64

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* minor update to test

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* adding test for user defined AUTO_INCREMENT statement

* Generated column as part of UNIQUE (or PRIMARY) KEY

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* skip analysis of generated column data type in unique key

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* All MySQL DBs limited to max 3 concurrent/idle connections

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
2021-05-27 20:00:58 +02:00
Tim Vaillancourt
8f42dedef8
Add GO111MODULE=off to build.sh, use Golang 1.16 (#966)
* Add GO111MODULE=off to build.sh

* Use golang 1.16

* Update go version in README.md

* Add missing GO111MODULE=off

* Add missing GO111MODULE=off again

* Use go1.16.3 explicitly

* Use 1.16 for CI test

* Update min go version

* Use go 1.16.4
2021-05-25 13:22:28 +02:00
Shlomi Noach
36c669dd75
Generated column as part of UNIQUE (or PRIMARY) KEY (#919)
* v1.1.0

* WIP: copying AUTO_INCREMENT value to ghost table
Initial commit: towards setting up a test suite

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* greping for 'expect_table_structure' content

* Adding simple test for 'expect_table_structure' scenario

* adding tests for AUTO_INCREMENT value after row deletes. Should initially fail

* clear event beforehand

* parsing AUTO_INCREMENT from alter query, reading AUTO_INCREMENT from original table, applying AUTO_INCREMENT value onto ghost table if applicable and user has not specified AUTO_INCREMENT in alter statement

* support GetUint64

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* minor update to test

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* adding test for user defined AUTO_INCREMENT statement

* Generated column as part of UNIQUE (or PRIMARY) KEY

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* skip analysis of generated column data type in unique key

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
2021-05-24 20:16:49 +02:00
Tim Vaillancourt
57a81ceff5
Use GitHub Actions CI badges (#970) 2021-05-19 14:08:32 +02:00
Tim Vaillancourt
c71dbf9ef3
Copy auto increment (#967)
* v1.1.0

* WIP: copying AUTO_INCREMENT value to ghost table
Initial commit: towards setting up a test suite

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* greping for 'expect_table_structure' content

* Adding simple test for 'expect_table_structure' scenario

* adding tests for AUTO_INCREMENT value after row deletes. Should initially fail

* clear event beforehand

* parsing AUTO_INCREMENT from alter query, reading AUTO_INCREMENT from original table, applying AUTO_INCREMENT value onto ghost table if applicable and user has not specified AUTO_INCREMENT in alter statement

* support GetUint64

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* minor update to test

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

* adding test for user defined AUTO_INCREMENT statement

Co-authored-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
2021-05-14 15:32:56 +02:00
Tim Vaillancourt
fef83af378
Merge pull request #968 from timvaillancourt/parallel-ci-tests
Use matrix build for replica test CI
2021-05-08 01:11:26 +02:00
Tim Vaillancourt
38bec2e207
Merge branch 'master' into parallel-ci-tests 2021-05-08 01:03:02 +02:00
Tim Vaillancourt
d8bd21acdf
Merge pull request #819 from github/tar-xz-dbdeployer-upgrade
replication tests CI: switch to .tar.xz binaries, upgrade dbdeployer
2021-05-08 01:01:49 +02:00
Tim Vaillancourt
5e37110cfd merge tar-xz-dbdeployer-upgrade 2021-05-08 00:45:59 +02:00
Tim Vaillancourt
a25f63aa2a merge tar-xz-dbdeployer-upgrade 2021-05-08 00:44:28 +02:00
Tim Vaillancourt
cd5beeb495
Remove git branch steps 2021-05-08 00:35:19 +02:00
Tim Vaillancourt
535687023e
Fetch master branch of ci env 2021-05-08 00:34:38 +02:00
Tim Vaillancourt
2634534cf5 Fix var name 2021-05-08 00:26:46 +02:00
Tim Vaillancourt
5ebbfaea89 Use matrix build for replica test CI 2021-05-08 00:23:31 +02:00
Tim Vaillancourt
7ae7cc67f7 Use right var name 2021-05-07 23:52:01 +02:00
Tim Vaillancourt
3976b7acf2 Remove 'mysql-' prefix from mysql version so dbdeployer can make a port num 2021-05-07 23:50:24 +02:00
Tim Vaillancourt
8df36d4bfd Fix git checkout 2021-05-07 23:32:24 +02:00
Tim Vaillancourt
6aaab78657
Use fix-8016-tarball branch 2021-05-07 23:22:18 +02:00
Tim Vaillancourt
afa221bb45
Use HEAD 2021-05-07 22:38:25 +02:00
Tim Vaillancourt
90a14d58bd
Merge branch 'master' into tar-xz-dbdeployer-upgrade 2021-05-07 22:24:58 +02:00
Tim Vaillancourt
29b8cfad48
Merge pull request #921 from ccoffey/cathal/safer_cut_over
Cut-over should wait for heartbeat lag to be low enough to succeed
2021-05-07 15:30:13 +02:00
Tim Vaillancourt
0dc64757eb
Merge branch 'master' into cathal/safer_cut_over 2021-05-07 15:13:29 +02:00
Tim Vaillancourt
8ab0a89cdc
Merge pull request #954 from yakirgb/remove-rpm-build-id
Remove build_id files from rpm
2021-05-06 15:31:29 +02:00
Tim Vaillancourt
5af869ac3b
Merge branch 'master' into remove-rpm-build-id 2021-05-06 15:01:36 +02:00
Tim Vaillancourt
0a1fb97b2a
Merge pull request #962 from Fanduzi/master
fix #961
2021-05-06 14:12:54 +02:00