Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

examples/local/401_teardown start from any point #5349

Merged
merged 1 commit into from
Oct 28, 2019
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