test_analysis_reg_test_3317.md
Test Name: reg_test_3317-lock_hostgroup_special_queries-t
Purpose: Verifies that after locking on a hostgroup, ProxySQL forwards simple special queries (SET NAMES, SET autocommit, etc.) properly to the backend connection.
hostgroup_id hostname port status
0 mariadb1.infra-mariadb10 3306 ONLINE
1 mariadb1.infra-mariadb10 3306 ONLINE
1 mariadb2.infra-mariadb10 3306 ONLINE
1 mariadb3.infra-mariadb10 3306 ONLINE
1700 mariadb1.infra-mariadb10 3306 ONLINE
1701 mariadb1.infra-mariadb10 3306 ONLINE
1701 mariadb2.infra-mariadb10 3306 ONLINE
1701 mariadb3.infra-mariadb10 3306 ONLINE
Key Finding: Hostgroup 1300 (referenced in test error) DOES NOT EXIST in mysql_servers!
username default_hostgroup transaction_persistent
testuser 1700 1
Key Finding: User 'testuser' has default_hostgroup = 1700, NOT 1300
(empty table - no query rules configured)
Key Finding: No query rules exist to route queries to any specific hostgroup
variable_name variable_value
mysql-set_query_lock_on_hostgroup 1
pgsql-set_query_lock_on_hostgroup 1
Key Finding: lock_hostgroup feature IS enabled
The test performs 4 check iterations, each with 2 sub-tests (total 8 tests planned):
For each check (SET NAMES, SET autocommit, SET SESSION character_set_server, SET SESSION character_set_results):
1. Create new connection to ProxySQL (port 6033, user 'testuser')
2. Execute: SET inexisting_variable = ''
- Expected: Query fails, ProxySQL locks connection to hostgroup
3. Test #N: Verify invalid query failed (ok assertion)
4. Execute the actual SET query being tested (e.g., SET NAMES latin7)
5. Test #N+1: Verify SET query succeeded by checking session variables
6. Close connection
Observed Behavior:
ProxySQL Error: connection is locked to hostgroup 1300 but trying to reach hostgroup 0
The test is failing because of a HOSTGROUP MISMATCH. The test thinks it's locking to hostgroup 1300, but:
SET inexisting_variable = '' is issuedSET NAMES latin7 is issuedconnection is locked to hostgroup 1300 but trying to reach hostgroup 0The error message mentions hostgroup 1300, but:
This suggests one of:
The old CI system likely had:
The new isolated CI system:
The test is hardcoded to expect hostgroup 1300 behavior, but the infrastructure uses hostgroup 1700. The test needs to either:
# Check mysql_servers
mysql -uradmin -pradmin -h127.0.0.1 -P6032 -e "SELECT hostgroup_id, hostname, port, status FROM mysql_servers ORDER BY hostgroup_id, hostname"
# Check mysql_users
mysql -uradmin -pradmin -h127.0.0.1 -P6032 -e "SELECT username, default_hostgroup, transaction_persistent FROM mysql_users ORDER BY username"
# Check mysql_query_rules
mysql -uradmin -pradmin -h127.0.0.1 -P6032 -e "SELECT rule_id, active, match_pattern, destination_hostgroup, apply FROM mysql_query_rules ORDER BY rule_id"
# Check global variables
mysql -uradmin -pradmin -h127.0.0.1 -P6032 -e "SELECT variable_name, variable_value FROM global_variables WHERE variable_name LIKE '%lock%' ORDER BY variable_name"
Update the test to use hostgroup 1700 (which is the actual default_hostgroup for testuser):
Add hostgroup 1300 to the ProxySQL configuration in the CI setup:
Configure query rules that route SET statements properly:
INSERT INTO mysql_query_rules (rule_id, active, match_pattern, destination_hostgroup, apply)
VALUES (1, 1, '^SET ', 1700, 1);
LOAD MYSQL QUERY RULES TO RUNTIME;
Modify the test to:
The test fails because it's hardcoded for hostgroup 1300, but the CI infrastructure uses hostgroup 1700. The error message mentioning hostgroup 1300 is misleading - the actual configuration has testuser pointing to hostgroup 1700. The test needs to be updated to work with the actual infrastructure configuration, OR the infrastructure needs to provide hostgroup 1300 as expected by the test.