Chongfeng Hu wrote:
However, in file src/backend/access/transam/xact.c, on line 1778, I saw the following code:/* Break the chain of back-links in the XLOG records I output */ MyLastRecPtr.xrecoff = 0; MyXactMadeXLogEntry = false; MyXactMadeTempRelUpdate = false; It only updated xrecoff, but not xlogid. This might cause serious problems, because xlogid is still pointing to an old file, while xrecoff is pointing to a new offset. It might read incorrect records.
No, that's actually ok. MyLastRecPtr is used to check if the current transaction has made any transaction-controlled WAL records. If MyLastRecPtr.xrecoff == 0, it hasn't, otherwise it has. All readers of the variable just check for MyLastRecPtr.xrecoff == 0, so the above is OK.
I agree that it is a bit misleading, though. A boolean "MyXactMadeTransactionControlledXlogEntry", like the "MyXactMadeXLogEntry" and "MyXactMadeTempRelupdate" variables would be cleaner.
-- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org
