这篇文章主要讲解了“数据库事务Event的生成和写入流程是什么”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“数据库事务Event的生成和写入流程是什么”吧!

一、Query_log_event栈帧:

初始化

#0Query_log_event::Query_log_event(this=0x7fffec0f30d0,thd_arg=0x7ffe7c000b70,query_arg=0x22e0614"BEGIN",query_length=5,using_trans=true,immediate=false,suppress_use=true,errcode=0,ignore_cmd_internals=true,__in_chrg=<valueoptimizedout>,__vtt_parm=<valueoptimizedout>)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/log_event.cc:4036#10x000000000188cc49inbinlog_start_trans_and_stmt(thd=0x7ffe7c000b70,start_event=0x7fffec0f4290)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/binlog.cc:10387#20x000000000188ce88inTHD::binlog_write_table_map(this=0x7ffe7c000b70,table=0x7ffe7c9b8390,is_transactional=true,binlog_rows_query=false)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/binlog.cc:10430#30x0000000000f8fbe7inwrite_locked_table_maps(thd=0x7ffe7c000b70)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/handler.cc:8258#40x0000000000f8fe2binbinlog_log_row(table=0x7ffe7c9b8390,before_record=0x7ffe7c9b77e0"\375\001",after_record=0x0,log_func=0xf95805<Delete_rows_log_event::binlog_row_logging_function(THD*,TABLE*,bool,ucharconst*,ucharconst*)>)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/handler.cc:8327#50x0000000000f90f90inhandler::ha_delete_row(this=0x7ffe7c9bb110,buf=0x7ffe7c9b77e0"\375\001")at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/handler.cc:8549#60x00000000017f41f7inSql_cmd_delete::mysql_delete(this=0x7ffe7c006c60,thd=0x7ffe7c000b70,limit=3)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/sql_delete.cc:468#70x00000000017f7180inSql_cmd_delete::execute(this=0x7ffe7c006c60,thd=0x7ffe7c000b70)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/sql_delete.cc:1386#80x00000000015cc8e9inmysql_execute_command(thd=0x7ffe7c000b70,first_level=true)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/sql_parse.cc:3756#90x00000000015d30c6inmysql_parse(thd=0x7ffe7c000b70,parser_state=0x7fffec0f6600)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/sql_parse.cc:5901#100x00000000015c6c5aindispatch_command(thd=0x7ffe7c000b70,com_data=0x7fffec0f6d70,command=COM_QUERY)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/sql_parse.cc:1490#110x00000000015c59e7indo_command(thd=0x7ffe7c000b70)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/sql_parse.cc:1021#120x000000000170e660inhandle_connection(arg=0x67de900)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/conn_handler/connection_handler_per_thread.cc:312#130x0000000001945620inpfs_spawn_thread(arg=0x675f7e0)at/root/mysqlall/percona-server-locks-detail-5.7.22/storage/perfschema/pfs.cc:2190#140x00007ffff7bc6aa1instart_thread()from/lib64/libpth二、Table_map_log_event栈帧:

初始化

#0Table_map_log_event::Table_map_log_event(this=0x7fffec0f41f0,thd_arg=0x7ffe7c000b70,tbl=0x7ffe7c9b8390,tid=...,using_trans=true)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/log_event.cc:12045#10x000000000188ce68inTHD::binlog_write_table_map(this=0x7ffe7c000b70,table=0x7ffe7c9b8390,is_transactional=true,binlog_rows_query=false)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/binlog.cc:10428#20x0000000000f8fbe7inwrite_locked_table_maps(thd=0x7ffe7c000b70)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/handler.cc:8258#30x0000000000f8fe2binbinlog_log_row(table=0x7ffe7c9b8390,before_record=0x7ffe7c9b77e0"\375\001",after_record=0x0,log_func=0xf95805<Delete_rows_log_event::binlog_row_logging_function(THD*,TABLE*,bool,ucharconst*,ucharconst*)>)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/handler.cc:8327#40x0000000000f90f90inhandler::ha_delete_row(this=0x7ffe7c9bb110,buf=0x7ffe7c9b77e0"\375\001")at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/handler.cc:8549#50x00000000017f41f7inSql_cmd_delete::mysql_delete(this=0x7ffe7c006c60,thd=0x7ffe7c000b70,limit=3)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/sql_delete.cc:468#60x00000000017f7180inSql_cmd_delete::execute(this=0x7ffe7c006c60,thd=0x7ffe7c000b70)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/sql_delete.cc:1386#70x00000000015cc8e9inmysql_execute_command(thd=0x7ffe7c000b70,first_level=true)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/sql_parse.cc:3756#80x00000000015d30c6inmysql_parse(thd=0x7ffe7c000b70,parser_state=0x7fffec0f6600)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/sql_parse.cc:5901#90x00000000015c6c5aindispatch_command(thd=0x7ffe7c000b70,com_data=0x7fffec0f6d70,command=COM_QUERY)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/sql_parse.cc:1490#100x00000000015c59e7indo_command(thd=0x7ffe7c000b70)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/sql_parse.cc:1021#110x000000000170e660inhandle_connection(arg=0x67de900)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/conn_handler/connection_handler_per_thread.cc:312#120x0000000001945620inpfs_spawn_thread(arg=0x675f7e0)at/root/mysqlall/percona-server-locks-detail-5.7.22/storage/perfschema/pfs.cc:2190#130x00007ffff7bc6aa1instart_thread()from/lib64/libpthread.so.0#140x00007ffff6719bcdinclone()from/lib64/libc.so.6三、Delete_rows_log_event

Delete_rows_log_event::Delete_rows_log_event

初始化Event:

#0Delete_rows_log_event::Delete_rows_log_event(this=0x7ffe7cdc7a60,thd_arg=0x7ffe7c000b70,tbl_arg=0x7ffe7c9b8390,tid=...,is_transactional=true,extra_row_info=0x0,__in_chrg=<valueoptimizedout>,__vtt_parm=<valueoptimizedout>)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/log_event.cc:13086#10x000000000189687finTHD::binlog_prepare_pending_rows_event<Delete_rows_log_event>(this=0x7ffe7c000b70,table=0x7ffe7c9b8390,serv_id=953340,needed=5,is_transactional=true,hint=0x0,extra_row_info=0x0)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/binlog.cc:11688#20x000000000189003binTHD::binlog_delete_row(this=0x7ffe7c000b70,table=0x7ffe7c9b8390,is_trans=true,record=0x7ffe7c9b77e0"\375\001",extra_row_info=0x0)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/binlog.cc:11963#30x0000000000f95844inDelete_rows_log_event::binlog_row_logging_function(thd=0x7ffe7c000b70,table=0x7ffe7c9b8390,is_transactional=true,before_record=0x7ffe7c9b77e0"\375\001",after_record=0x0)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/log_event.h:3722#40x0000000000f8fe9einbinlog_log_row(table=0x7ffe7c9b8390,before_record=0x7ffe7c9b77e0"\375\001",after_record=0x0,log_func=0xf95805<Delete_rows_log_event::binlog_row_logging_function(THD*,TABLE*,bool,ucharconst*,ucharconst*)>)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/handler.cc:8340#50x0000000000f90f90inhandler::ha_delete_row(this=0x7ffe7c9bb110,buf=0x7ffe7c9b77e0"\375\001")at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/handler.cc:8549#60x00000000017f41f7inSql_cmd_delete::mysql_delete(this=0x7ffe7c006c60,thd=0x7ffe7c000b70,limit=3)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/sql_delete.cc:468#70x00000000017f7180inSql_cmd_delete::execute(this=0x7ffe7c006c60,thd=0x7ffe7c000b70)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/sql_delete.cc:1386#80x00000000015cc8e9inmysql_execute_command(thd=0x7ffe7c000b70,first_level=true)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/sql_parse.cc:3756#90x00000000015d30c6inmysql_parse(thd=0x7ffe7c000b70,parser_state=0x7fffec0f6600)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/sql_parse.cc:5901#100x00000000015c6c5aindispatch_command(thd=0x7ffe7c000b70,com_data=0x7fffec0f6d70,command=COM_QUERY)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/sql_parse.cc:1490#110x00000000015c59e7indo_command(thd=0x7ffe7c000b70)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/sql_parse.cc:1021#120x000000000170e660inhandle_connection(arg=0x67de900)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/conn_handler/connection_handler_per_thread.cc:312#130x0000000001945620inpfs_spawn_thread(arg=0x675f7e0)at/root/mysqlall/percona-server-locks-detail-5.7.22/storage/perfschema/pfs.cc:2190#140x00007ffff7bc6aa1instart_thread()from/lib64/libpthread.so.0#150x00007ffff6719bcdinclone()from/lib64/libc.so.6

数据加入Rows_log_event::do_add_row_data 将本次循环的加入到event中

#0Rows_log_event::do_add_row_data(this=0x7ffe7cdc7a60,row_data=0x7ffe7c9b78e0"\376\001",length=5)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/log_event.cc:9676#10x00000000018929adinRows_log_event::add_row_data(this=0x7ffe7cdc7a60,data=0x7ffe7c9b78e0"\376\001",length=5)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/log_event.h:3067#20x0000000001890073inTHD::binlog_delete_row(this=0x7ffe7c000b70,table=0x7ffe7c9b8390,is_trans=true,record=0x7ffe7c9b77e0"\375\001",extra_row_info=0x0)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/binlog.cc:11968#30x0000000000f95844inDelete_rows_log_event::binlog_row_logging_function(thd=0x7ffe7c000b70,table=0x7ffe7c9b8390,is_transactional=true,before_record=0x7ffe7c9b77e0"\375\001",after_record=0x0)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/log_event.h:3722#40x0000000000f8fe9einbinlog_log_row(table=0x7ffe7c9b8390,before_record=0x7ffe7c9b77e0"\375\001",after_record=0x0,log_func=0xf95805<Delete_rows_log_event::binlog_row_logging_function(THD*,TABLE*,bool,ucharconst*,ucharconst*)>)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/handler.cc:8340#50x0000000000f90f90inhandler::ha_delete_row(this=0x7ffe7c9bb110,buf=0x7ffe7c9b77e0"\375\001")at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/handler.cc:8549#60x00000000017f41f7inSql_cmd_delete::mysql_delete(this=0x7ffe7c006c60,thd=0x7ffe7c000b70,limit=3)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/sql_delete.cc:468#70x00000000017f7180inSql_cmd_delete::execute(this=0x7ffe7c006c60,thd=0x7ffe7c000b70)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/sql_delete.cc:1386#80x00000000015cc8e9inmysql_execute_command(thd=0x7ffe7c000b70,first_level=true)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/sql_parse.cc:3756#90x00000000015d30c6inmysql_parse(thd=0x7ffe7c000b70,parser_state=0x7fffec0f6600)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/sql_parse.cc:5901#100x00000000015c6c5aindispatch_command(thd=0x7ffe7c000b70,com_data=0x7fffec0f6d70,command=COM_QUERY)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/sql_parse.cc:1490#110x00000000015c59e7indo_command(thd=0x7ffe7c000b70)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/sql_parse.cc:1021#120x000000000170e660inhandle_connection(arg=0x67de900)at/root/mysqlall/percona-server-locks-detail-5.7.22/sql/conn_handler/connection_handler_per_thread.cc:312#130x0000000001945620inpfs_spawn_thread(arg=0x675f7e0)at/root/mysqlall/percona-server-locks-detail-5.7.22/storage/perfschema/pfs.cc:2190#140x00007ffff7bc6aa1instart_thread()from/lib64/libpthread.so.0#150x00007ffff6719bcdinclone()from/lib64/libc.so.6

感谢各位的阅读,以上就是“数据库事务Event的生成和写入流程是什么”的内容了,经过本文的学习后,相信大家对数据库事务Event的生成和写入流程是什么这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是亿速云,小编将为大家推送更多相关知识点的文章,欢迎关注!