From ed7481a35e59ce167f382a32b1ec1c4e635af648 Mon Sep 17 00:00:00 2001 From: Sveta Smirnova Date: Fri, 3 Nov 2023 02:45:30 +0300 Subject: [PATCH] PT-2211 - This pstack return error code line number - Added test case sample for this case - Adjusted sample results for t/pt-pmp/samples/stacktrace003.in that originally returned wrong data --- t/pt-pmp/samples/stacktrace-pt-2211.in | 32 +++++++++++++++++++++++ t/pt-pmp/samples/stacktrace-pt-2211.out | 1 + t/pt-pmp/samples/stacktrace003-limit2.out | 2 +- t/pt-pmp/samples/stacktrace003.out | 4 +-- 4 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 t/pt-pmp/samples/stacktrace-pt-2211.in create mode 100644 t/pt-pmp/samples/stacktrace-pt-2211.out diff --git a/t/pt-pmp/samples/stacktrace-pt-2211.in b/t/pt-pmp/samples/stacktrace-pt-2211.in new file mode 100644 index 00000000..d564c9a0 --- /dev/null +++ b/t/pt-pmp/samples/stacktrace-pt-2211.in @@ -0,0 +1,32 @@ +Thread 69 (Thread 0x7fd4b0049640 (LWP 15380)): +#0 0x00007fd4b5c36dc0 in __lll_lock_wait () from /lib64/libpthread.so.0 +#1 0x00007fd4b5c31703 in __pthread_mutex_cond_lock () from /lib64/libpthread.so.0 +#2 0x0000000001fa7130 in os_event::wait (this=0x7fd4ac8afbe8) at /home/zongzhi.czz/git/mysql-8.0/storage/innobase/os/os0event.cc:189 +#3 os_event::wait_low (this=0x7fd4ac8afbe8, reset_sig_count=3187477) at /home/zongzhi.czz/git/mysql-8.0/storage/innobase/os/os0event.cc:372 +#4 0x0000000001fa743a in os_event_wait_low (event=, reset_sig_count=) at /home/zongzhi.czz/git/mysql-8.0/storage/innobase/os/os0event.cc:608 +#5 0x000000000206e390 in sync_array_wait_event (arr=arr@entry=0x7fd4ac009ab8, cell=@0x7fd4b0044658: 0x7fd4b23b8028) at /home/zongzhi.czz/git/mysql-8.0/storage/innobase/sync/sync0arr.cc:444 +#6 0x0000000002071b5a in rw_lock_sx_lock_func (lock=0x7fd4ac85b2d8, pass=pass@entry=0, file_name=file_name@entry=0x2cfe1f0 "/home/zongzhi.czz/git/mysql-8.0/storage/innobase/btr/btr0cur.cc", line=line@entry=836) at /home/zongzhi.czz/git/mysql-8.0/storage/innobase/sync/sync0rw.cc:829 +#7 0x00000000020f2ae5 in pfs_rw_lock_sx_lock_func (lock=lock@entry=0x7fd4ac85b2d8, file_name=file_name@entry=0x2cfe1f0 "/home/zongzhi.czz/git/mysql-8.0/storage/innobase/btr/btr0cur.cc", line=line@entry=836, pass=0) at /home/zongzhi.czz/git/mysql-8.0/storage/innobase/include/sync0rw.ic:736 +#8 0x00000000020fe967 in mtr_t::sx_lock (line=836, file=0x2cfe1f0 "/home/zongzhi.czz/git/mysql-8.0/storage/innobase/btr/btr0cur.cc", lock=, this=0x7fd4b0045de0) at /home/zongzhi.czz/git/mysql-8.0/storage/innobase/include/mtr0mtr.ic:242 +#9 btr_cur_search_to_nth_level (index=index@entry=0x7fd4ac85b188, level=level@entry=0, tuple=tuple@entry=0x7f8e4401ddd8, mode=mode@entry=PAGE_CUR_LE, latch_mode=latch_mode@entry=33, cursor=cursor@entry=0x7fd4b00456a0, has_search_latch=0, file=0x2cf3498 "/home/zongzhi.czz/git/mysql-8.0/storage/innobase/row/row0ins.cc", line=2404, mtr=0x7fd4b0045de0) at /home/zongzhi.czz/git/mysql-8.0/storage/innobase/btr/btr0cur.cc:836 +#10 0x0000000001fec091 in btr_pcur_t::open (line=2404, file=0x2cf3498 "/home/zongzhi.czz/git/mysql-8.0/storage/innobase/row/row0ins.cc", mtr=0x7fd4b0045de0, latch_mode=33, mode=PAGE_CUR_LE, tuple=0x7f8e4401ddd8, level=0, index=0x7fd4ac85b188, this=0x7fd4b00456a0) at /home/zongzhi.czz/git/mysql-8.0/storage/innobase/include/btr0pcur.h:631#11 row_ins_clust_index_entry_low (flags=, mode=mode@entry=33, index=index@entry=0x7fd4ac85b188, n_uniq=n_uniq@entry=1, entry=entry@entry=0x7f8e4401ddd8, n_ext=n_ext@entry=0, thr=, dup_chk_only=) at /home/zongzhi.czz/git/mysql-8.0/storage/innobase/row/row0ins.cc:2404 +#12 0x0000000001ff2493 in row_ins_clust_index_entry (index=0x7fd4ac85b188, entry=entry@entry=0x7f8e4401ddd8, thr=thr@entry=0x7f8e4401d358, n_ext=n_ext@entry=0, dup_chk_only=dup_chk_only@entry=false) at /home/zongzhi.czz/git/mysql-8.0/storage/innobase/row/row0ins.cc:3128 +#13 0x0000000001ff351f in row_ins_index_entry (thr=0x7f8e4401d358, multi_val_pos=@0x7f8e4401d0d0: 0, entry=0x7f8e4401ddd8, index=) at /home/zongzhi.czz/git/mysql-8.0/storage/innobase/row/row0ins.cc:3295 +#14 row_ins_index_entry_step (thr=0x7f8e4401d358, node=0x7f8e4401d018) at /home/zongzhi.czz/git/mysql-8.0/storage/innobase/row/row0ins.cc:3432 +#15 row_ins (thr=0x7f8e4401d358, node=0x7f8e4401d018) at /home/zongzhi.czz/git/mysql-8.0/storage/innobase/row/row0ins.cc:3551 +#16 row_ins_step (thr=thr@entry=0x7f8e4401d358) at /home/zongzhi.czz/git/mysql-8.0/storage/innobase/row/row0ins.cc:3675 +#17 0x0000000002004cac in row_insert_for_mysql_using_ins_graph (mysql_rec=mysql_rec@entry=0x7f8e4400ae58 "\377\064y\002\a\005\250X272262038040-36454966916-40203159830-44114922317-57338906833-90459983776-67841547117-58042251992-67222347817-09932413691 62585243489-83708933349-63627342446-67953416665-46385069319 ", prebuilt=) at /home/zongzhi.czz/git/mysql-8.0/storage/innobase/row/row0mysql.cc:1580 +#18 0x0000000002007534 in row_insert_for_mysql (mysql_rec=mysql_rec@entry=0x7f8e4400ae58 "\377\064y\002\a\005\250X272262038040-36454966916-40203159830-44114922317-57338906833-90459983776-67841547117-58042251992-67222347817-09932413691 62585243489-83708933349-63627342446-67953416665-46385069319 ", prebuilt=) at /home/zongzhi.czz/git/mysql-8.0/storage/innobase/row/row0mysql.cc:1706 +#19 0x0000000001ee9b99 in ha_innobase::write_row (this=0x7f8e4401b138, record=0x7f8e4400ae58 "\377\064y\002\a\005\250X272262038040-36454966916-40203159830-44114922317-57338906833-90459983776-67841547117-58042251992-67222347817-09932413691 62585243489-83708933349-63627342446-67953416665-46385069319 ") at /home/zongzhi.czz/git/mysql-8.0/storage/innobase/handler/ha_innodb.cc:8581 +#20 0x0000000001018054 in handler::ha_write_row (this=0x7f8e4401b138, buf=0x7f8e4400ae58 "\377\064y\002\a\005\250X272262038040-36454966916-40203159830-44114922317-57338906833-90459983776-67841547117-58042251992-67222347817-09932413691 62585243489-83708933349-63627342446-67953416665-46385069319 ") at /home/zongzhi.czz/git/mysql-8.0/sql/handler.cc:7740 +#21 0x0000000001208d25 in write_record (thd=thd@entry=0x7f8e44000f10, table=table@entry=0x7f8e4400a4b0, info=info@entry=0x7fd4b0046a10, update=update@entry=0x7fd4b0046a90) at /home/zongzhi.czz/git/mysql-8.0/sql/sql_insert.cc:1946 +#22 0x0000000001209e81 in Sql_cmd_insert_values::execute_inner (this=0x7f8e4400e2b0, thd=0x7f8e44000f10) at /home/zongzhi.czz/git/mysql-8.0/sql/sql_insert.cc:614 +#23 0x0000000000e22e78 in Sql_cmd_dml::execute (this=0x7f8e4400e2b0, thd=0x7f8e44000f10) at /home/zongzhi.czz/git/mysql-8.0/sql/sql_select.cc:704 +#24 0x0000000000dd5da9 in mysql_execute_command (thd=thd@entry=0x7f8e44000f10, first_level=first_level@entry=true) at /home/zongzhi.czz/git/mysql-8.0/sql/sql_parse.cc:3450 +#25 0x0000000000dd80c1 in mysql_parse (thd=thd@entry=0x7f8e44000f10, parser_state=parser_state@entry=0x7fd4b0048450) at /home/zongzhi.czz/git/mysql-8.0/sql/sql_parse.cc:5257 +#26 0x0000000000dda8ad in dispatch_command (thd=thd@entry=0x7f8e44000f10, com_data=com_data@entry=0x7fd4b0048b40, command=COM_QUERY) at /home/zongzhi.czz/git/mysql-8.0/sql/sql_parse.cc:1765 +#27 0x0000000000ddb34c in do_command (thd=thd@entry=0x7f8e44000f10) at /home/zongzhi.czz/git/mysql-8.0/sql/sql_parse.cc:1273 +#28 0x0000000000eea308 in handle_connection (arg=arg@entry=0x3e8c480) at /home/zongzhi.czz/git/mysql-8.0/sql/conn_handler/connection_handler_per_thread.cc:302 +#29 0x0000000002303059 in pfs_spawn_thread (arg=0x3f025d0) at /home/zongzhi.czz/git/mysql-8.0/storage/perfschema/pfs.cc:2854 +#30 0x00007fd4b5c2d3f9 in start_thread () from /lib64/libpthread.so.0 +#31 0x00007fd4b4ca4303 in clone () from /lib64/libc.so.6 diff --git a/t/pt-pmp/samples/stacktrace-pt-2211.out b/t/pt-pmp/samples/stacktrace-pt-2211.out new file mode 100644 index 00000000..c94dc04e --- /dev/null +++ b/t/pt-pmp/samples/stacktrace-pt-2211.out @@ -0,0 +1 @@ + 1 __lll_lock_wait(libpthread.so.0),__pthread_mutex_cond_lock(libpthread.so.0),os_event::wait(os0event.cc:189),os_event::wait_low(os0event.cc:372),os_event_wait_low(os0event.cc:608),sync_array_wait_event(sync0arr.cc:444),rw_lock_sx_lock_func(sync0rw.cc:829),pfs_rw_lock_sx_lock_func(sync0rw.ic:736),mtr_t::sx_lock(mtr0mtr.ic:242),btr_cur_search_to_nth_level(btr0cur.cc:836),btr_pcur_t::open(row0ins.cc:2404),row_ins_clust_index_entry(row0ins.cc:3128),row_ins_index_entry(row0ins.cc:3295),row_ins_index_entry_step(row0ins.cc:3432),row_ins(row0ins.cc:3551),row_ins_step(row0ins.cc:3675),row_insert_for_mysql_using_ins_graph(row0mysql.cc:1580),row_insert_for_mysql(row0mysql.cc:1706),ha_innobase::write_row(ha_innodb.cc:8581),handler::ha_write_row(handler.cc:7740),write_record(sql_insert.cc:1946),Sql_cmd_insert_values::execute_inner(sql_insert.cc:614),Sql_cmd_dml::execute(sql_select.cc:704),mysql_execute_command(sql_parse.cc:3450),mysql_parse(sql_parse.cc:5257),dispatch_command(sql_parse.cc:1765),do_command(sql_parse.cc:1273),handle_connection(connection_handler_per_thread.cc:302),pfs_spawn_thread(pfs.cc:2854),start_thread(libpthread.so.0),clone(libc.so.6) diff --git a/t/pt-pmp/samples/stacktrace003-limit2.out b/t/pt-pmp/samples/stacktrace003-limit2.out index 1782bb88..83f853c9 100644 --- a/t/pt-pmp/samples/stacktrace003-limit2.out +++ b/t/pt-pmp/samples/stacktrace003-limit2.out @@ -5,5 +5,5 @@ 3 pthread_cond_wait,MYSQL_LOG::wait_for_update 1 select(libc.so.6),handle_connections_sockets 1 do_sigwait(libpthread.so.0),sigwait(libpthread.so.0) - 1 btr_search_guess_on_hash(libc.so.6),btr_cur_search_to_nth_level + 1 btr_search_guess_on_hash,btr_cur_search_to_nth_level 1 btr_cur_search_to_nth_level,btr_estimate_n_rows_in_range diff --git a/t/pt-pmp/samples/stacktrace003.out b/t/pt-pmp/samples/stacktrace003.out index 3035b521..945f0135 100644 --- a/t/pt-pmp/samples/stacktrace003.out +++ b/t/pt-pmp/samples/stacktrace003.out @@ -1,5 +1,5 @@ 35 pthread_cond_wait,end_thread,handle_one_connection,start_thread(libpthread.so.0),clone(libc.so.6) - 20 read(libpthread.so.0),read(unistd.h:35),vio_read(unistd.h:35),my_real_read,my_net_read,handle_one_connection,start_thread(libpthread.so.0),clone(libc.so.6) + 20 read(libpthread.so.0),read(unistd.h:35),vio_read,my_real_read,my_net_read,handle_one_connection,start_thread(libpthread.so.0),clone(libc.so.6) 18 pthread_cond_wait,os_event_wait_low,os_aio_simulated_handle,fil_aio_wait,io_handler_thread,start_thread(libpthread.so.0),clone(libc.so.6) 3 pthread_cond_wait,MYSQL_LOG::wait_for_update,mysql_binlog_send,dispatch_command,handle_one_connection,start_thread(libpthread.so.0),clone(libc.so.6) 1 select(libc.so.6),os_thread_sleep,srv_master_thread,start_thread(libpthread.so.0),clone(libc.so.6) @@ -7,5 +7,5 @@ 1 select(libc.so.6),os_thread_sleep,srv_error_monitor_thread,start_thread(libpthread.so.0),clone(libc.so.6) 1 select(libc.so.6),handle_connections_sockets,main 1 do_sigwait(libpthread.so.0),sigwait(libpthread.so.0),signal_hand,start_thread(libpthread.so.0),clone(libc.so.6) - 1 btr_search_guess_on_hash(libc.so.6),btr_cur_search_to_nth_level,btr_pcur_open_with_no_init,row_search_for_mysql,ha_innobase::index_read,join_read_always_key,sub_select,evaluate_join_record,sub_select,evaluate_join_record,sub_select,evaluate_join_record,sub_select,evaluate_join_record,sub_select,evaluate_join_record,sub_select,do_select,JOIN::exec,mysql_select,handle_select,mysql_execute_command,mysql_parse,dispatch_command,handle_one_connection,start_thread(libpthread.so.0),clone(libc.so.6) + 1 btr_search_guess_on_hash,btr_cur_search_to_nth_level,btr_pcur_open_with_no_init,row_search_for_mysql,ha_innobase::index_read,join_read_always_key,sub_select,evaluate_join_record,sub_select,evaluate_join_record,sub_select,evaluate_join_record,sub_select,evaluate_join_record,sub_select,evaluate_join_record,sub_select,do_select,JOIN::exec,mysql_select,handle_select,mysql_execute_command,mysql_parse,dispatch_command,handle_one_connection,start_thread(libpthread.so.0),clone(libc.so.6) 1 btr_cur_search_to_nth_level,btr_estimate_n_rows_in_range,ha_innobase::records_in_range,check_quick_keys,check_quick_keys,check_quick_keys,check_quick_keys,check_quick_keys,check_quick_keys,check_quick_keys,check_quick_keys,check_quick_keys,check_quick_keys,check_quick_keys,check_quick_select,get_key_scans_params,SQL_SELECT::test_quick_select,get_quick_record_count,make_join_statistics,JOIN::optimize,mysql_select,handle_select,mysql_execute_command,mysql_parse,dispatch_command,handle_one_connection,start_thread(libpthread.so.0),clone(libc.so.6)