mysql更新事务创建trx->id 的流程

#0  trx_sys_get_new_trx_id () at storage/innobase/include/trx0sys.ic:437
#1  0x0000000001b183a7 in trx_start_low (trx=0x7fffed7ce170, read_write=true) at storage/innobase/trx/trx0trx.cc:1407
#2  0x0000000001b1c1ca in trx_start_if_not_started_xa_low (trx=0x7fffed7ce170, read_write=true) at storage/innobase/trx/trx0trx.cc:3059
#3  0x0000000001a4d053 in row_insert_for_mysql_using_ins_graph (mysql_rec=0x7ffe8000fbc0 "\376B", prebuilt=0x7ffe80010160) at storage/innobase/row/row0mysql.cc
:1713
#4  0x0000000001a4d69b in row_insert_for_mysql (mysql_rec=0x7ffe8000fbc0 "\376B", prebuilt=0x7ffe80010160) at storage/innobase/row/row0mysql.cc:1859
#5  0x00000000018f4e92 in ha_innobase::write_row (this=0x7ffe8000f8d0, record=0x7ffe8000fbc0 "\376B") at storage/innobase/handler/ha_innodb.cc:7603
#6  0x0000000000f76f2a in handler::ha_write_row (this=0x7ffe8000f8d0, buf=0x7ffe8000fbc0 "\376B") at sql/handler.cc:8086
#7  0x000000000178cda2 in write_record (thd=0x7ffe80000bc0, table=0x7ffe8000ef10, info=0x7fffec494330, update=0x7fffec4942b0) at sql/sql_insert.cc:1882
#8  0x0000000001789f8a in Sql_cmd_insert::mysql_insert (this=0x7ffe80006a78, thd=0x7ffe80000bc0, table_list=0x7ffe800064e8) at sql/sql_insert.cc:769
#9  0x0000000001790862 in Sql_cmd_insert::execute (this=0x7ffe80006a78, thd=0x7ffe80000bc0) at sql/sql_insert.cc:3127
#10 0x000000000156d9db in mysql_execute_command (thd=0x7ffe80000bc0, first_level=true) at sql/sql_parse.cc:3596
#11 0x00000000015733d9 in mysql_parse (thd=0x7ffe80000bc0, parser_state=0x7fffec495680) at sql/sql_parse.cc:5570
#12 0x0000000001568a58 in dispatch_command (thd=0x7ffe80000bc0, com_data=0x7fffec495e10, command=COM_QUERY) at sql/sql_parse.cc:1484

 trx_id_t
420| trx_sys_get_new_trx_id()
421| /*====================*/
422| {
423|         ut_ad(trx_sys_mutex_own());
424|
425|         /* VERY important: after the database is started, max_trx_id value is
426|         divisible by TRX_SYS_TRX_ID_WRITE_MARGIN, and the following if
427|         will evaluate to TRUE when this function is first time called,
428|         and the value for trx id will be written to disk-based header!
429|         Thus trx id values will not overlap when the database is
430|         repeatedly started! */
431|
432|         if (!(trx_sys->max_trx_id % TRX_SYS_TRX_ID_WRITE_MARGIN)) {
433|                 /*一段txt的磁盘保存*/
434|                 trx_sys_flush_max_trx_id();
435|         }
436|         /*获取最大值*/
437+>        return(trx_sys->max_trx_id++);
438| }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值