mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
Backout check-in (4206) and replace it with a much better and more
general fix for the problem identified in ticket #2565. (CVS 4208) FossilOrigin-Name: 7961a7385013d74ec78cbdfff6867c505528c163
This commit is contained in:
15
src/pager.c
15
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.354 2007/08/10 23:56:36 drh Exp $
|
||||
** @(#) $Id: pager.c,v 1.355 2007/08/11 00:26:21 drh Exp $
|
||||
*/
|
||||
#ifndef SQLITE_OMIT_DISKIO
|
||||
#include "sqliteInt.h"
|
||||
@@ -1455,10 +1455,15 @@ static int pager_playback(Pager *pPager, int isHot){
|
||||
}
|
||||
|
||||
/* If nRec is 0 and this rollback is of a transaction created by this
|
||||
** process. In this case the rest of the journal file consists of
|
||||
** journalled copies of pages that need to be read back into the cache.
|
||||
** process and if this is the final header in the journal, then it means
|
||||
** that this part of the journal was being filled but has not yet been
|
||||
** synced to disk. Compute the number of pages based on the remaining
|
||||
** size of the file.
|
||||
**
|
||||
** The third term of the test was added to fix ticket #2565.
|
||||
*/
|
||||
if( nRec==0 && !isHot ){
|
||||
if( nRec==0 && !isHot &&
|
||||
pPager->journalHdr+JOURNAL_HDR_SZ(pPager)==pPager->journalOff ){
|
||||
nRec = (szJ - pPager->journalOff) / JOURNAL_PG_SZ(pPager);
|
||||
}
|
||||
|
||||
@@ -2629,7 +2634,7 @@ static int pager_recycle(Pager *pPager, int syncOk, PgHdr **ppPg){
|
||||
** very slow operation, so we work hard to avoid it. But sometimes
|
||||
** it can't be helped.
|
||||
*/
|
||||
if( pPg==0 && pPager->pFirst && pPager->nRec && syncOk && !MEMDB){
|
||||
if( pPg==0 && pPager->pFirst && syncOk && !MEMDB){
|
||||
int rc = syncJournal(pPager);
|
||||
if( rc!=0 ){
|
||||
return rc;
|
||||
|
Reference in New Issue
Block a user