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

Fix a change-counter bug similar to #3584. This one is much more obscure though, requiring a transient IO or malloc error to occur while running in exclusive mode. (CVS 6189)

FossilOrigin-Name: 9f07d2d9226b73c4dc311fd142e0aaba4ffcb078
This commit is contained in:
danielk1977
2009-01-16 16:40:14 +00:00
parent 45d6882fd9
commit db3403973c
4 changed files with 87 additions and 10 deletions

View File

@@ -18,7 +18,7 @@
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: pager.c,v 1.553 2009/01/16 16:23:38 danielk1977 Exp $
** @(#) $Id: pager.c,v 1.554 2009/01/16 16:40:14 danielk1977 Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"
@@ -1733,6 +1733,17 @@ end_playback:
sqlite3OsFileControl(pPager->fd,SQLITE_FCNTL_DB_UNCHANGED,0)>=SQLITE_OK
);
/* If this playback is happening automatically as a result of an IO or
** malloc error that occured after the change-counter was updated but
** before the transaction was committed, then the change-counter
** modification may just have been reverted. If this happens in exclusive
** mode, then subsequent transactions performed by the connection will not
** update the change-counter at all. This may lead to cache inconsistency
** problems for other processes at some point in the future. So, just
** in case this has happened, clear the changeCountDone flag now.
*/
pPager->changeCountDone = 0;
if( rc==SQLITE_OK ){
zMaster = pPager->pTmpSpace;
rc = readMasterJournal(pPager->jfd, zMaster, pPager->pVfs->mxPathname+1);