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

chore: add kill query randomly vacuum table test #11424

Merged
merged 1 commit into from
May 12, 2023
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
vacuum table success
35 changes: 35 additions & 0 deletions tests/suites/5_ee/01_vacuum/01_0001_ee_vacuum_kill_randomly.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash

CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. "$CURDIR"/../../../shell_env.sh

## Setup
echo "drop database if exists test_vacuum" | $MYSQL_CLIENT_CONNECT

echo "CREATE DATABASE test_vacuum" | $MYSQL_CLIENT_CONNECT
echo "create table test_vacuum.a(c int)" | $MYSQL_CLIENT_CONNECT

# insert some values
bash ./suites/5_ee/00_vacuum/insert_vacuum_table_values > /dev/null 2>&1 &

# kill query randomly
sleep 5
killall databend-query
killall insert_vacuum_table_values

# restart query
bash ../scripts/ci/deploy/databend-query-standalone.sh > /dev/null 2>&1

# check if before and after vacuum table the table count matched
old_count=`echo "select * from test_vacuum.a order by c" | $MYSQL_CLIENT_CONNECT`

echo "vacuum table test_vacuum.a retain 0 hours" | | $MYSQL_CLIENT_CONNECT
#echo "optimize table test_vacuum.a all" | $MYSQL_CLIENT_CONNECT
count=`echo "select * from test_vacuum.a order by c" | $MYSQL_CLIENT_CONNECT`
if [ $old_count -ne $count ]; then
echo "vacuum table, old count:$old_count,new count:$count"
exit -1
fi

echo "vacuum table success"
echo "drop database if exists test_vacuum" | $MYSQL_CLIENT_CONNECT
9 changes: 9 additions & 0 deletions tests/suites/5_ee/01_vacuum/insert_vacuum_table_values
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. "$CURDIR"/../../../shell_env.sh

for((i=1;i<=1000;i++));
do
echo "INSERT INTO test_vacuum.a VALUES ($i)" | $MYSQL_CLIENT_CONNECT
done