Skip to content

Commit

Permalink
Use /vt/bin for mysqlbinlog and add it to PATH
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Lord <[email protected]>
  • Loading branch information
mattlord committed May 1, 2024
1 parent 573b44f commit 2f7768a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
7 changes: 6 additions & 1 deletion pkg/operator/vttablet/env_vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ package vttablet

import (
"fmt"
"os"
"strings"

"planetscale.dev/vitess-operator/pkg/operator/lazy"
corev1 "k8s.io/api/core/v1"
"planetscale.dev/vitess-operator/pkg/operator/lazy"
)

func init() {
Expand All @@ -40,6 +41,10 @@ func init() {
Name: "EXTRA_MY_CNF",
Value: strings.Join(extraMyCnf.Get(spec), ":"),
},
// The mysqlbinlog binary is NOT in the vendor mysql container images
// so we copy it to /mnt/vt/bin when initializing the mysqld container
// so that mysqlctl can find it.
{Name: "PATH", Value: fmt.Sprintf("%s:%s", os.Getenv("PATH"), vtBinPath)},
}
})

Expand Down
2 changes: 1 addition & 1 deletion pkg/operator/vttablet/mysqlctld.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const (
vtRootInitScript = `set -ex
mkdir -p /mnt/vt/bin
cp --no-clobber /vt/bin/mysqlctld /mnt/vt/bin/
cp --no-clobber $(command -v mysqlbinlog) /mnt/vt/bin/ || true
cp --no-clobber /usr/bin/mysqlbinlog /mnt/vt/bin/
mkdir -p /mnt/vt/config
if [[ -d /vt/config/mycnf ]]; then
cp --no-clobber -R /vt/config/mycnf /mnt/vt/config/
Expand Down
2 changes: 2 additions & 0 deletions test/endtoend/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,9 @@ function waitForKeyspaceToBeServing() {
nb_of_replica=$3
for i in {1..600} ; do
out=$(mysql --table --execute="show vitess_tablets")
echo "Serving output: ${out}"
numtablets=$(echo "$out" | grep -E "$ks(.*)$shard(.*)PRIMARY(.*)SERVING|$ks(.*)$shard(.*)REPLICA(.*)SERVING" | wc -l)
echo "Number of serving tablets: ${numtablets}"
if [[ $numtablets -ge $((nb_of_replica+1)) ]]; then
echo "Shard $ks/$shard is serving"
return
Expand Down

0 comments on commit 2f7768a

Please sign in to comment.