mysql 写binlog 大字段流程

/*
当写binlog大于8192既IO_CACHE 的大小时,不写IO_CACHE 直接写入文件pageCache 
当IO_CACHE 剩余空间无法写入当前binlog时,则先把IO_CACHE 里的内容写入直接写入文件pageCache 
*/
#0  _my_b_write (info=0x2d9b248 <mysql_bin_log+840>, Buffer=0x7ffe801f7487 "p", Count=51372) at /mysys/mf_iocache.c:1311
#1  0x000000000181d3f1 in Binlog_event_writer::write_event_part (this=0x7fffec493130, buf_p=0x7fffec492fb8, buf_len_p=0x7fffec492fb4, event_len_p=0x7fffec492fb0) at /sql/binlog.cc:1221
#2  0x00000000018101a6 in MYSQL_BIN_LOG::do_write_cache (this=0x2d9af00 <mysql_bin_log>, cache=0x7ffe8000c380, writer=0x7fffec493130) at /sql/binlog.cc:7874
#3  0x00000000018109ba in MYSQL_BIN_LOG::write_cache (this=0x2d9af00 <mysql_bin_log>, thd=0x7ffe80000bc0, cache_data=0x7ffe8000c378, writer=0x7fffec493130) at /sql/binlog.cc:8112
#4  0x00000000018020bb in binlog_cache_data::flush (this=0x7ffe8000c378, thd=0x7ffe80000bc0, bytes_written=0x7fffec4931c8, wrote_xid=0x7fffec493207) at /sql/binlog.cc:1726
#5  0x000000000181d0cd in binlog_cache_mngr::flush (this=0x7ffe8000c1c0, thd=0x7ffe80000bc0, bytes_written=0x7fffec493208, wrote_xid=0x7fffec493207) at /sql/binlog.cc:971
#6  0x0000000001812d8f in MYSQL_BIN_LOG::flush_thread_caches (this=0x2d9af00 <mysql_bin_log>, thd=0x7ffe80000bc0) at /sql/binlog.cc:8910
#7  0x0000000001812fb1 in MYSQL_BIN_LOG::process_flush_stage_queue (this=0x2d9af00 <mysql_bin_log>, total_bytes_var=0x7fffec493328, rotate_var=0x7fffec493327, out_queue_var=0x7fffec493318) at /sql/binlog.cc:8973
#8  0x000000000181453b in MYSQL_BIN_LOG::ordered_commit (this=0x2d9af00 <mysql_bin_log>, thd=0x7ffe80000bc0, all=true, skip_commit=false) at /sql/binlog.cc:9610
#9  0x0000000001812c06 in MYSQL_BIN_LOG::commit (this=0x2d9af00 <mysql_bin_log>, thd=0x7ffe80000bc0, all=true) at /sql/binlog.cc:8867
#10 0x0000000000f68674 in ha_commit_trans (thd=0x7ffe80000bc0, all=true, ignore_global_read_lock=false) at /sql/handler.cc:1799
#11 0x0000000001666df8 in trans_commit (thd=0x7ffe80000bc0) at /sql/transaction.cc:239
#12 0x000000000156fc6f in mysql_execute_command (thd=0x7ffe80000bc0, first_level=true) at /sql/sql_parse.cc:4244
#13 0x00000000015733d9 in mysql_parse (thd=0x7ffe80000bc0, parser_state=0x7fffec495680) at /sql/sql_parse.cc:5570
#14 0x0000000001568a58 in dispatch_command (thd=0x7ffe80000bc0, com_data=0x7fffec495e10, command=COM_QUERY) at /sql/sql_parse.cc:1484
#15 0x00000000015678a4 in do_command (thd=0x7ffe80000bc0) at /sql/sql_parse.cc:1025
#16 0x00000000016976a5 in handle_connection (arg=0xfd50ca0) at /sql/conn_handler/connection_handler_per_thread.cc:306
#17 0x0000000001d37250 in pfs_spawn_thread (arg=0xfcc5240) at /storage/perfschema/pfs.cc:2190
#18 0x00007ffff7bc6e65 in start_thread () from /lib64/libpthread.so.0
#19 0x00007ffff660788d in clone () from /lib64/libc.so.6

/*每次写IO_CACHE时,判断当IO_CACHE 剩余空间无法写入当前binlog时*/
#define my_b_write(info,Buffer,Count) \
 ((info)->write_pos + (Count) <=(info)->write_end ?\
  (memcpy((info)->write_pos, (Buffer), (size_t)(Count)),\
   ((info)->write_pos+=(Count)),0) : \
   (*(info)->write_function)((info),(uchar *)(Buffer),(Count)))

static void
init_functions(IO_CACHE* info)
{
  enum cache_type type= info->type;
  switch (type) {
  case READ_NET:
    /*
      Must be initialized by the caller. The problem is that
      _my_b_net_read has to be defined in sql directory because of
      the dependency on THD, and therefore cannot be visible to
      programs that link against mysys but know nothing about THD, such
      as myisamchk
    */
    break;
  case SEQ_READ_APPEND:
    info->read_function = _my_b_seq_read;
    info->write_function = 0;			/* Force a core if used */
    break;
  default:
    info->read_function = info->share ? _my_b_read_r : _my_b_read;
    info->write_function = _my_b_write;
  }
*/
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值