天天看点

Postgresql源码(10)Xlog组装(未完)

(继续Postgresql技术内幕学习)

  1. 前面几节已经把XLOG所需的数据注册到内存中了,下面开始组装XLOG。
  2. XLogRecordAssemble完成日志组装,处理页面数据Block部分,把registered_buffers中的数据进行二次加工。
/*
 * Assemble a WAL record from the registered data and buffers into an
 * XLogRecData chain, ready for insertion with XLogInsertRecord().
 *
 * The record header fields are filled in, except for the xl_prev field. The
 * calculated CRC does not include the record header yet.
 *
 * If there are any registered buffers, and a full-page image was not taken
 * of all of them, *fpw_lsn is set to the lowest LSN among such pages. This
 * signals that the assembled record is only good for insertion on the
 * assumption that the RedoRecPtr and doPageWrites values were up-to-date.
 */
static XLogRecData *
XLogRecordAssemble
           

继续阅读