Skip to content

Commit

Permalink
Merge pull request #262 from venkatesh-prasad-v/v2.6.2
Browse files Browse the repository at this point in the history
RM-1376: ProxySQL 2.6.2 Release
  • Loading branch information
venkatesh-prasad-v committed Apr 17, 2024
2 parents 94b3a08 + f0e8ffb commit 2000677
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 6 deletions.
5 changes: 5 additions & 0 deletions proxysql-admin-common
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,11 @@ function syncusers() {

username=${user}
password="${mysql_users_full_hash[${username}]}"

# Since we're using single quotes within the SQL statement, only need
# to escape the single quotes for SQL
password=${password//\'/\'\'}

debug "$LINENO" "Processing MySQL user: '${username}'"

# Check if the user exists in ProxySQL
Expand Down
11 changes: 10 additions & 1 deletion tests/proxysql-admin-testsuite.bats
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,16 @@ fi
echo "$output" >&2
[ "$status" -eq 0 ]

[[ "${lines[2]}" =~ "Added query rule for user: test_query_rule" ]]
local len=${#lines[@]}
local pattern_found=0

for i in $(seq 0 $((len - 1))); do
if [[ "${lines[$i]}" =~ "Added query rule for user: test_query_rule" ]]; then
pattern_found=1
fi
done

[[ $pattern_found -eq 1 ]]

run_write_hg_query_rule_user=$(proxysql_exec "select 1 from runtime_mysql_query_rules where username='test_query_rule' and match_digest='^SELECT.*FOR UPDATE'" | awk '{print $0}')
echo "$LINENO : Query rule count for user 'test_query_rule' with writer hostgroup found:$run_write_hg_query_rule_user expect:1" >&2
Expand Down
24 changes: 20 additions & 4 deletions tests/proxysql-admin-testsuite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ declare REPL_PASSWORD="pass1234"
# Set this to 1 to run the tests
declare RUN_TEST=1

# Options to skip killing old mysqld and proxysql processes
declare KILL_OLD_MYSQLD=1
declare KILL_OLD_PROXYSQL=1

# Set this to 1 to include creating and running the tests
# for cluster 2
declare USE_CLUSTER_TWO=1
Expand Down Expand Up @@ -87,6 +91,8 @@ Options:
left up-and-running (useful for quickly starting
a test environment). This requires a manual running
of the proxysql-admin script.
--no-kill-mysqld Dont kill previous mysqld servers
--no-kill-proxysql Dont kill previous proxysql servers
--cluster-one-only Only starts up (and runs the tests) for cluster_one.
May be used with --no-test to startup only one cluster.
--ipv4 Run the tests using IPv4 addresses (default)
Expand Down Expand Up @@ -136,6 +142,12 @@ function parse_args() {
--test)
TEST_NAMES=$value
;;
--no-kill-mysqld)
KILL_OLD_MYSQLD=0
;;
--no-kill-proxysql)
KILL_OLD_PROXYSQL=0
;;
*)
echo "ERROR: unknown parameter \"$param\""
usage
Expand Down Expand Up @@ -559,11 +571,15 @@ fi
declare ROOT_FS=$WORKDIR
mkdir -p $WORKDIR/logs

echo "Shutting down currently running mysqld instances"
sudo pkill -9 -x mysqld
if [[ $KILL_OLD_MYSQLD -eq 1 ]]; then
echo "Shutting down currently running mysqld instances"
sudo pkill -9 -x mysqld
fi

echo "Shutting down currently running proxysql instances"
sudo pkill -9 -x proxysql
if [[ $KILL_OLD_PROXYSQL -eq 1 ]]; then
echo "Shutting down currently running proxysql instances"
sudo pkill -9 -x proxysql
fi

#
# Check file locations before doing anything
Expand Down
12 changes: 11 additions & 1 deletion tests/scheduler-admin-testsuite.bats
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,17 @@ sudo sed -i "0,/^[ \t]*maxNumWriters[ \t]*=.*$/s|^[ \t]*maxNumWriters[ \t]*=.*$|
run sudo PATH=$WORKDIR:$PATH $WORKDIR/percona-scheduler-admin --config-file=testsuite.toml --syncusers --add-query-rule
echo "$output" >&2
[ "$status" -eq 0 ]
[[ "${lines[2]}" =~ "Added query rule for user: test_query_rule" || "${lines[3]}" =~ "Added query rule for user: test_query_rule" ]]

local len=${#lines[@]}
local pattern_found=0

for i in $(seq 0 $((len - 1))); do
if [[ "${lines[$i]}" =~ "Added query rule for user: test_query_rule" ]]; then
pattern_found=1
fi
done

[[ $pattern_found -eq 1 ]]

run_write_hg_query_rule_user=$(proxysql_exec "select 1 from runtime_mysql_query_rules where username='test_query_rule' and match_digest='^SELECT.*FOR UPDATE'" | awk '{print $0}')
echo "$LINENO : Query rule count for user 'test_query_rule' with writer hostgroup found:$run_write_hg_query_rule_user expect:1" >&2
Expand Down

0 comments on commit 2000677

Please sign in to comment.