You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge pull request #1 from wix-playground/where-clause
online schema changes with deletion.
architecture as detailed explained here: https://kb.wixpress.com/x/8pocBQ
Where clause condition will always receive the default 1=1.
in case we would like to delete table data we will use the where clause as in a "select" meaning we will put the data we want to save in the where clause.
to include values on the where clause - use the condition as it is. for exclude values please put "not" before.
Please note :
Where clause condition will be enforced only from the source table and not from the binlog. meaning if I put a where clause of id < 100, and id # 2 was updated \ inserted, it will be in the new table because this DML will be taken from the binlog. this is a feature since this is newly update\insert otherwise it should be inserted into the binlogs as a deleted row.
If you are using one filter operation with in , please don't put more than 5 values. otherwise please use the sub-select option.
For hash \ string it is better to use the sub-select option, avoiding string manipulation issues in the middle (Jenkins, ansible, Casper).
Where clause can not be edited in the middle of ghost run.
Copy file name to clipboardExpand all lines: go/cmd/gh-ost/main.go
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -116,6 +116,7 @@ func main() {
116
116
throttleControlReplicas:=flag.String("throttle-control-replicas", "", "List of replicas on which to check for lag; comma delimited. Example: myhost1.com:3306,myhost2.com,myhost3.com:3307")
117
117
throttleQuery:=flag.String("throttle-query", "", "when given, issued (every second) to check if operation should throttle. Expecting to return zero for no-throttle, >0 for throttle. Query is issued on the migrated server. Make sure this query is lightweight")
118
118
throttleHTTP:=flag.String("throttle-http", "", "when given, gh-ost checks given URL via HEAD request; any response code other than 200 (OK) causes throttling; make sure it has low latency response")
119
+
copyWhereClause:=flag.String("where-clause", "1=1", "added where clause for the insert query, filtering table rows")
119
120
flag.Int64Var(&migrationContext.ThrottleHTTPIntervalMillis, "throttle-http-interval-millis", 100, "Number of milliseconds to wait before triggering another HTTP throttle check")
120
121
flag.Int64Var(&migrationContext.ThrottleHTTPTimeoutMillis, "throttle-http-timeout-millis", 1000, "Number of milliseconds to use as an HTTP throttle check timeout")
121
122
ignoreHTTPErrors:=flag.Bool("ignore-http-errors", false, "ignore HTTP connection errors during throttle check")
where (((name > ?) or (((name = ?)) AND (position > ?)) or ((name = ?) and (position = ?))) and ((name < ?) or (((name = ?)) AND (position < ?)) or ((name = ?) and (position = ?))))
412
+
where (((name > ?) or (((name = ?)) AND (position > ?)) or ((name = ?) and (position = ?))) and ((name < ?) or (((name = ?)) AND (position < ?)) or ((name = ?) and (position = ?))) and 1=1)
0 commit comments