From 185820f1bbf20fb13c03906aacbf547c23afa3c0 Mon Sep 17 00:00:00 2001 From: Rohit Nayak Date: Mon, 5 Jun 2023 15:11:19 +0000 Subject: [PATCH 1/3] --config-file-not-found-handling wasn't being read, fixed. Added this flag to all binaries in local examples Signed-off-by: Rohit Nayak --- examples/common/env.sh | 6 +++++- go/viperutil/config.go | 7 ++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/examples/common/env.sh b/examples/common/env.sh index adee0f34d3f..6f97195adea 100644 --- a/examples/common/env.sh +++ b/examples/common/env.sh @@ -30,6 +30,10 @@ for binary in mysqld etcd etcdctl curl vtctlclient vttablet vtgate vtctld mysqlc command -v "$binary" > /dev/null || fail "${binary} is not installed in PATH. See https://vitess.io/docs/get-started/local/ for install instructions." done; +for binary in vttablet vtgate vtctld mysqlctl vtorc vtctld vtctl; do + alias $binary="$binary --config-file-not-found-handling=ignore" +done; + if [ "${TOPO}" = "zk2" ]; then # Each ZooKeeper server needs a list of all servers in the quorum. # Since we're running them all locally, we need to give them unique ports. @@ -79,7 +83,7 @@ mkdir -p "${VTDATAROOT}/tmp" # such as ~/.my.cnf alias mysql="command mysql --no-defaults -h 127.0.0.1 -P 15306" -alias vtctlclient="command vtctlclient --server localhost:15999 --log_dir ${VTDATAROOT}/tmp --alsologtostderr" +alias vtctlclient="command vtctlclient --server localhost:15999 --log_dir ${VTDATAROOT}/tmp --alsologtostderr --config-file-not-found-handling=ignore" alias vtctldclient="command vtctldclient --server localhost:15999" # Make sure aliases are expanded in non-interactive shell diff --git a/go/viperutil/config.go b/go/viperutil/config.go index 2af1f0c5419..4b1120675f6 100644 --- a/go/viperutil/config.go +++ b/go/viperutil/config.go @@ -69,8 +69,9 @@ var ( configFileNotFoundHandling = Configure( "config.notfound.handling", Options[ConfigFileNotFoundHandling]{ - Default: WarnOnConfigFileNotFound, - GetFunc: getHandlingValue, + Default: WarnOnConfigFileNotFound, + GetFunc: getHandlingValue, + FlagName: "config-file-not-found-handling", }, ) configPersistenceMinInterval = Configure( @@ -110,7 +111,7 @@ func RegisterFlags(fs *pflag.FlagSet) { var h = configFileNotFoundHandling.Default() fs.Var(&h, "config-file-not-found-handling", fmt.Sprintf("Behavior when a config file is not found. (Options: %s)", strings.Join(handlingNames, ", "))) - BindFlags(fs, configPaths, configType, configName, configFile) + BindFlags(fs, configPaths, configType, configName, configFile, configFileNotFoundHandling, configPersistenceMinInterval) } // LoadConfig attempts to find, and then load, a config file for viper-backed From 6240da117307734d172a220a45b8f0a383f270bf Mon Sep 17 00:00:00 2001 From: Rohit Nayak Date: Mon, 5 Jun 2023 17:40:12 +0000 Subject: [PATCH 2/3] Prefer vtctldclient instead of vtctlclient in teardown Signed-off-by: Rohit Nayak --- examples/local/401_teardown.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/local/401_teardown.sh b/examples/local/401_teardown.sh index 08dcbf3cd29..ab93f453668 100755 --- a/examples/local/401_teardown.sh +++ b/examples/local/401_teardown.sh @@ -26,7 +26,7 @@ source ../common/env.sh ../common/scripts/vtgate-down.sh for tablet in 100 200 300 400; do - if vtctlclient --action_timeout 1s --server localhost:15999 GetTablet zone1-$tablet >/dev/null 2>&1; then + if vtctldclient --action_timeout 1s --server localhost:15999 GetTablet zone1-$tablet >/dev/null 2>&1; then # The zero tablet is up. Try to shutdown 0-2 tablet + mysqlctl for i in 0 1 2; do uid=$((tablet + i)) From 2f8284cc386df305f7a322247445e25be7a16ab9 Mon Sep 17 00:00:00 2001 From: Rohit Nayak Date: Wed, 7 Jun 2023 20:18:54 +0000 Subject: [PATCH 3/3] Address review comments Signed-off-by: Rohit Nayak --- examples/common/env.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/common/env.sh b/examples/common/env.sh index 6f97195adea..2b7c3ac7026 100644 --- a/examples/common/env.sh +++ b/examples/common/env.sh @@ -30,7 +30,8 @@ for binary in mysqld etcd etcdctl curl vtctlclient vttablet vtgate vtctld mysqlc command -v "$binary" > /dev/null || fail "${binary} is not installed in PATH. See https://vitess.io/docs/get-started/local/ for install instructions." done; -for binary in vttablet vtgate vtctld mysqlctl vtorc vtctld vtctl; do +# vtctlclient has a separate alias setup below +for binary in vttablet vtgate vtctld mysqlctl vtorc vtctl; do alias $binary="$binary --config-file-not-found-handling=ignore" done;