[Bug]: Obproxy executes the prepare statement and reconnects due to disconnection
zrcx123 opened this issue · comments
Check Before Asking
- Please check the issue list and confirm this bug is encountered for the first time.
- Please try full text in English and attach precise description.
Environment
【Product name】obproxy
【Product Version】v3.2.0
[Problem description] After connecting to the cluster through obproxy, execute the prepare statement and report lose connection
Fast Reproduce Steps
select * from oceanbase.__all_virtual_sys_parameter_stat where name="_ob_enable_prepared_statement";
ALTER system set _ob_enable_prepared_statement =true;
MySQL [oceanbase]> select name, data_type, value, scope from oceanbase.__all_virtual_sys_parameter_stat where name='_ob_enable_prepared_statement';
+-------------------------------+-----------+-------+---------+
| name | data_type | value | scope |
+-------------------------------+-----------+-------+---------+
| _ob_enable_prepared_statement | NULL | True | CLUSTER |
| _ob_enable_prepared_statement | NULL | True | CLUSTER |
| _ob_enable_prepared_statement | NULL | True | CLUSTER |
+-------------------------------+-----------+-------+---------+
MySQL [oceanbase]> select version();
+--------------------+
| version() |
+--------------------+
| 3.1.2-OceanBase CE |
+--------------------+
1 row in set (0.00 sec)
Executing prepare through proxy still fails:
MySQL [test]> prepare stmt1 from 'INSERT INTO test.tb1 (id , name ) values ( ? , ? )';
Query OK, 0 rows affected (0.00 sec)
MySQL [test]> prepare stmt1 from 'INSERT INTO test.tb1 (id , name ) values ( ? , ? )';
ERROR 2013 (HY000): Lost connection to MySQL server during query
MySQL [test]> prepare stmt1 from 'INSERT INTO test.tb1 (id , name ) values ( ? , ? )';
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id: 655372
Current database: test
Query OK, 0 rows affected (0.01 sec)
Direct connection to the observer to execute prepare will not cause a broken link:
MySQL [test]> prepare stmt1 from 'INSERT INTO test.tb1 (id , name ) values ( ? , ? )';
Query OK, 0 rows affected (0.01 sec)
MySQL [test]> prepare stmt1 from 'INSERT INTO test.tb1 (id , name ) values ( ? , ? )';
Query OK, 0 rows affected (0.00 sec)
MySQL [test]> prepare stmt1 from 'INSERT INTO test.tb1 (id , name ) values ( ? , ? )';
Query OK, 0 rows affected (0.00 sec)
Actual Behavior
The obproxy_error log content is as follows:
[time],undefined,,,,[clustername]:sys:test,OB_MYSQL,tb1,tb1,OB_MYSQL_COM_QUERY,TEXT_PS_PREPARE,failed,-4016,prepare stmt1 from 'INSERT INTO test.tb1 (id %2C name ) values ( ? %2C ? )',118us,0us,0us,0us,Y0-7F7D0BE0D3A0,,,,0,,Ooooooooooooops
Expected Behavior
No response
Other Information
No response
This bug has been fixed in 4.0
mysql> CREATE TABLE test (
id INT NOT NULL,
name varchar(20)
);
Query OK, 0 rows affected (0.11 sec)
mysql> prepare stmt1 from 'INSERT INTO test (id , name ) values ( ? , ? )';
Query OK, 0 rows affected (0.34 sec)