Skip to content

Commit 57cf5f3

Browse files
author
Justin Fudally
committed
add override to ignore http errors
1 parent 46dabd3 commit 57cf5f3

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

go/base/context.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ type MigrationContext struct {
119119
ThrottleAdditionalFlagFile string
120120
throttleQuery string
121121
throttleHTTP string
122-
ignoreHTTPErrors bool
122+
IgnoreHTTPErrors bool
123123
ThrottleCommandedByUser int64
124124
HibernateUntil int64
125125
maxLoad LoadMap
@@ -579,7 +579,7 @@ func (this *MigrationContext) SetIgnoreHTTPErrors(ignoreHTTPErrors bool) {
579579
this.throttleHTTPMutex.Lock()
580580
defer this.throttleHTTPMutex.Unlock()
581581

582-
this.ignoreHTTPErrors = ignoreHTTPErrors
582+
this.IgnoreHTTPErrors = ignoreHTTPErrors
583583
}
584584

585585
func (this *MigrationContext) GetMaxLoad() LoadMap {

go/cmd/gh-ost/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ func main() {
106106
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")
107107
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")
108108
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")
109-
ignoreHTTPErrors := flag.Bool("ignore-http-error", false, "ignore HTTP connection errors during throttle check")
109+
ignoreHTTPErrors := flag.Bool("ignore-http-errors", false, "ignore HTTP connection errors during throttle check")
110110
heartbeatIntervalMillis := flag.Int64("heartbeat-interval-millis", 100, "how frequently would gh-ost inject a heartbeat value")
111111
flag.StringVar(&migrationContext.ThrottleFlagFile, "throttle-flag-file", "", "operation pauses when this file exists; hint: use a file that is specific to the table being altered")
112112
flag.StringVar(&migrationContext.ThrottleAdditionalFlagFile, "throttle-additional-flag-file", "/tmp/gh-ost.throttle", "operation pauses when this file exists; hint: keep default, use for throttling multiple gh-ost operations")

go/logic/throttler.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,10 @@ func (this *Throttler) collectThrottleHTTPStatus(firstThrottlingCollected chan<-
291291

292292
_, err := collectFunc()
293293
if err != nil {
294-
// If an error occurs during the HTTP throttle check, let's throttle to be safe
295-
atomic.StoreInt64(&this.migrationContext.ThrottleHTTPStatusCode, int64(-1))
294+
// If not told to ignore errors, we'll throttle on HTTP connection issues
295+
if !this.migrationContext.IgnoreHTTPErrors {
296+
atomic.StoreInt64(&this.migrationContext.ThrottleHTTPStatusCode, int64(-1))
297+
}
296298
}
297299

298300
firstThrottlingCollected <- true

0 commit comments

Comments
 (0)