调试clog日志格式

【测试方法】 

create table t2 (c1 int primary key, c2 int) partition by hash(c1) partitions 1;

select table_id , table_name from oceanbase.__all_table_v2 where table_name = 't2';

insert into t2 values(1, 2);

ob_admin clog_tool dump_filter 'table_id=1099511677778;' 1 

 

【数据结果】

$$$file_id:1 offset:18454100 len:127  OB_LOG_SUBMIT|log_id:2|{ObLogEntryHeader:{magic:17746, version:1, type:201, partition_key:{tid:1099511677777, partition_id:0, part_cnt:0}, log_id:2, data_len:22, generation_timestamp:1656808788556702, epoch_id:1656808765442630, proposal_id:{time_to_usec:1656808765442630, server:"127.0.0.1:2882"}, submit_timestamp:1656808788556702, is_batch_committed:false, is_trans_log:false, data_checksum:1860419933, active_memstore_version:"2-0-0", header_checksum:2363466577}} ||| {checkpoint:1656808788431924}|||
$$$file_id:1 offset:19046921 len:344  OB_LOG_SUBMIT|log_id:3|{ObLogEntryHeader:{magic:17746, version:1, type:201, partition_key:{tid:1099511677777, partition_id:0, part_cnt:0}, log_id:3, data_len:239, generation_timestamp:1656808927510417, epoch_id:1656808765442630, proposal_id:{time_to_usec:1656808765442630, server:"127.0.0.1:2882"}, submit_timestamp:1656808927509580, is_batch_committed:false, is_trans_log:true, data_checksum:722586361, active_memstore_version:"2-0-0", header_checksum:3391835242}} |||	|||Trans: log_type:OB_LOG_SP_TRANS_COMMIT, trans_inc:18346 {log_type:64, partition:{tid:1099511677777, partition_id:0, part_cnt:0}, trans_id:{hash:14510524374082294342, inc:18346, addr:"127.0.0.1:2882", t:1656808927457467}, tenant_id:1, log_no:0, trans_param:[access_mode=1, type=3, isolation=1, magic=17361641481138401520, autocommit=0, consistency_type=0(CURRENT_READ), read_snapshot_type=2(PARTICIPANT_SNAPSHOT), cluster_version=12884967427, is_inner_trans=0], cluster_id:1, active_memstore_version:"2-0-0", checksum:1395726031, prev_redo_log_ids:[], app_trace_id_str:"", checkpoint:1656808927284256, prev_trans_arr:[], app_trace_info:"", prev_record_log_id:0}||| 0x7ffeb08ded38 data_crc=40f09552 meta_size=24 data_size=56 row_count=1  MutatorRow={{row_size:56, table_id:1099511677777, rowkey:{"INT":1}, table_version:1656808765328144, dml_type:1, update_seq:0, new_row:{data:0x7f5d19dc4133, size:13}, old_row:{data:null, size:0}, acc_checksum:1902006703, version:1656808765436548, sql_no:1, flag:0}} | OLD_ROW={} | NEW_ROW={ 16:{"INT":1} 17:{"INT":2}}

$$$file_id:1 offset:19163209 len:127  OB_LOG_SUBMIT|log_id:4|{ObLogEntryHeader:{magic:17746, version:1, type:201, partition_key:{tid:1099511677777, partition_id:0, part_cnt:0}, log_id:4, data_len:22, generation_timestamp:1656808953925930, epoch_id:1656808765442630, proposal_id:{time_to_usec:1656808765442630, server:"127.0.0.1:2882"}, submit_timestamp:1656808953925930, is_batch_committed:false, is_trans_log:false, data_checksum:1176971898, active_memstore_version:"2-0-0", header_checksum:2288376192}} ||| {checkpoint:1656808953788033}|||
$$$file_id:1 offset:19854204 len:344  OB_LOG_SUBMIT|log_id:5|{ObLogEntryHeader:{magic:17746, version:1, type:201, partition_key:{tid:1099511677777, partition_id:0, part_cnt:0}, log_id:5, data_len:239, generation_timestamp:1656809115074456, epoch_id:1656808765442630, proposal_id:{time_to_usec:1656808765442630, server:"127.0.0.1:2882"}, submit_timestamp:1656809115073864, is_batch_committed:false, is_trans_log:true, data_checksum:870458997, active_memstore_version:"2-0-0", header_checksum:4137847453}} |||	|||Trans: log_type:OB_LOG_SP_TRANS_COMMIT, trans_inc:22310 {log_type:64, partition:{tid:1099511677777, partition_id:0, part_cnt:0}, trans_id:{hash:17630790740066948592, inc:22310, addr:"127.0.0.1:2882", t:1656809115073070}, tenant_id:1, log_no:0, trans_param:[access_mode=1, type=3, isolation=1, magic=17361641481138401520, autocommit=0, consistency_type=0(CURRENT_READ), read_snapshot_type=2(PARTICIPANT_SNAPSHOT), cluster_version=12884967427, is_inner_trans=0], cluster_id:1, active_memstore_version:"2-0-0", checksum:3226038480, prev_redo_log_ids:[], app_trace_id_str:"", checkpoint:1656809114906358, prev_trans_arr:[], app_trace_info:"", prev_record_log_id:0}||| 0x7ffeb08ded38 data_crc=d436156f meta_size=24 data_size=56 row_count=1  MutatorRow={{row_size:56, table_id:1099511677777, rowkey:{"INT":3}, table_version:1656808765328144, dml_type:1, update_seq:0, new_row:{data:0x7f5d19dc4133, size:13}, old_row:{data:null, size:0}, acc_checksum:2059693691, version:1656808765436548, sql_no:1, flag:0}} | OLD_ROW={} | NEW_ROW={ 16:{"INT":3} 17:{"INT":4}}

$$$file_id:1 offset:19937548 len:127  OB_LOG_SUBMIT|log_id:6|{ObLogEntryHeader:{magic:17746, version:1, type:201, partition_key:{tid:1099511677777, partition_id:0, part_cnt:0}, log_id:6, data_len:22, generation_timestamp:1656809134354418, epoch_id:1656808765442630, proposal_id:{time_to_usec:1656808765442630, server:"127.0.0.1:2882"}, submit_timestamp:1656809134354417, is_batch_committed:false, is_trans_log:false, data_checksum:687244374, active_memstore_version:"2-0-0", header_checksum:2408225591}} ||| {checkpoint:1656809134235503}|||

中间有其他日志,分别用自己的log_id
$$$file_id:1 offset:20211726 len:343  OB_LOG_SUBMIT|log_id:7|{ObLogEntryHeader:{magic:17746, version:1, type:201, partition_key:{tid:1099511677777, partition_id:0, part_cnt:0}, log_id:7, data_len:238, generation_timestamp:1656809198862315, epoch_id:1656808765442630, proposal_id:{time_to_usec:1656808765442630, server:"127.0.0.1:2882"}, submit_timestamp:1656809198861205, is_batch_committed:false, is_trans_log:true, data_checksum:1532213143, active_memstore_version:"2-0-0", header_checksum:3854860302}} |||	|||Trans: log_type:OB_LOG_SP_TRANS_COMMIT, trans_inc:23894 {log_type:64, partition:{tid:1099511677777, partition_id:0, part_cnt:0}, trans_id:{hash:10195262834394709777, inc:23894, addr:"127.0.0.1:2882", t:1656809198860998}, tenant_id:1, log_no:0, trans_param:[access_mode=1, type=3, isolation=1, magic=17361641481138401520, autocommit=0, consistency_type=0(CURRENT_READ), read_snapshot_type=2(PARTICIPANT_SNAPSHOT), cluster_version=12884967427, is_inner_trans=0], cluster_id:1, active_memstore_version:"2-0-0", checksum:3687836626, prev_redo_log_ids:[], app_trace_id_str:"", checkpoint:1656809198702514, prev_trans_arr:[], app_trace_info:"", prev_record_log_id:0}||| 0x7ffeb08ded38 data_crc=7bbb724e meta_size=24 data_size=55 row_count=1  MutatorRow={{row_size:55, table_id:1099511677777, rowkey:{"INT":5}, table_version:1656808765328144, dml_type:1, update_seq:0, new_row:{data:0x7f5d19dc4133, size:13}, old_row:{data:null, size:0}, acc_checksum:107755032, version:1656808765436548, sql_no:1, flag:0}} | OLD_ROW={} | NEW_ROW={ 16:{"INT":5} 17:{"INT":6}}

 

【赋值地方】

1)从meta里获取tmp_log_id

 2)赋值log_id

b ob_clog_adapter.cpp:414: if  partition.table_id_==1099511677778

 

【日志格式】

 header里面有log_id,epoch_id,proprosal_id

posted @ 2022-07-03 10:22  stupidstan2019  阅读(95)  评论(0编辑  收藏  举报