Skip to content

Commit e7d9342

Browse files
committed
merged master, resolved conflict
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
2 parents 277dfa3 + 3f44e04 commit e7d9342

File tree

417 files changed

+22211
-14918
lines changed

Some content is hidden

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

417 files changed

+22211
-14918
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ jobs:
1010
steps:
1111
- uses: actions/checkout@v2
1212

13-
- name: Set up Go 1.16
13+
- name: Set up Go
1414
uses: actions/setup-go@v1
1515
with:
16-
go-version: 1.16
16+
go-version: 1.17
1717

1818
- name: Build
1919
run: script/cibuild

.github/workflows/codeql.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: "CodeQL analysis"
22

33
on:
44
push:
5+
pull_request:
56
schedule:
67
- cron: '0 0 * * 0'
78

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: golangci-lint
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
permissions:
8+
contents: read
9+
# Optional: allow read access to pull request. Use with `only-new-issues` option.
10+
# pull-requests: read
11+
jobs:
12+
golangci:
13+
name: lint
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/setup-go@v3
17+
with:
18+
go-version: 1.17
19+
- uses: actions/checkout@v3
20+
- name: golangci-lint
21+
uses: golangci/golangci-lint-action@v3
22+
with:
23+
version: v1.46.2

.github/workflows/replica-tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ jobs:
88
runs-on: ubuntu-latest
99
strategy:
1010
matrix:
11-
version: [mysql-5.5.62,mysql-5.6.43,mysql-5.7.25,mysql-8.0.16]
11+
version: [mysql-5.7.25,mysql-8.0.16]
1212

1313
steps:
1414
- uses: actions/checkout@v2
1515

16-
- name: Set up Go 1.16
16+
- name: Set up Go
1717
uses: actions/setup-go@v1
1818
with:
19-
go-version: 1.16
19+
go-version: 1.17
2020

2121
- name: migration tests
2222
env:

.golangci.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
run:
2+
timeout: 5m
3+
linters:
4+
disable:
5+
- errcheck
6+
enable:
7+
- contextcheck
8+
- durationcheck
9+
- errname
10+
- execinquery
11+
- gofmt
12+
- ifshort
13+
- misspell
14+
- nilerr
15+
- noctx
16+
- nolintlint
17+
- nosprintfhostport
18+
- prealloc
19+
- rowserrcheck
20+
- sqlclosecheck
21+
- unconvert
22+
- unused
23+
- wastedassign
24+
- whitespace

Dockerfile.packaging

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.16.4
1+
FROM golang:1.17
22

33
RUN apt-get update
44
RUN apt-get install -y ruby ruby-dev rubygems build-essential

Dockerfile.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.16.4
1+
FROM golang:1.17
22
LABEL maintainer="github@github.com"
33

44
RUN apt-get update

build.sh

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,32 @@ function build {
1818
GOOS=$3
1919
GOARCH=$4
2020

21-
if ! go version | egrep -q 'go(1\.1[567])' ; then
21+
if ! go version | egrep -q 'go1\.(1[5-9]|[2-9][0-9]{1})' ; then
2222
echo "go version must be 1.15 or above"
2323
exit 1
2424
fi
2525

26-
echo "Building ${osname} binary"
26+
echo "Building ${osname}-${GOARCH} binary"
2727
export GOOS
2828
export GOARCH
2929
go build -ldflags "$ldflags" -o $buildpath/$target go/cmd/gh-ost/main.go
3030

3131
if [ $? -ne 0 ]; then
32-
echo "Build failed for ${osname}"
32+
echo "Build failed for ${osname} ${GOARCH}."
3333
exit 1
3434
fi
3535

36-
(cd $buildpath && tar cfz ./gh-ost-binary-${osshort}-${timestamp}.tar.gz $target)
36+
(cd $buildpath && tar cfz ./gh-ost-binary-${osshort}-${GOARCH}-${timestamp}.tar.gz $target)
3737

38-
if [ "$GOOS" == "linux" ] ; then
38+
# build RPM and deb for Linux, x86-64 only
39+
if [ "$GOOS" == "linux" ] && [ "$GOARCH" == "amd64" ] ; then
3940
echo "Creating Distro full packages"
4041
builddir=$(setuptree)
4142
cp $buildpath/$target $builddir/gh-ost/usr/bin
4243
cd $buildpath
43-
fpm -v "${RELEASE_VERSION}" --epoch 1 -f -s dir -n gh-ost -m 'shlomi-noach <shlomi-noach+gh-ost-deb@github.com>' --description "GitHub's Online Schema Migrations for MySQL " --url "https://github.com/github/gh-ost" --vendor "GitHub" --license "Apache 2.0" -C $builddir/gh-ost --prefix=/ -t rpm --rpm-rpmbuild-define "_build_id_links none" .
44-
fpm -v "${RELEASE_VERSION}" --epoch 1 -f -s dir -n gh-ost -m 'shlomi-noach <shlomi-noach+gh-ost-deb@github.com>' --description "GitHub's Online Schema Migrations for MySQL " --url "https://github.com/github/gh-ost" --vendor "GitHub" --license "Apache 2.0" -C $builddir/gh-ost --prefix=/ -t deb --deb-no-default-config-files .
44+
fpm -v "${RELEASE_VERSION}" --epoch 1 -f -s dir -n gh-ost -m 'GitHub' --description "GitHub's Online Schema Migrations for MySQL " --url "https://github.com/github/gh-ost" --vendor "GitHub" --license "Apache 2.0" -C $builddir/gh-ost --prefix=/ -t rpm --rpm-rpmbuild-define "_build_id_links none" --rpm-os linux .
45+
fpm -v "${RELEASE_VERSION}" --epoch 1 -f -s dir -n gh-ost -m 'GitHub' --description "GitHub's Online Schema Migrations for MySQL " --url "https://github.com/github/gh-ost" --vendor "GitHub" --license "Apache 2.0" -C $builddir/gh-ost --prefix=/ -t deb --deb-no-default-config-files .
46+
cd -
4547
fi
4648
}
4749

@@ -62,10 +64,15 @@ main() {
6264
mkdir -p ${buildpath}
6365
rm -rf ${buildpath:?}/*
6466
build GNU/Linux linux linux amd64
65-
# build macOS osx darwin amd64
67+
build GNU/Linux linux linux arm64
68+
build macOS osx darwin amd64
69+
build macOS osx darwin arm64
6670

6771
echo "Binaries found in:"
6872
find $buildpath/gh-ost* -type f -maxdepth 1
73+
74+
echo "Checksums:"
75+
(cd $buildpath && shasum -a256 gh-ost* 2>/dev/null)
6976
}
7077

7178
main "$@"

doc/coding-ghost.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Getting started with gh-ost development is simple!
66

77
- First obtain the repository with `git clone` or `go get`.
8-
- From inside of the repository run `script/cibuild`
8+
- From inside of the repository run `script/cibuild`.
99
- This will bootstrap the environment if needed, format the code, build the code, and then run the unit test.
1010

1111
## CI build workflow
@@ -14,6 +14,12 @@ Getting started with gh-ost development is simple!
1414

1515
If additional steps are needed, please add them into this workflow so that the workflow remains simple.
1616

17+
## `golang-ci` linter
18+
19+
To enfore best-practices, Pull Requests are automatically linted by [`golang-ci`](https://golangci-lint.run/). The linter config is located at [`.golangci.yml`](https://github.com/github/gh-ost/blob/master/.golangci.yml) and the `golangci-lint` GitHub Action is located at [`.github/workflows/golangci-lint.yml`](https://github.com/github/gh-ost/blob/master/.github/workflows/golangci-lint.yml).
20+
21+
To run the `golang-ci` linters locally _(recommended before push)_, use `script/lint`.
22+
1723
## Notes:
1824

1925
Currently, `script/ensure-go-installed` will install `go` for Mac OS X and Linux. We welcome PR's to add other platforms.

doc/command-line-flags.md

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ If, for some reason, you do not wish `gh-ost` to connect to a replica, you may c
2626

2727
### approve-renamed-columns
2828

29-
When your migration issues a column rename (`change column old_name new_name ...`) `gh-ost` analyzes the statement to try and associate the old column name with new column name. Otherwise the new structure may also look like some column was dropped and another was added.
29+
When your migration issues a column rename (`change column old_name new_name ...`) `gh-ost` analyzes the statement to try and associate the old column name with new column name. Otherwise, the new structure may also look like some column was dropped and another was added.
3030

3131
`gh-ost` will print out what it thinks the _rename_ implied, but will not issue the migration unless you provide with `--approve-renamed-columns`.
3232

@@ -36,7 +36,7 @@ If you think `gh-ost` is mistaken and that there's actually no _rename_ involved
3636

3737
`gh-ost` infers the identity of the master server by crawling up the replication topology. You may explicitly tell `gh-ost` the identity of the master host via `--assume-master-host=the.master.com`. This is useful in:
3838

39-
- _master-master_ topologies (together with [`--allow-master-master`](#allow-master-master)), where `gh-ost` can arbitrarily pick one of the co-masters and you prefer that it picks a specific one
39+
- _master-master_ topologies (together with [`--allow-master-master`](#allow-master-master)), where `gh-ost` can arbitrarily pick one of the co-masters, and you prefer that it picks a specific one
4040
- _tungsten replicator_ topologies (together with [`--tungsten`](#tungsten)), where `gh-ost` is unable to crawl and detect the master
4141

4242
### assume-rbr
@@ -65,7 +65,13 @@ Comma delimited status-name=threshold, same format as [`--max-load`](#max-load).
6565

6666
`--critical-load` defines a threshold that, when met, `gh-ost` panics and bails out. The default behavior is to bail out immediately when meeting this threshold.
6767

68-
This may sometimes lead to migrations bailing out on a very short spike, that, while in itself is impacting production and is worth investigating, isn't reason enough to kill a 10 hour migration.
68+
This may sometimes lead to migrations bailing out on a very short spike, that, while in itself is impacting production and is worth investigating, isn't reason enough to kill a 10-hour migration.
69+
70+
### critical-load-hibernate-seconds
71+
72+
When `--critical-load-hibernate-seconds` is non-zero (e.g. `--critical-load-hibernate-seconds=300`), `critical-load` does not panic and bail out; instead, `gh-ost` goes into hibernation for the specified duration. It will not read/write anything from/to any server during this time. Execution then continues upon waking from hibernation.
73+
74+
If `critical-load` is met again, `gh-ost` will repeat this cycle, and never panic and bail out.
6975

7076
### critical-load-interval-millis
7177

@@ -102,7 +108,7 @@ Noteworthy is that setting `--dml-batch-size` to higher value _does not_ mean `g
102108

103109
### exact-rowcount
104110

105-
A `gh-ost` execution need to copy whatever rows you have in your existing table onto the ghost table. This can, and often be, a large number. Exactly what that number is?
111+
A `gh-ost` execution need to copy whatever rows you have in your existing table onto the ghost table. This can and often will be, a large number. Exactly what that number is?
106112
`gh-ost` initially estimates the number of rows in your table by issuing an `explain select * from your_table`. This will use statistics on your table and return with a rough estimate. How rough? It might go as low as half or as high as double the actual number of rows in your table. This is the same method as used in [`pt-online-schema-change`](https://www.percona.com/doc/percona-toolkit/2.2/pt-online-schema-change.html).
107113

108114
`gh-ost` also supports the `--exact-rowcount` flag. When this flag is given, two things happen:
@@ -139,6 +145,10 @@ Add this flag when executing on a 1st generation Google Cloud Platform (GCP).
139145

140146
Default 100. See [`subsecond-lag`](subsecond-lag.md) for details.
141147

148+
### hooks-status-interval
149+
150+
Defaults to 60 seconds. Configures how often the `gh-ost-on-status` hook is called, see [`hooks`](hooks.md) for full details on how to use hooks.
151+
142152
### initially-drop-ghost-table
143153

144154
`gh-ost` maintains two tables while migrating: the _ghost_ table (which is synced from your original table and finally replaces it) and a changelog table, which is used internally for bookkeeping. By default, it panics and aborts if it sees those tables upon startup. Provide `--initially-drop-ghost-table` and `--initially-drop-old-table` to let `gh-ost` know it's OK to drop them beforehand.
@@ -234,7 +244,15 @@ Provide a command delimited list of replicas; `gh-ost` will throttle when any of
234244

235245
### throttle-http
236246

237-
Provide a HTTP endpoint; `gh-ost` will issue `HEAD` requests on given URL and throttle whenever response status code is not `200`. The URL can be queried and updated dynamically via [interactive commands](interactive-commands.md). Empty URL disables the HTTP check.
247+
Provide an HTTP endpoint; `gh-ost` will issue `HEAD` requests on given URL and throttle whenever response status code is not `200`. The URL can be queried and updated dynamically via [interactive commands](interactive-commands.md). Empty URL disables the HTTP check.
248+
249+
### throttle-http-interval-millis
250+
251+
Defaults to 100. Configures the HTTP throttle check interval in milliseconds.
252+
253+
### throttle-http-timeout-millis
254+
255+
Defaults to 1000 (1 second). Configures the HTTP throttler check timeout in milliseconds.
238256

239257
### timestamp-old-table
240258

0 commit comments

Comments
 (0)