Skip to content
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
30 changes: 22 additions & 8 deletions examples/local/401_teardown.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# this script brings down zookeeper and all the vitess components
# we brought up in the example
# optionally, you may want to delete everything that was created
# by the example from $VTDATAROOT
# We should not assume that any of the steps have been executed.
# This makes it possible for a user to cleanup at any point.

set -e

# shellcheck disable=SC2128
script_root=$(dirname "${BASH_SOURCE}")

./vtgate-down.sh
CELL=zone1 UID_BASE=100 "$script_root/vttablet-down.sh"
CELL=zone1 UID_BASE=300 "$script_root/vttablet-down.sh"
CELL=zone1 UID_BASE=400 "$script_root/vttablet-down.sh"

for TABLET in 100 200 300 400; do
./lvtctl.sh GetTablet zone1-$TABLET >/dev/null 2>&1 && CELL=zone1 UID_BASE=$TABLET "$script_root/vttablet-down.sh"
done;

./vtctld-down.sh

if [ "${TOPO}" = "zk2" ]; then
Expand All @@ -36,6 +36,20 @@ else
CELL=zone1 "$script_root/etcd-down.sh"
fi

rm -r $VTDATAROOT/*
# pedantic check: grep for any remaining processes

if [ ! -z "$VTDATAROOT" ]; then

if pgrep -f -l "$VTDATAROOT" > /dev/null; then
echo "ERROR: Stale processes detected! It is recommended to manuallly kill them:"
pgrep -f -l "$VTDATAROOT"
else
echo "All good! It looks like every process has shut down"
fi

# shellcheck disable=SC2086
rm -r ${VTDATAROOT:?}/*

fi

disown -a