1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Add the PGHDR_WRITEABLE bit for PgHdr.flags which is used to

distinguish between pages that are on the dirty list and pages that are
safe to modify.

FossilOrigin-Name: 7c4ef7b7c8744af19075bb96d1e0b63e35978ed1
This commit is contained in:
drh
2015-06-29 18:29:10 +00:00
parent e399ac2e1e
commit 1aacbdb374
5 changed files with 26 additions and 20 deletions

View File

@@ -5770,6 +5770,13 @@ static int pager_write(PgHdr *pPg){
((pPg->flags&PGHDR_NEED_SYNC)?1:0)));
}
}
/* The PGHDR_DIRTY bit is set above when the page was added to the dirty-list
** and before writing the page into the rollback journal. Wait until now,
** after the page has been successfully journalled, before setting the
** PGHDR_WRITEABLE bit that indicates that the page can be safely modified.
*/
pPg->flags |= PGHDR_WRITEABLE;
/* If the statement journal is open and the page is not in it,
** then write the page into the statement journal.
@@ -5909,7 +5916,7 @@ int sqlite3PagerWrite(PgHdr *pPg){
*/
#ifndef NDEBUG
int sqlite3PagerIswriteable(DbPage *pPg){
return pPg->flags&PGHDR_DIRTY;
return pPg->flags & PGHDR_WRITEABLE;
}
#endif