-
Notifications
You must be signed in to change notification settings - Fork 483
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36527 from code-dot-org/dtp_candidate_821920e5
DTP (Test > Production: 821920e)
- Loading branch information
Showing
44 changed files
with
905 additions
and
212 deletions.
There are no files selected for viewing
95 changes: 95 additions & 0 deletions
95
bin/oneoff/gh-ost_migrations/add_time_spent_column_to_user_levels.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
#!/bin/bash | ||
|
||
DB_USER=${DB_USER?Required} | ||
DB_PASSWORD=${DB_PASSWORD?Required} | ||
DB_MASTER_HOST=${DB_MASTER_HOST?Required} | ||
|
||
# Options reference: https://github.com/github/gh-ost/blob/master/go/cmd/gh-ost/main.go | ||
args=( | ||
# MySQL user | ||
--user=${DB_USER} | ||
|
||
# MySQL password | ||
--password=${DB_PASSWORD} | ||
|
||
# We don't have a reporting replica anymore, so carry out all operations on primary database | ||
--allow-on-master | ||
|
||
# MySQL hostname (preferably a replica, not the master) | ||
--host=${DB_MASTER_HOST} | ||
|
||
# (optional) explicitly tell gh-ost the identity of the master. | ||
# Format: some.host.com[:port] | ||
# This is useful in master-master setups where you wish to pick an explicit master, | ||
# or in a tungsten-replicator where gh-ost is unable to determine the master | ||
--assume-master-host=${DB_MASTER_HOST} | ||
|
||
# while this file exists, migration will postpone the final stage of swapping tables, | ||
# and will keep on syncing the ghost table. | ||
# Cut-over/swapping would be ready to perform the moment the file is deleted. | ||
--postpone-cut-over-flag-file=/tmp/gh-ost.cutover | ||
|
||
# directory where hook files are found (default: empty, ie. hooks disabled). | ||
# Hook files found on this path, and conforming to hook naming conventions will be executed | ||
--hooks-path=${PWD} | ||
|
||
# database name (mandatory) | ||
--database="dashboard_production" | ||
|
||
# table name (mandatory) | ||
--table="user_levels" | ||
|
||
# verbose | ||
--verbose | ||
|
||
# alter statement (mandatory) | ||
--alter="ADD time_spent int" | ||
|
||
# Drop a possibly existing Ghost table (remains from a previous run?) before beginning operation. | ||
# Default is to panic and abort if such table exists | ||
# --initially-drop-ghost-table | ||
|
||
# Drop a possibly existing OLD table (remains from a previous run?) before beginning operation. | ||
# Default is to panic and abort if such table exists | ||
# --initially-drop-old-table | ||
|
||
# Comma delimited status-name=threshold. | ||
# e.g: 'Threads_running=100,Threads_connected=500'. | ||
# When status exceeds threshold, app throttles writes | ||
--max-load=Threads_running=30 | ||
|
||
# set to 'true' when you know for certain your server uses 'ROW' binlog_format. | ||
# gh-ost is unable to tell, even after reading binlog_format, whether the replication process does indeed use 'ROW', | ||
# and restarts replication to be certain RBR setting is applied. | ||
# Such operation requires SUPER privileges which you might not have. | ||
# Setting this flag avoids restarting replication and you can proceed to use gh-ost without SUPER privileges | ||
--assume-rbr | ||
|
||
# amount of rows to handle in each iteration (allowed range: 100-100,000) | ||
--chunk-size=1000 | ||
|
||
# batch size for DML events to apply in a single transaction (range 1-100) | ||
--dml-batch-size=100 | ||
|
||
# Default number of retries for various operations before panicking | ||
--default-retries=1000 | ||
|
||
# choose cut-over type (default|atomic, two-step) | ||
--cut-over=default | ||
|
||
# actually count table rows as opposed to estimate them (results in more accurate progress estimation) | ||
--exact-rowcount | ||
|
||
# (with --exact-rowcount) | ||
# when true (default): count rows after row-copy begins, concurrently, and adjust row estimate later on; | ||
# when false: first count rows, then start row copy | ||
--concurrent-rowcount | ||
|
||
# when this file is created, gh-ost will immediately terminate, without cleanup | ||
--panic-flag-file=/tmp/gh-ost.panic.flag | ||
|
||
# actually execute the alter & migrate the table. Default is noop: do some tests and exit | ||
# --execute | ||
) | ||
|
||
./gh-ost "${args[@]}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.