Skip to content

Commit 4fd4be1

Browse files
author
Shlomi Noach
authored
Merge branch 'master' into tests-varbinary
2 parents 48e01ad + c6eb8db commit 4fd4be1

File tree

295 files changed

+31416
-6319
lines changed

Some content is hidden

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

295 files changed

+31416
-6319
lines changed

.github/workflows/ci.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: CI
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@master
12+
13+
- name: Set up Go 1.12
14+
uses: actions/setup-go@v1
15+
with:
16+
version: 1.12
17+
id: go
18+
19+
- name: Build
20+
run: script/cibuild

.github/workflows/replica-tests.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: migration tests
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@master
12+
13+
- name: Set up Go 1.12
14+
uses: actions/setup-go@v1
15+
with:
16+
version: 1.12
17+
id: go
18+
19+
- name: migration tests
20+
run: script/cibuild-gh-ost-replica-tests

.travis.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

Dockerfile.packaging

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#
2+
3+
FROM golang:1.12.6
4+
5+
RUN apt-get update
6+
RUN apt-get install -y ruby ruby-dev rubygems build-essential
7+
RUN gem install --no-ri --no-rdoc fpm
8+
ENV GOPATH=/tmp/go
9+
10+
RUN apt-get install -y curl
11+
RUN apt-get install -y rsync
12+
RUN apt-get install -y gcc
13+
RUN apt-get install -y g++
14+
RUN apt-get install -y bash
15+
RUN apt-get install -y git
16+
RUN apt-get install -y tar
17+
RUN apt-get install -y rpm
18+
19+
RUN mkdir -p $GOPATH/src/github.com/github/gh-ost
20+
WORKDIR $GOPATH/src/github.com/github/gh-ost
21+
COPY . .
22+
RUN bash build.sh

Dockerfile.test

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM golang:1.12.1
2+
LABEL maintainer="[email protected]"
3+
4+
RUN apt-get update
5+
RUN apt-get install -y lsb-release
6+
RUN rm -rf /var/lib/apt/lists/*
7+
8+
COPY . /go/src/github.com/github/gh-ost
9+
WORKDIR /go/src/github.com/github/gh-ost
10+
11+
CMD ["script/test"]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ Please see [Coding gh-ost](doc/coding-ghost.md) for a guide to getting started d
9494

9595
[Download latest release here](https://github.com/github/gh-ost/releases/latest)
9696

97-
`gh-ost` is a Go project; it is built with Go `1.9` and above. To build on your own, use either:
97+
`gh-ost` is a Go project; it is built with Go `1.12` and above. To build on your own, use either:
9898
- [script/build](https://github.com/github/gh-ost/blob/master/script/build) - this is the same build script used by CI hence the authoritative; artifact is `./bin/gh-ost` binary.
9999
- [build.sh](https://github.com/github/gh-ost/blob/master/build.sh) for building `tar.gz` artifacts in `/tmp/gh-ost`
100100

RELEASE_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.47
1+
1.0.49

build.sh

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

21-
22-
23-
if ! go version | egrep -q 'go(1[.]9|1[.]1[0-9])' ; then
24-
echo "go version is too low. Must use 1.9 or above"
21+
if ! go version | egrep -q 'go(1\.1[234])' ; then
22+
echo "go version must be 1.12 or above"
2523
exit 1
2624
fi
2725

@@ -42,8 +40,8 @@ function build {
4240
builddir=$(setuptree)
4341
cp $buildpath/$target $builddir/gh-ost/usr/bin
4442
cd $buildpath
45-
fpm -v "${RELEASE_VERSION}" --epoch 1 -f -s dir -n gh-ost -m shlomi-noach --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 .
46-
fpm -v "${RELEASE_VERSION}" --epoch 1 -f -s dir -n gh-ost -m shlomi-noach --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 .
43+
fpm -v "${RELEASE_VERSION}" --epoch 1 -f -s dir -n gh-ost -m 'shlomi-noach <[email protected]>' --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 .
44+
fpm -v "${RELEASE_VERSION}" --epoch 1 -f -s dir -n gh-ost -m 'shlomi-noach <[email protected]>' --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 .
4745
fi
4846
}
4947

@@ -63,11 +61,11 @@ main() {
6361

6462
mkdir -p ${buildpath}
6563
rm -rf ${buildpath:?}/*
66-
build macOS osx darwin amd64
6764
build GNU/Linux linux linux amd64
65+
# build macOS osx darwin amd64
6866

6967
echo "Binaries found in:"
70-
ls -1 $buildpath/gh-ost-binary*${timestamp}.tar.gz
68+
find $buildpath/gh-ost* -type f -maxdepth 1
7169
}
7270

7371
main "$@"

doc/command-line-flags.md

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

1919
### approve-renamed-columns
2020

21-
When your migration issues a column rename (`change column old_name new_name ...`) `gh-ost` analyzes the statement to try an 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.
21+
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.
2222

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

@@ -69,6 +69,10 @@ This is somewhat similar to a Nagios `n`-times test, where `n` in our case is al
6969

7070
Optional. Default is `safe`. See more discussion in [`cut-over`](cut-over.md)
7171

72+
### cut-over-lock-timeout-seconds
73+
74+
Default `3`. Max number of seconds to hold locks on tables while attempting to cut-over (retry attempted when lock exceeds timeout).
75+
7276
### discard-foreign-keys
7377

7478
**Danger**: this flag will _silently_ discard any foreign keys existing on your table.
@@ -107,6 +111,18 @@ While the ongoing estimated number of rows is still heuristic, it's almost exact
107111

108112
Without this parameter, migration is a _noop_: testing table creation and validity of migration, but not touching data.
109113

114+
### force-named-cut-over
115+
116+
If given, a `cut-over` command must name the migrated table, or else ignored.
117+
118+
### force-named-panic
119+
120+
If given, a `panic` command must name the migrated table, or else ignored.
121+
122+
### force-table-names
123+
124+
Table name prefix to be used on the temporary tables.
125+
110126
### gcp
111127

112128
Add this flag when executing on a 1st generation Google Cloud Platform (GCP).
@@ -125,6 +141,10 @@ We think `gh-ost` should not take chances or make assumptions about the user's t
125141

126142
See [`initially-drop-ghost-table`](#initially-drop-ghost-table)
127143

144+
### initially-drop-socket-file
145+
146+
Default False. Should `gh-ost` forcibly delete an existing socket file. Be careful: this might drop the socket file of a running migration!
147+
128148
### max-lag-millis
129149

130150
On a replication topology, this is perhaps the most important migration throttling factor: the maximum lag allowed for migration to work. If lag exceeds this value, migration throttles.
@@ -141,7 +161,7 @@ List of metrics and threshold values; topping the threshold of any will cause th
141161

142162
### migrate-on-replica
143163

144-
Typically `gh-ost` is used to migrate tables on a master. If you wish to only perform the migration in full on a replica, connect `gh-ost` to said replica and pass `--migrate-on-replica`. `gh-ost` will briefly connect to the master but other issue no changes on the master. Migration will be fully executed on the replica, while making sure to maintain a small replication lag.
164+
Typically `gh-ost` is used to migrate tables on a master. If you wish to only perform the migration in full on a replica, connect `gh-ost` to said replica and pass `--migrate-on-replica`. `gh-ost` will briefly connect to the master but otherwise will make no changes on the master. Migration will be fully executed on the replica, while making sure to maintain a small replication lag.
145165

146166
### postpone-cut-over-flag-file
147167

@@ -161,14 +181,42 @@ See also: [`concurrent-migrations`](cheatsheet.md#concurrent-migrations) on the
161181

162182
By default `gh-ost` verifies no foreign keys exist on the migrated table. On servers with large number of tables this check can take a long time. If you're absolutely certain no foreign keys exist (table does not reference other table nor is referenced by other tables) and wish to save the check time, provide with `--skip-foreign-key-checks`.
163183

184+
### skip-strict-mode
185+
186+
By default `gh-ost` enforces STRICT_ALL_TABLES sql_mode as a safety measure. In some cases this changes the behaviour of other modes (namely ERROR_FOR_DIVISION_BY_ZERO, NO_ZERO_DATE, and NO_ZERO_IN_DATE) which may lead to errors during migration. Use `--skip-strict-mode` to explicitly tell `gh-ost` not to enforce this. **Danger** This may have some unexpected disastrous side effects.
187+
164188
### skip-renamed-columns
165189

166190
See [`approve-renamed-columns`](#approve-renamed-columns)
167191

192+
### ssl
193+
194+
By default `gh-ost` does not use ssl/tls connections to the database servers when performing migrations. This flag instructs `gh-ost` to use encrypted connections. If enabled, `gh-ost` will use the system's ca certificate pool for server certificate verification. If a different certificate is needed for server verification, see `--ssl-ca`. If you wish to skip server verification, but still use encrypted connections, use with `--ssl-allow-insecure`.
195+
196+
### ssl-allow-insecure
197+
198+
Allows `gh-ost` to connect to the MySQL servers using encrypted connections, but without verifying the validity of the certificate provided by the server during the connection. Requires `--ssl`.
199+
200+
### ssl-ca
201+
202+
`--ssl-ca=/path/to/ca-cert.pem`: ca certificate file (in PEM format) to use for server certificate verification. If specified, the default system ca cert pool will not be used for verification, only the ca cert provided here. Requires `--ssl`.
203+
204+
### ssl-cert
205+
206+
`--ssl-cert=/path/to/ssl-cert.crt`: SSL public key certificate file (in PEM format).
207+
208+
### ssl-key
209+
210+
`--ssl-key=/path/to/ssl-key.key`: SSL private key file (in PEM format).
211+
168212
### test-on-replica
169213

170214
Issue the migration on a replica; do not modify data on master. Useful for validating, testing and benchmarking. See [`testing-on-replica`](testing-on-replica.md)
171215

216+
### test-on-replica-skip-replica-stop
217+
218+
Default `False`. When `--test-on-replica` is enabled, do not issue commands stop replication (requires `--test-on-replica`).
219+
172220
### throttle-control-replicas
173221

174222
Provide a command delimited list of replicas; `gh-ost` will throttle when any of the given replicas lag beyond [`--max-lag-millis`](#max-lag-millis). The list can be queried and updated dynamically via [interactive commands](interactive-commands.md)

doc/hooks.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,14 @@ The following variables are available on all hooks:
6565
- `GH_OST_ELAPSED_COPY_SECONDS` - row-copy time (excluding startup, row-count and postpone time)
6666
- `GH_OST_ESTIMATED_ROWS` - estimated total rows in table
6767
- `GH_OST_COPIED_ROWS` - number of rows copied by `gh-ost`
68+
- `GH_OST_INSPECTED_LAG` - lag in seconds (floating point) of inspected server
69+
- `GH_OST_PROGRESS` - progress pct ([0..100], floating point) of migration
6870
- `GH_OST_MIGRATED_HOST`
6971
- `GH_OST_INSPECTED_HOST`
7072
- `GH_OST_EXECUTING_HOST`
7173
- `GH_OST_HOOKS_HINT` - copy of `--hooks-hint` value
74+
- `GH_OST_HOOKS_HINT_OWNER` - copy of `--hooks-hint-owner` value
75+
- `GH_OST_HOOKS_HINT_TOKEN` - copy of `--hooks-hint-token` value
7276
- `GH_OST_DRY_RUN` - whether or not the `gh-ost` run is a dry run
7377

7478
The following variable are available on particular hooks:

0 commit comments

Comments
 (0)