heap_insert
xl_heap_insert xlrec;
xl_heap_header xlhdr;
XLogRegisterData((char *) &xlrec, SizeOfHeapInsert);->//xl_heap_insert
|-- XLogRecData *rdata;
| rdata->data = data;
| rdata->len = len;
| mainrdata_last->next = rdata;
| mainrdata_last = rdata;
|-- mainrdata_len += len;
//xl_heap_header+heapup->t_data
XLogRegisterBufData(0, (char *) &xlhdr, SizeOfHeapHeader);->
|-- regbuf = ®istered_buffers[block_id];
| rdata->data = data;
| rdata->len = len;
| regbuf->rdata_tail->next = rdata;
| regbuf->rdata_tail = rdata;
|-- regbuf->rdata_len += len;
XLogRegisterBufData(0,(char *) heaptup->t_data + SizeofHeapTupleHeader,heaptup->t_len - SizeofHeapTupleHeader);
recptr = XLogInsert(RM_HEAP_ID, info);->
|-- rdt = XLogRecordAssemble(rmid, info, RedoRecPtr, doPageWrites,&fpw_lsn);
|-- EndPos = XLogInsertRecord(rdt, fpw_lsn, curinsert_flags);
static XLogRecData hdr_rdt;
XLogRecordAssemble:
char *scratch = hdr_scratch;//hdr_scratch是一个xlog记录的开始位置
rechdr = (XLogRecord *) scratch;
scratch += SizeOfXLogRecord;
hdr_rdt.next = NULL;
rdt_datas_last = &hdr_rdt;//xlog记录链表头
hdr_rdt.data = hdr_scratch;
//hdr_rdt->next=xl_heap_header+heapup->t_data
registered_buffer *regbuf = ®istered_buffers[block_id];
rdt_datas_last->next = regbuf->rdata_head;
dt_datas_last = regbuf->rdata_tail;
//xl_heap_header+heapup->t_data后面紧跟着xl_heap_insert
rdt_datas_last->next = mainrdata_head;
rdt_datas_last = mainrdata_last;
免责声明:
① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。
② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341