I have several questions in understanding xlog code:
(1)
In RecordTransactionCommit():
* (If it made no transaction-controlled XLOG entries, its XID appears* nowhere in permanent storage
We have this in XLogInsert():
/* Insert record header */record->xl_xid = GetCurrentTransactionIdIfAny();
So in some situations (i.e., this transaction was already assigned an
XID), XLOG_NO_TRAN entries' XID does show up in permante storage?
(2)
In smgrcreate():
* Make a non-transactional XLOG entry showing the file creation. It's * non-transactional because we should replay it
whetherthe transaction * commits or not
lsn = XLogInsert(... XLOG_NO_TRAN ...);
Do we replay *all* xlogs no matter it commits or not? AFAICS, the only
usage of marking xlog non transaction-controlled is not to move
MyLastRecPtr pointer (so possiblly reduce some work at transaction
prepare/commit/abort point), and other usage?
(3)
Also in smgrcreate():
* ...; the WAL sequence will tell whether to drop the file.*/
void
smgrcreate(SMgrRelation reln, bool isTemp, bool isRedo)
Seems nobody is reponsible to remove the smgrcreate()'d file if only
XLOG_SMGR_CREATE entry is flushed and system crash?
Regards,
Qingqing