mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-05 15:55:57 +03:00
When in PAGER_RESERVED state, don't write to the main file when rolling
back a statement transaction. (CVS 1560) FossilOrigin-Name: adb2bd61436927d37b23bae857089d62e12397af
This commit is contained in:
19
src/pager.c
19
src/pager.c
@@ -18,7 +18,7 @@
|
||||
** file simultaneously, or one process from reading the database while
|
||||
** another is writing.
|
||||
**
|
||||
** @(#) $Id: pager.c,v 1.120 2004/06/10 02:16:02 danielk1977 Exp $
|
||||
** @(#) $Id: pager.c,v 1.121 2004/06/10 04:32:17 danielk1977 Exp $
|
||||
*/
|
||||
#include "os.h" /* Must be first to enable large file support */
|
||||
#include "sqliteInt.h"
|
||||
@@ -517,13 +517,22 @@ static int pager_playback_one_page(Pager *pPager, OsFile *jfd, int useCksum){
|
||||
}
|
||||
}
|
||||
|
||||
/* Playback the page. Update the in-memory copy of the page
|
||||
** at the same time, if there is one.
|
||||
assert( pPager->state==PAGER_RESERVED || pPager->state==PAGER_EXCLUSIVE );
|
||||
|
||||
/* If the pager is in RESERVED state, then there must be a copy of this
|
||||
** page in the pager cache. In this case just update the pager cache,
|
||||
** not the database file.
|
||||
**
|
||||
** If in EXCLUSIVE state, then we update the pager cache if it exists
|
||||
** and the main file. The page is then marked not dirty.
|
||||
*/
|
||||
pPg = pager_lookup(pPager, pgno);
|
||||
assert( pPager->state==PAGER_EXCLUSIVE || pPg );
|
||||
TRACE2("PLAYBACK page %d\n", pgno);
|
||||
sqlite3OsSeek(&pPager->fd, (pgno-1)*(off_t)SQLITE_PAGE_SIZE);
|
||||
rc = sqlite3OsWrite(&pPager->fd, aData, SQLITE_PAGE_SIZE);
|
||||
if( pPager->state==PAGER_EXCLUSIVE ){
|
||||
sqlite3OsSeek(&pPager->fd, (pgno-1)*(off_t)SQLITE_PAGE_SIZE);
|
||||
rc = sqlite3OsWrite(&pPager->fd, aData, SQLITE_PAGE_SIZE);
|
||||
}
|
||||
if( pPg ){
|
||||
/* No page should ever be rolled back that is in use, except for page
|
||||
** 1 which is held in use in order to keep the lock on the database
|
||||
|
Reference in New Issue
Block a user