BUG #3143: MyLastRecPtr.xlogid not updated with MyLastRecPtr.xrecoff?
От | Chongfeng Hu |
---|---|
Тема | BUG #3143: MyLastRecPtr.xlogid not updated with MyLastRecPtr.xrecoff? |
Дата | |
Msg-id | 200703120300.l2C30LU2045849@wwwmaster.postgresql.org обсуждение исходный текст |
Ответы |
Re: BUG #3143: MyLastRecPtr.xlogid not updated with MyLastRecPtr.xrecoff?
|
Список | pgsql-bugs |
The following bug has been logged online: Bug reference: 3143 Logged by: Chongfeng Hu Email address: loveminix@yahoo.com.cn PostgreSQL version: 8.2.3 Operating system: any Description: MyLastRecPtr.xlogid not updated with MyLastRecPtr.xrecoff? Details: I checked the source of PostgreSQL, and found one suspicious spot in file src/backend/access/transam/xact.c. In struct XLogRecPtr, it has two fields: xlogid, indicating log file #, and xrecoff, indicating the byte offset of location in log file, so they should always keep consistent, as I saw in many places, just list one of them: if (tmpRecPtr.xrecoff >= XLogFileSize) { (tmpRecPtr.xlogid)++; tmpRecPtr.xrecoff = 0; } 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.
В списке pgsql-bugs по дате отправления: