Decrease stack space usage of mysql_execute_command()
The extensive usage of stack space, especially when used with ASan (AdressSanitizer) of mysql_execute_command caused the test rpl.rpl_row_sp011 to fail because it did run out of stack. In this test case mysql_execute_command is called recursively for each function all. Changes done: - Changed a few functions that used big local variables to be marked __attribute__ ((noinline)) - Moved sub parts that used big local variables to external functions. - Changed wsrep_commit_empty() from inline to normal function as this used more than 1K of stack space and because there is no reason for this rarely used function to be inline. End result (with gcc 7.4.1 on Intel Xeon): Starting point for stack space usage: gcc -O: 7800 gcc with -fsanitize=address -O (ASan) : 27240 After this patch: gcc -O: 1160 gcc -O0 (debug build) 1584 gcc with -fsanitize=address -O (ASan): 4424 gcc with -fsanitize=address -O2 (ASan): 3874 A 6x improvement and will allow us to run all mtr tests with ASan.
Showing
This diff is collapsed.
Please register or sign in to comment