MySQL Redo log頁內邏輯怎麼理解
很多地方可以看到mysql redo. log不是物理格式,是物理邏輯格式,這種的邏輯是頁內邏輯,但是怎麼去理解這個頁內邏輯的概念?
如果是物理格式的話,那麼內容就應該是具體的地址,以及具體的值。redo的內容不是具體的值,而是相對值,這樣就好理解了。具體可以看下redo 的內容,比如delete命令產生的redo 如下:
mysqld!page_cur_delete_rec_write_log(unsigned char*, dict_index_t const*, mtr_t*) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/storage/innobase/page/page0cur.cc:2510) mysqld!page_cur_delete_rec(page_cur_t*, dict_index_t const*, unsigned long const*, mtr_t*) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/storage/innobase/page/page0cur.cc:2639) mysqld!btr_cur_optimistic_delete_func(btr_cur_t*, unsigned long, mtr_t*) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/storage/innobase/btr/btr0cur.cc:5184) mysqld!row_purge_remove_clust_if_poss_low(purge_node_t*, unsigned long) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/storage/innobase/row/row0purge.cc:178) mysqld!row_purge_remove_clust_if_poss(purge_node_t*) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/storage/innobase/row/row0purge.cc:235) mysqld!row_purge_del_mark(purge_node_t*) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/storage/innobase/row/row0purge.cc:687) mysqld!row_purge_record_func(purge_node_t*, unsigned char*, que_thr_t const*, bool) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/storage/innobase/row/row0purge.cc:1010) mysqld!row_purge(purge_node_t*, unsigned char*, que_thr_t*) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/storage/innobase/row/row0purge.cc:1066) mysqld!row_purge_step(que_thr_t*) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/storage/innobase/row/row0purge.cc:1145) mysqld!que_thr_step(que_thr_t*) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/storage/innobase/que/que0que.cc:1057) mysqld!que_run_threads_low(que_thr_t*) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/storage/innobase/que/que0que.cc:1119) mysqld!que_run_threads(que_thr_t*) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/storage/innobase/que/que0que.cc:1159) mysqld!srv_task_execute() (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/storage/innobase/srv/srv0srv.cc:2479) mysqld!::srv_worker_thread(void *) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/storage/innobase/srv/srv0srv.cc:2529) libsystem_pthread.dylib!_pthread_start (Unknown Source:0) libsystem_pthread.dylib!thread_start (Unknown Source:0)
insert也是一樣的,記錄了一些資訊,但是針對body部分,很多文章描述的是與前一個記錄的diff,但是我看程式碼上是
if (log_ptr + rec_size <= log_end) { memcpy(log_ptr, ins_ptr, rec_size); mlog_close(mtr, log_ptr + rec_size);
是將insert的記錄內容複製到了log上,並不是記錄的內容差異
mysqld!page_cur_insert_rec_write_log(unsigned char*, unsigned long, unsigned char*, dict_index_t*, mtr_t*) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/storage/innobase/page/page0cur.cc:1136) mysqld!page_cur_insert_rec_low(unsigned char*, dict_index_t*, unsigned char const*, unsigned long*, mtr_t*) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/storage/innobase/page/page0cur.cc:1538) mysqld!page_cur_tuple_insert(page_cur_t*, dtuple_t const*, dict_index_t*, unsigned long**, mem_block_info_t**, unsigned long, mtr_t*, bool) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/storage/innobase/include/page0cur.ic:287) mysqld!btr_cur_optimistic_insert(unsigned long, btr_cur_t*, unsigned long**, mem_block_info_t**, dtuple_t*, unsigned char**, big_rec_t**, unsigned long, que_thr_t*, mtr_t*) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/storage/innobase/btr/btr0cur.cc:3246) mysqld!row_ins_clust_index_entry_low(unsigned long, unsigned long, dict_index_t*, unsigned long, dtuple_t*, unsigned long, que_thr_t*, bool) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/storage/innobase/row/row0ins.cc:2612) mysqld!row_ins_clust_index_entry(dict_index_t*, dtuple_t*, que_thr_t*, unsigned long, bool) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/storage/innobase/row/row0ins.cc:3299) mysqld!row_ins_index_entry(dict_index_t*, dtuple_t*, que_thr_t*) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/storage/innobase/row/row0ins.cc:3437) mysqld!row_ins_index_entry_step(ins_node_t*, que_thr_t*) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/storage/innobase/row/row0ins.cc:3587) mysqld!row_ins(ins_node_t*, que_thr_t*) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/storage/innobase/row/row0ins.cc:3725) mysqld!row_ins_step(que_thr_t*) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/storage/innobase/row/row0ins.cc:3861) mysqld!row_insert_for_mysql_using_ins_graph(unsigned char const*, row_prebuilt_t*) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/storage/innobase/row/row0mysql.cc:1746) mysqld!row_insert_for_mysql(unsigned char const*, row_prebuilt_t*) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/storage/innobase/row/row0mysql.cc:1866) mysqld!ha_innobase::write_row(unsigned char*) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/storage/innobase/handler/ha_innodb.cc:7612) mysqld!handler::ha_write_row(unsigned char*) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/sql/handler.cc:8093) mysqld!write_record(THD*, TABLE*, COPY_INFO*, COPY_INFO*) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/sql/sql_insert.cc:1895) mysqld!Sql_cmd_insert::mysql_insert(THD*, TABLE_LIST*) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/sql/sql_insert.cc:776) mysqld!Sql_cmd_insert::execute(THD*) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/sql/sql_insert.cc:3140) mysqld!mysql_execute_command(THD*, bool) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/sql/sql_parse.cc:3606) mysqld!mysql_parse(THD*, Parser_state*) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/sql/sql_parse.cc:5584) mysqld!dispatch_command(THD*, COM_DATA const*, enum_server_command) (/Users/xiaoyu.bai/Downloads/mysql-5.7.29/sql/sql_parse.cc:1491)
有興趣學習原始碼的加群一起學習啊 QQ: 700072075
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25719946/viewspace-2916121/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 深入理解MySQL系列之redo log、undo log和binlogMySql
- mysql之 redo logMySql
- MySQL的Redo log 以及Bin logMySql
- MySQL Undo Log和Redo Log介紹MySql
- MySQL中的redo log和undo logMySql
- MySQL redo log最佳化MySql
- MySQL重做日誌(redo log)MySql
- 【Mysql】三大日誌 redo log、bin log、undo logMySql
- MySQL中的redo log和checkpointMySql
- MySQL 日誌系統 redo log、binlogMySql
- mysql日誌:redo log、binlog、undo log 區別與作用MySql
- MySQL中redo log、undo log、binlog關係以及區別MySql
- 公司內部分享之mysql邏輯框架MySql框架
- undo log和redo log
- 3000幀動畫圖解MySQL為什麼需要binlog、redo log和undo log動畫圖解MySql
- 深入理解MYSQL undo redoMySql
- MySQL學習之change buffer 和 redo logMySql
- MySQL如何計算統計redo log大小MySql
- 2 萬字 + 30 張圖 | 細聊 MySQL undo log、redo log、binlog 有什麼用?MySql
- 基於Redo Log和Undo Log的MySQL崩潰恢復流程MySql
- 理解ProcessFunction的Timer邏輯Function
- 必須瞭解的mysql三大日誌-binlog、redo log和undo logMySql
- MySQL中Redo Log相關的重要引數總結MySql
- 工作284:理解繫結邏輯
- USB 邏輯分析儀分析丟包怎麼分析(lecroy USB 邏輯分析儀)
- redo log file 最佳化
- MYSQL 是如何保證binlog 和redo log同時提交的?MySql
- 一生摯友redo log、binlog《死磕MySQL系列 二》MySql
- MySQL更新資料時,日誌(redo log、binlog)執行流程MySql
- MySQL redoMySql
- Oracle redo解析之-1、oracle redo log結構計算Oracle Redo
- PDF文字怎麼編輯?怎麼編輯PDF檔案內容
- InnoDB文件筆記(二)—— Redo Log筆記
- How to Dump Redo Log File Information --metalinkORM
- 【REDO】Oracle redo內部結構Oracle Redo
- MySQL提升筆記(1):MySQL邏輯架構MySql筆記架構
- MySQL:Redo & binlogMySql
- 硬核乾貨!一文掌握 binlog 、redo log、undo log