|
172 | 172 | echo "$LINENO : Check query rule count for user(test_query_rule) found:$run_query_rule expect:0" >&2 |
173 | 173 | [[ "$run_query_rule" -eq 0 ]] |
174 | 174 |
|
175 | | - mysql_exec "$HOST_IP" "$PORT_3" "create user test_query_rule@'%' identified by 'test';" |
| 175 | + mysql_exec "$HOST_IP" "$PORT_3" "CREATE USER test_query_rule@'%' IDENTIFIED WITH ${AUTH_PLUGIN} BY 'test';" |
176 | 176 | # Give the cluster some time for this to replicate |
177 | 177 | sleep 3 |
178 | 178 |
|
|
226 | 226 | else |
227 | 227 | pass_field="authentication_string" |
228 | 228 | fi |
229 | | - cluster_user_count=$(cluster_exec "select count(distinct user) from mysql.user where ${pass_field} != '' and user not in ('admin') and user not like 'mysql.%'" -Ns) |
| 229 | + cluster_user_count=$(cluster_exec "select count(distinct user) from mysql.user where ${pass_field} != '' and user not in ('admin') and user not like 'mysql.%' and user not like 'percona.%'" -Ns) |
230 | 230 |
|
231 | 231 | # HACK: this mismatch occurs because we are running the tests for cluster_two |
232 | 232 | # right after the test for cluster_one (multi-cluster scenario), so the |
233 | 233 | # user counts will be off (because user cluster_one will still be in proxysql users). |
234 | 234 | if [[ $WSREP_CLUSTER_NAME == "cluster_two" ]]; then |
235 | | - proxysql_user_count=$(proxysql_exec "select count(distinct username) from runtime_mysql_users where username not in ('cluster_one')" | awk '{print $0}') |
| 235 | + proxysql_user_count=$(proxysql_exec "select count(distinct username) from runtime_mysql_users where username not in ('cluster_one') and username not like 'percona.%'" | awk '{print $0}') |
236 | 236 | else |
237 | | - proxysql_user_count=$(proxysql_exec "select count(distinct username) from runtime_mysql_users" | awk '{print $0}') |
| 237 | + proxysql_user_count=$(proxysql_exec "select count(distinct username) from runtime_mysql_users where username not like 'percona.%'" | awk '{print $0}') |
238 | 238 | fi |
239 | 239 |
|
240 | 240 | # Dump the user lists for debugging |
241 | 241 | echo "cluster users" >&2 |
242 | | - cluster_exec "select user,host from mysql.user where ${pass_field} != '' and user not in ('admin') and user not like 'mysql.%'" >&2 |
| 242 | + cluster_exec "select user,host from mysql.user where ${pass_field} != '' and user not in ('admin') and user not like 'percona.%' and user not like 'mysql.%'" >&2 |
243 | 243 | echo "" >&2 |
244 | 244 | echo "proxysql users" >&2 |
245 | 245 | proxysql_exec "select * from runtime_mysql_users" "-t" >&2 |
|
259 | 259 |
|
260 | 260 | # Step 1: Create the user in MySQL |
261 | 261 | echo "$LINENO: Creating user '$user' in MySQL" >&2 |
262 | | - mysql_exec "$HOST_IP" "$PORT_3" "CREATE USER '$user'@'%' IDENTIFIED WITH mysql_native_password BY '$initial_password';" |
| 262 | + mysql_exec "$HOST_IP" "$PORT_3" "CREATE USER '$user'@'%' IDENTIFIED WITH ${AUTH_PLUGIN} BY '$initial_password';" |
263 | 263 | mysql_exec "$HOST_IP" "$PORT_3" "GRANT ALL PRIVILEGES ON *.* TO '$user'@'%';" |
264 | 264 | sleep 3 # Allow replication |
265 | 265 |
|
|
319 | 319 | else |
320 | 320 | pass_field="authentication_string" |
321 | 321 | fi |
322 | | - cluster_user_count=$(cluster_exec "select count(distinct user) from mysql.user where ${pass_field} != '' and user not in ('admin') and user not like 'mysql.%'" -Ns) |
| 322 | + cluster_user_count=$(cluster_exec "select count(distinct user) from mysql.user where ${pass_field} != '' and user not in ('admin') and user not like 'mysql.%' and user not like 'percona.%'" -Ns) |
323 | 323 |
|
324 | 324 | # HACK: this mismatch occurs because we are running the tests for cluster_two |
325 | 325 | # right after the test for cluster_one (multi-cluster scenario), so the |
326 | 326 | # user counts will be off (because user cluster_one will still be in proxysql users). |
327 | 327 | if [[ $WSREP_CLUSTER_NAME == "cluster_two" ]]; then |
328 | | - proxysql_user_count=$(proxysql_exec "select count(distinct username) from runtime_mysql_users where username not in ('cluster_one')" | awk '{print $0}') |
| 328 | + proxysql_user_count=$(proxysql_exec "select count(distinct username) from runtime_mysql_users where username not in ('cluster_one') and username not like 'percona.%'" | awk '{print $0}') |
329 | 329 | else |
330 | | - proxysql_user_count=$(proxysql_exec "select count(distinct username) from runtime_mysql_users" | awk '{print $0}') |
| 330 | + proxysql_user_count=$(proxysql_exec "select count(distinct username) from runtime_mysql_users where username not like 'percona.%'" | awk '{print $0}') |
331 | 331 | fi |
332 | 332 |
|
333 | 333 | # Verify that the user is not in ProxySQL |
|
338 | 338 | echo "Creating 1000 mysql users" |
339 | 339 | for i in $(seq -w 1 1000) |
340 | 340 | do |
341 | | - mysql_exec "$HOST_IP" "$PORT_3" "CREATE USER 'a - u0$i'@'%' IDENTIFIED WITH mysql_native_password BY 'Secret1!';" |
| 341 | + mysql_exec "$HOST_IP" "$PORT_3" "CREATE USER 'a - u0$i'@'%' IDENTIFIED WITH ${AUTH_PLUGIN} BY 'Secret1!';" |
342 | 342 | done |
343 | 343 |
|
344 | 344 | # Give the cluster some time for this to replicate |
|
359 | 359 |
|
360 | 360 | echo "time taken: $time_taken seconds" |
361 | 361 | # Expected time to process 1000 users is about 25 seconds. |
362 | | - # For this test, lets assume that it takes less than 2.5 minutes. |
363 | | - [[ $time_taken -le 150 ]] |
| 362 | + # For this test, lets assume that it takes less than 4 minutes. |
| 363 | + [[ $time_taken -le 240 ]] |
364 | 364 |
|
365 | 365 | echo "$output" >&2 |
366 | 366 | [ "$status" -eq 0 ] |
|
415 | 415 | [[ $proxysql_count -eq 0 ]] |
416 | 416 |
|
417 | 417 | # Create a user on the async node |
418 | | - mysql_exec "$HOST_IP" "$ASYNC_PORT" "CREATE USER '${server_user}'@'%' IDENTIFIED WITH mysql_native_password BY 'passwd';" |
| 418 | + mysql_exec "$HOST_IP" "$ASYNC_PORT" "CREATE USER '${server_user}'@'%' IDENTIFIED WITH ${AUTH_PLUGIN} BY 'passwd';" |
419 | 419 |
|
420 | 420 | run sudo PATH=$WORKDIR:$PATH $WORKDIR/proxysql-admin --syncusers --server=${HOST_IP}:${ASYNC_PORT} |
421 | 421 | echo "$output" >&2 |
|
444 | 444 | [[ $proxysql_count -eq 0 ]] |
445 | 445 |
|
446 | 446 | # Create a user on the async node |
447 | | - mysql_exec "$HOST_IP" "$ASYNC_PORT" "CREATE USER '${server_user}'@'%' IDENTIFIED WITH mysql_native_password BY 'passwd';" |
| 447 | + mysql_exec "$HOST_IP" "$ASYNC_PORT" "CREATE USER '${server_user}'@'%' IDENTIFIED WITH ${AUTH_PLUGIN} BY 'passwd';" |
448 | 448 |
|
449 | 449 | run sudo PATH=$WORKDIR:$PATH $WORKDIR/proxysql-admin --sync-multi-cluster-users --server=${HOST_IP}:${ASYNC_PORT} |
450 | 450 | echo "$output" >&2 |
|
0 commit comments