From 86ec7dbe6dbe790dbe718525f3ef6abaf8d5e5f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Gagn=C3=A9?= Date: Wed, 5 Jul 2023 18:30:22 -0400 Subject: [PATCH 01/10] Make etcd-up.sh output consistent with vtctld-up.sh. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jean-François Gagné --- examples/common/scripts/etcd-up.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/common/scripts/etcd-up.sh b/examples/common/scripts/etcd-up.sh index 20a16a42260..1894d5075db 100755 --- a/examples/common/scripts/etcd-up.sh +++ b/examples/common/scripts/etcd-up.sh @@ -21,6 +21,8 @@ source "$(dirname "${BASH_SOURCE[0]:-$0}")/../env.sh" cell=${CELL:-'test'} export ETCDCTL_API=2 +echo "Starting etcd..." + # Check that etcd is not already running curl "http://${ETCD_SERVER}" > /dev/null 2>&1 && fail "etcd is already running. Exiting." @@ -46,6 +48,6 @@ vtctl $TOPOLOGY_FLAGS VtctldCommand AddCellInfo \ $cell set -e -echo "etcd start done..." +echo "etcd is running!" From 28517951378ddc193186726c72265adf1d3b5ff1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Gagn=C3=A9?= Date: Wed, 5 Jul 2023 18:33:06 -0400 Subject: [PATCH 02/10] Remove --server from vtctldclient in 101_initial_cluster.sh. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was not needed as redundant with alias already defined in ../common/env.sh. Signed-off-by: Jean-François Gagné --- examples/local/101_initial_cluster.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/local/101_initial_cluster.sh b/examples/local/101_initial_cluster.sh index 4497872252e..f49de4b1829 100755 --- a/examples/local/101_initial_cluster.sh +++ b/examples/local/101_initial_cluster.sh @@ -42,13 +42,13 @@ CELL=zone1 ../common/scripts/vtctld-up.sh if vtctldclient GetKeyspace commerce > /dev/null 2>&1 ; then # Keyspace already exists: we could be running this 101 example on an non-empty VTDATAROOT - vtctldclient --server localhost:15999 SetKeyspaceDurabilityPolicy --durability-policy=semi_sync commerce || fail "Failed to set keyspace durability policy on the commerce keyspace" + vtctldclient SetKeyspaceDurabilityPolicy --durability-policy=semi_sync commerce || fail "Failed to set keyspace durability policy on the commerce keyspace" else # Create the keyspace with the sidecar database name and set the # correct durability policy. Please see the comment above for # more context on using a custom sidecar database name in your # Vitess clusters. - vtctldclient --server localhost:15999 CreateKeyspace --sidecar-db-name="${SIDECAR_DB_NAME}" --durability-policy=semi_sync commerce || fail "Failed to create and configure the commerce keyspace" + vtctldclient CreateKeyspace --sidecar-db-name="${SIDECAR_DB_NAME}" --durability-policy=semi_sync commerce || fail "Failed to create and configure the commerce keyspace" fi # start vttablets for keyspace commerce From 47429eab738a64d737b81f94b469d38992759d2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Gagn=C3=A9?= Date: Wed, 5 Jul 2023 18:52:54 -0400 Subject: [PATCH 03/10] Make mysqlctl-up.sh output consistent with vtctld-up.sh. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jean-François Gagné --- examples/common/scripts/mysqlctl-up.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/common/scripts/mysqlctl-up.sh b/examples/common/scripts/mysqlctl-up.sh index d9df27ccdc0..ff20cae5793 100755 --- a/examples/common/scripts/mysqlctl-up.sh +++ b/examples/common/scripts/mysqlctl-up.sh @@ -40,3 +40,5 @@ mysqlctl \ --tablet_uid $uid \ --mysql_port $mysql_port \ $action + +echo -e "MySQL for tablet $alias is running!" From dfc4eb12058e21de51dce9968efa5ed0a41f64cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Gagn=C3=A9?= Date: Wed, 5 Jul 2023 18:53:11 -0400 Subject: [PATCH 04/10] Make vttablet-up.sh output consistent with vtctld-up.sh. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jean-François Gagné --- examples/common/scripts/vttablet-up.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/common/scripts/vttablet-up.sh b/examples/common/scripts/vttablet-up.sh index d3ce1ae06ba..9f723603c0c 100755 --- a/examples/common/scripts/vttablet-up.sh +++ b/examples/common/scripts/vttablet-up.sh @@ -67,3 +67,5 @@ done # check one last time curl -I "http://$hostname:$port/debug/status" || fail "tablet could not be started!" + +echo -e "vttablet for $alias is running!" From a12425911ca101d321a17ff1801d8bb84f1575cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Gagn=C3=A9?= Date: Wed, 5 Jul 2023 18:56:21 -0400 Subject: [PATCH 05/10] Make vtorc-up.sh output consistent with vtctld-up.sh. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jean-François Gagné --- examples/common/scripts/vtorc-up.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/common/scripts/vtorc-up.sh b/examples/common/scripts/vtorc-up.sh index 66a826da288..23ca4e62b48 100755 --- a/examples/common/scripts/vtorc-up.sh +++ b/examples/common/scripts/vtorc-up.sh @@ -6,6 +6,7 @@ source "${script_dir}/../env.sh" log_dir="${VTDATAROOT}/tmp" port=16000 +echo "Starting vtorc..." vtorc \ $TOPOLOGY_FLAGS \ --logtostderr \ From c3abae5a63b9132f5f276738f001d2bbf54719ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Gagn=C3=A9?= Date: Wed, 5 Jul 2023 19:03:56 -0400 Subject: [PATCH 06/10] Make vtgate-up.sh output consistent with vtctld-up.sh. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jean-François Gagné --- examples/common/scripts/vtgate-up.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/common/scripts/vtgate-up.sh b/examples/common/scripts/vtgate-up.sh index 03b85869e5d..fd28cda9ad1 100755 --- a/examples/common/scripts/vtgate-up.sh +++ b/examples/common/scripts/vtgate-up.sh @@ -24,7 +24,7 @@ grpc_port=15991 mysql_server_port=15306 mysql_server_socket_path="/tmp/mysql.sock" -# Start vtgate. +echo "Starting vtgate..." # shellcheck disable=SC2086 vtgate \ $TOPOLOGY_FLAGS \ @@ -45,7 +45,6 @@ vtgate \ # Block waiting for vtgate to be listening # Not the same as healthy -echo "Waiting for vtgate to be up..." while true; do curl -I "http://$hostname:$web_port/debug/status" >/dev/null 2>&1 && break sleep 0.1 From 04a9b62aa5b12e6524ea9b4c8a9d99eafd687c04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Gagn=C3=A9?= Date: Fri, 7 Jul 2023 16:43:51 -0400 Subject: [PATCH 07/10] Start mysqlctls in parallel in 101_initial_cluster.sh. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MySQL takes time to start, and we have 3 to start. Instead of waiting 3 times for MySQL to start, we start in the background and wait for the 3 at the same time. This makes 101_initial_cluster.sh significantly quicker to run. Signed-off-by: Jean-François Gagné --- examples/local/101_initial_cluster.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/examples/local/101_initial_cluster.sh b/examples/local/101_initial_cluster.sh index f49de4b1829..95b51f168cd 100755 --- a/examples/local/101_initial_cluster.sh +++ b/examples/local/101_initial_cluster.sh @@ -51,9 +51,20 @@ else vtctldclient CreateKeyspace --sidecar-db-name="${SIDECAR_DB_NAME}" --durability-policy=semi_sync commerce || fail "Failed to create and configure the commerce keyspace" fi +# start mysqlctls for keyspace commerce +# because MySQL takes time to start, we do this in parallel +for i in 100 101 102; do + CELL=zone1 TABLET_UID=$i ../common/scripts/mysqlctl-up.sh & +done + +# without a sleep, we can have below echo happen before the echo of mysqlctl-up.sh +sleep 2 +echo "Waiting for mysqlctls to start..." +wait +echo "mysqlctls are running!" + # start vttablets for keyspace commerce for i in 100 101 102; do - CELL=zone1 TABLET_UID=$i ../common/scripts/mysqlctl-up.sh CELL=zone1 KEYSPACE=commerce TABLET_UID=$i ../common/scripts/vttablet-up.sh done From 09ecf952d0ad6c075dde3eedb3ed4dfbf9abbb5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Gagn=C3=A9?= Date: Fri, 7 Jul 2023 16:50:13 -0400 Subject: [PATCH 08/10] Stop mysqlctls in parallel in 401_teardown.sh. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MySQL takes time to stop, and we have at least 3 to stop, maybe more. Instead of waiting n times for MySQL to stop, we stop in the background and wait for them at the same time. This makes 401_teardown.sh significantly quicker to run. Signed-off-by: Jean-François Gagné --- examples/local/401_teardown.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/examples/local/401_teardown.sh b/examples/local/401_teardown.sh index b4553099c9f..c881359a0d5 100755 --- a/examples/local/401_teardown.sh +++ b/examples/local/401_teardown.sh @@ -33,8 +33,15 @@ for tablet in 100 200 300 400; do printf -v alias '%s-%010d' 'zone1' $uid echo "Shutting down tablet $alias" CELL=zone1 TABLET_UID=$uid ../common/scripts/vttablet-down.sh + # because MySQL takes time to stop, we do this in parallel CELL=zone1 TABLET_UID=$uid ../common/scripts/mysqlctl-down.sh done + + # without a sleep below, we can have the echo happen before the echo of mysqlctl-down.sh + sleep 2 + echo "Waiting mysqlctl to stop..." + wait + echo "mysqlctls are stopped!" fi done From 390a5d87057a40f73184334fc7d79285f04940c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Gagn=C3=A9?= Date: Fri, 7 Jul 2023 16:53:50 -0400 Subject: [PATCH 09/10] Really stop mysqlctls in parallel in 401_teardown.sh. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Forgot the parallel bit in the previous commit. Signed-off-by: Jean-François Gagné --- 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 c881359a0d5..8f3e7844c5a 100755 --- a/examples/local/401_teardown.sh +++ b/examples/local/401_teardown.sh @@ -34,7 +34,7 @@ for tablet in 100 200 300 400; do echo "Shutting down tablet $alias" CELL=zone1 TABLET_UID=$uid ../common/scripts/vttablet-down.sh # because MySQL takes time to stop, we do this in parallel - CELL=zone1 TABLET_UID=$uid ../common/scripts/mysqlctl-down.sh + CELL=zone1 TABLET_UID=$uid ../common/scripts/mysqlctl-down.sh & done # without a sleep below, we can have the echo happen before the echo of mysqlctl-down.sh From 71804f3e151571a33a83436ea99136d0d0e868f1 Mon Sep 17 00:00:00 2001 From: Rohit Nayak Date: Sat, 2 Sep 2023 16:03:55 +0200 Subject: [PATCH 10/10] Trigger rebuild Signed-off-by: Rohit Nayak