diff --git a/Makefile b/Makefile index f75e3a0721c..18cb702ed62 100644 --- a/Makefile +++ b/Makefile @@ -48,13 +48,16 @@ endif # Safe, since this code isn't performance critical. export CGO_CFLAGS := -O1 +# Disable CGO explicitly +export CGO_ENABLED=0 + # build the vitess binaries with dynamic dependency on libc build-dyn: ifndef NOBANNER echo $$(date): Building source tree endif bash ./build.env - CGO_ENABLED=0 go install -trimpath $(EXTRA_BUILD_FLAGS) $(VT_GO_PARALLEL) -ldflags "$(shell tools/build_version_flags.sh)" ./go/... + go install -trimpath $(EXTRA_BUILD_FLAGS) $(VT_GO_PARALLEL) -ldflags "$(shell tools/build_version_flags.sh)" ./go/... # build the vitess binaries statically build: @@ -63,7 +66,7 @@ ifndef NOBANNER endif bash ./build.env # build all the binaries by default with CGO disabled. - CGO_ENABLED=0 go install -trimpath $(EXTRA_BUILD_FLAGS) $(VT_GO_PARALLEL) -ldflags "$(shell tools/build_version_flags.sh)" ./go/... + go install -trimpath $(EXTRA_BUILD_FLAGS) $(VT_GO_PARALLEL) -ldflags "$(shell tools/build_version_flags.sh)" ./go/... # cross-build can be used to cross-compile Vitess client binaries # Outside of select client binaries (namely vtctlclient & vtexplain), cross-compiled Vitess Binaries are not recommended for production deployments @@ -76,7 +79,7 @@ endif # In order to cross-compile, go install requires GOBIN to be unset export GOBIN="" # For the specified GOOS + GOARCH, build all the binaries by default with CGO disabled - CGO_ENABLED=0 GOOS=${GOOS} GOARCH=${GOARCH} go install -trimpath $(EXTRA_BUILD_FLAGS) $(VT_GO_PARALLEL) -ldflags "$(shell tools/build_version_flags.sh)" ./go/... + GOOS=${GOOS} GOARCH=${GOARCH} go install -trimpath $(EXTRA_BUILD_FLAGS) $(VT_GO_PARALLEL) -ldflags "$(shell tools/build_version_flags.sh)" ./go/... if [ ! -x "${HOME}/go/bin/${GOOS}_${GOARCH}/vttablet" ]; then \ echo "Missing vttablet at: ${HOME}/go/bin/${GOOS}_${GOARCH}/vttablet" && exit; \ diff --git a/docker/base/Dockerfile.percona57 b/docker/base/Dockerfile.percona57 index e3fb8bedc95..e30e0172d93 100644 --- a/docker/base/Dockerfile.percona57 +++ b/docker/base/Dockerfile.percona57 @@ -1,4 +1,4 @@ -ARG bootstrap_version=10.2 +ARG bootstrap_version=19 ARG image="vitess/bootstrap:${bootstrap_version}-percona57" FROM "${image}" diff --git a/docker/base/Dockerfile.percona80 b/docker/base/Dockerfile.percona80 index c7ae3ed7ac2..cfc93d3a579 100644 --- a/docker/base/Dockerfile.percona80 +++ b/docker/base/Dockerfile.percona80 @@ -1,4 +1,4 @@ -ARG bootstrap_version=10.2 +ARG bootstrap_version=19 ARG image="vitess/bootstrap:${bootstrap_version}-percona80" FROM "${image}" diff --git a/go/vt/discovery/tablet_health_check.go b/go/vt/discovery/tablet_health_check.go index f0ad9b0a2ac..338a229b48c 100644 --- a/go/vt/discovery/tablet_health_check.go +++ b/go/vt/discovery/tablet_health_check.go @@ -303,6 +303,7 @@ func (thc *tabletHealthCheck) checkConn(hc *HealthCheckImpl) { // up = false because we did not get a healthy response hc.updateHealth(thc.SimpleCopy(), thc.Target, false, false) } + // If there was a timeout send an error. We do this after stream has returned. // This will ensure that this update prevails over any previous message that // stream could have sent. diff --git a/go/vt/grpcclient/client_auth_static.go b/go/vt/grpcclient/client_auth_static.go index 53be18cc4ff..4b70680121e 100644 --- a/go/vt/grpcclient/client_auth_static.go +++ b/go/vt/grpcclient/client_auth_static.go @@ -20,6 +20,8 @@ import ( "encoding/json" "flag" "os" + "sync" + "errors" "context" @@ -31,6 +33,10 @@ var ( credsFile = flag.String("grpc_auth_static_client_creds", "", "when using grpc_static_auth in the server, this file provides the credentials to use to authenticate with server") // StaticAuthClientCreds implements client interface to be able to WithPerRPCCredentials _ credentials.PerRPCCredentials = (*StaticAuthClientCreds)(nil) + + clientCreds = (*StaticAuthClientCreds)(nil) + + once sync.Once ) // StaticAuthClientCreds holder for client credentials @@ -59,15 +65,26 @@ func AppendStaticAuth(opts []grpc.DialOption) ([]grpc.DialOption, error) { if *credsFile == "" { return opts, nil } - data, err := os.ReadFile(*credsFile) - if err != nil { - return nil, err - } - clientCreds := &StaticAuthClientCreds{} - err = json.Unmarshal(data, clientCreds) - if err != nil { - return nil, err + + once.Do(func() { + credsData, err := os.ReadFile(*credsFile) + if err != nil { + // to-do: log the error message + return + } + + clientCreds = &StaticAuthClientCreds{} + err = json.Unmarshal(credsData, clientCreds) + if err != nil { + // to-do: log the error message + return + } + }) + + if clientCreds == nil { + return nil, errors.New("no client creds found") } + creds := grpc.WithPerRPCCredentials(clientCreds) opts = append(opts, creds) return opts, nil