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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Redo Log之一:理解Oracle redo logOracle Redo
- 深入理解MySQL系列之redo log、undo log和binlogMySql
- standby redo log的理解
- MySQL:Redo & binlogMySql
- mysql之 redo logMySql
- 公司內部分享之mysql邏輯框架MySql框架
- (轉)老白的理解REDO LOG
- MySQL的Redo log 以及Bin logMySql
- MySQL中的redo log和undo logMySql
- MySQL Undo Log和Redo Log介紹MySql
- MySQL重做日誌(redo log)MySql
- MySQL redo log最佳化MySql
- RunLoop內部邏輯OOP
- 深入理解MYSQL undo redoMySql
- mysql關於redo事務日誌ib_logfile的理解MySql
- MySQL 日誌系統 redo log、binlogMySql
- 【Mysql】三大日誌 redo log、bin log、undo logMySql
- USB 邏輯分析儀分析丟包怎麼分析(lecroy USB 邏輯分析儀)
- MySQL中的redo log和checkpointMySql
- 工作284:理解繫結邏輯
- oracle redo internal (2) --- dump內容理解Oracle Redo
- oracle redo internal (2) --- dump內容理解Oracle
- 2 萬字 + 30 張圖 | 細聊 MySQL undo log、redo log、binlog 有什麼用?MySql
- PDF文字怎麼編輯?怎麼編輯PDF檔案內容
- mysql 邏輯備份 (mysqldump)MySql
- mysql的邏輯備份MySql
- MySQL binlog和redo的組提交MySql
- 3000幀動畫圖解MySQL為什麼需要binlog、redo log和undo log動畫圖解MySql
- mysql日誌:redo log、binlog、undo log 區別與作用MySql
- MySQL中redo log、undo log、binlog關係以及區別MySql
- 理解ProcessFunction的Timer邏輯Function
- oracle邏輯儲存結構理解Oracle
- oracle 物理讀 邏輯讀的理解Oracle
- oracle 物理讀,邏輯讀的理解Oracle
- MySQL學習之change buffer 和 redo logMySql
- MySQL如何計算統計redo log大小MySql
- MySQL邏輯查詢處理MySql
- MySql邏輯備份恢復MySql