Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vttablet: ignore errors if extracted gh-ost binary is identical to installed binary #6928

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions go/cmd/vttablet/vttablet.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ limitations under the License.
package main

import (
"bytes"
"flag"
"io/ioutil"

Expand Down Expand Up @@ -173,11 +174,19 @@ func extractOnlineDDL() error {
}

if binaryFileName, isOverride := onlineddl.GhostBinaryFileName(); !isOverride {
// there is no path override for gh-ost. We're expected to auto-extract gh-ost.
ghostBinary, err := riceBox.Bytes("gh-ost")
if err != nil {
return err
}
if err := ioutil.WriteFile(binaryFileName, ghostBinary, 0755); err != nil {
// One possibility of failure is that gh-ost is up and running. In that case,
// let's pause and check if the running gh-ost is exact same binary as the one we wish to extract.
foundBytes, _ := ioutil.ReadFile(binaryFileName)
if bytes.Equal(ghostBinary, foundBytes) {
// OK, it's the same binary, there is no need to extract the file anyway
return nil
}
return err
}
}
Expand Down