mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
Fix a pager bug that might have made multi-database commits non-atomic
if a power failure occurred at just the wrong moment. (CVS 1900) FossilOrigin-Name: b6eb4bf8c7763ef73723fc3d3697af435c19bae4
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
** file simultaneously, or one process from reading the database while
|
||||
** another is writing.
|
||||
**
|
||||
** @(#) $Id: pager.c,v 1.159 2004/08/19 13:29:15 drh Exp $
|
||||
** @(#) $Id: pager.c,v 1.160 2004/08/21 19:20:42 drh Exp $
|
||||
*/
|
||||
#include "os.h" /* Must be first to enable large file support */
|
||||
#include "sqliteInt.h"
|
||||
@@ -222,6 +222,7 @@ struct Pager {
|
||||
u8 memDb; /* True to inhibit all file I/O */
|
||||
u8 *aInJournal; /* One bit for each page in the database file */
|
||||
u8 *aInStmt; /* One bit for each page in the database */
|
||||
u8 setMaster; /* True if a m-j name has been written to jrnl */
|
||||
BusyHandler *pBusyHandler; /* Pointer to sqlite.busyHandler */
|
||||
PgHdr *pFirst, *pLast; /* List of free pages */
|
||||
PgHdr *pFirstSynced; /* First free page with PgHdr.needSync==0 */
|
||||
@@ -233,7 +234,6 @@ struct Pager {
|
||||
off_t stmtHdrOff; /* First journal header written this statement */
|
||||
off_t stmtCksum; /* cksumInit when statement was started */
|
||||
int sectorSize; /* Assumed sector size during rollback */
|
||||
u8 setMaster; /* True if a m-j name has been written to jrnl */
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -660,6 +660,7 @@ static int writeMasterJournal(Pager *pPager, const char *zMaster){
|
||||
if( rc!=SQLITE_OK ) return rc;
|
||||
|
||||
rc = sqlite3OsWrite(&pPager->jfd, aJournalMagic, sizeof(aJournalMagic));
|
||||
pPager->needSync = 1;
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user