[MDEV-30114] prepared statements spend a lot of time in cleanup Created: 2022-11-28  Updated: 2022-12-02  Resolved: 2022-11-28

Status: Closed
Project: MariaDB Server
Component/s: Character Sets, Prepared Statements
Affects Version/s: 10.3.37, 10.4.27, 10.5.18, 10.6.11, 10.7.7, 10.8.6, 10.9.4, 10.10.2
Fix Version/s: N/A

Type: Bug Priority: Blocker
Reporter: Sergei Golubchik Assignee: Dmitry Shulga
Resolution: Duplicate Votes: 0
Labels: regression

Issue Links:
Duplicate
duplicates MDEV-29988 Major performance regression with 10.... Closed
Problem/Incident
is caused by MDEV-16128 Server crash in Item_func::print_op o... Closed

 Description   

With the following patch:

--- a/mysql-test/main/mysql_client_test.test
+++ b/mysql-test/main/mysql_client_test.test
@@ -26,7 +26,7 @@ call mtr.add_suppression(" IP address .* could not be resolved");
 # var/log/mysql_client_test.trace
 
 --exec echo "$MYSQL_CLIENT_TEST" > $MYSQLTEST_VARDIR/log/mysql_client_test.out.log 2>&1
---exec $MYSQL_CLIENT_TEST --getopt-ll-test=25600M >> $MYSQLTEST_VARDIR/log/mysql_client_test.out.log 2>&1
+--exec $MYSQL_CLIENT_TEST test_mdev_16128 --getopt-ll-test=25600M >> $MYSQLTEST_VARDIR/log/mysql_client_test.out.log 2>&1
 
 # End of 4.1 tests
 echo ok;
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -21053,6 +21053,7 @@ static void test_mdev_16128()
   rc= mysql_stmt_prepare(stmt, query, strlen(query));
   check_execute(stmt, rc);
 
+for (uint ii=0; ii < 10000; ii++) {
   memset(&bind, 0, sizeof(bind));
   bind.buffer_type= MYSQL_TYPE_STRING;
   bind.buffer_length= strlen(bind_arg_1);
@@ -21109,6 +21110,7 @@ static void test_mdev_16128()
     executed in PS-mode and bound with the value 'd' returns empty result set.
    */
   DIE_UNLESS(rc == MYSQL_NO_DATA);
+}
 
   mysql_stmt_close(stmt);

one can verify in the debugger that a new Item_string is allocated on the statement arena for every mysql_stmt_execute.

This means that memory is growing with every mysql_stmt_execute call and statement cleanup time is proportional to the number of mysql_stmt_execute calls.



 Comments   
Comment by Marko Mäkelä [ 2022-12-02 ]

The fix of MDEV-30144 was accidentally pushed with the number of this ticket.

Generated at Thu Feb 08 10:13:45 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.