[MXS-3720] idle_session_pool_time should support prepared statements Created: 2021-08-12  Updated: 2021-08-17  Resolved: 2021-08-16

Status: Closed
Project: MariaDB MaxScale
Component/s: Core
Affects Version/s: 6.1.1
Fix Version/s: 6.2.0

Type: Bug Priority: Major
Reporter: Manjot Singh (Inactive) Assignee: markus makela
Resolution: Fixed Votes: 1
Labels: None

Issue Links:
Relates
relates to MDEV-19811 Crash with prepared statement Open

 Description   

Maxscale should either support them or allow them to go through without pooling and not present an error.



 Comments   
Comment by Rob Schwyzer [ 2021-08-12 ]

When we ran sysbench with this setting enabled, many queries got rejected by MaxScale with-

2021-07-31 00:46:46   warning: (260) Unknown prepared statement handler (67) given to MaxScale for COM_STMT_CLOSE by ''sysbench'@'::ffff:100.24.6.203''
2021-07-31 00:46:46   warning: (260) Unknown prepared statement handler (35) given to MaxScale for COM_STMT_CLOSE by ''sysbench'@'::ffff:100.24.6.203''
2021-07-31 00:46:46   warning: (260) Unknown prepared statement handler (99) given to MaxScale for COM_STMT_CLOSE by ''sysbench'@'::ffff:100.24.6.203''
2021-07-31 00:46:46   warning: (260) Unknown prepared statement handler (131) given to MaxScale for COM_STMT_CLOSE by ''sysbench'@'::ffff:100.24.6.203''

These errors do not occur when only persistpoolmax and persistmaxtime are configured- these occur only when idle_session_pool_time is configured and these errors occur at the exact time that kicks-in (in the test case, it was 10 seconds into sysbench run).

Competing ProxySQL's Multiplexing feature also does not provide benefit for prepared statements, but it does identify prepared statements and avoids attempting to perform multiplexing on them. This means ProxySQL administrators can leave Multiplexing enabled and benefit from it when compatible queries are pushed through, and then incompatible queries (like prepared statements) are ignored and execute as expected. By comparison, for MaxScale, idle_session_pool_time needs to be disabled if any prepared statements are going to be submitted to MaxScale, even if these account for only a small fraction of the overall workload.

Comment by markus makela [ 2021-08-13 ]

Can you add the sysbench command you ran?

Comment by markus makela [ 2021-08-13 ]

Managed to reproduce MDEV-19811 with prepared statements and idle_session_pool_time.

Comment by markus makela [ 2021-08-13 ]

Adding code that disables the pooling for that session if prepared statements are used should help avoid any problems.

Comment by markus makela [ 2021-08-13 ]

Managed to also reproduce the exact same message by running sysbench.

Comment by Rob Schwyzer [ 2021-08-13 ]

Can you add the sysbench command you ran?

# Prepare the test
sysbench \
--db-driver=mysql \
--mysql-user=${maxscale_user} \
--mysql_password=${maxscale_pw} \
--mysql-db=${db} \
--mysql-host=${maxscale_ip} \
--mysql-port=3306 \
--tables=16 \
--table-size=50000 \
/usr/share/sysbench/oltp_read_write.lua prepare ;

# Run the test
sysbench \
--db-driver=mysql \
--mysql-user=${maxscale_user} \
--mysql_password=${maxscale_pw} \
--mysql-db=${db} \
--mysql-host=${maxscale_ip} \
--mysql-port=3306 \
--tables=16 \
--table-size=50000 \
--threads=499 \
--time=180 \
--events=0 \
--report-interval=1 \
--rate=10 \
/usr/share/sysbench/oltp_read_write.lua run

Comment by markus makela [ 2021-08-16 ]

If a connection uses prepared statements, the feature is disabled. Currently this doesn't re-activate the feature if the open PS count drops to zero but this can be considered an optimization.

Generated at Thu Feb 08 04:23:28 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.