Fix a bug in the new full-sync journal format. (CVS 1733)
FossilOrigin-Name: 02bd3acd7efde9cc6b67c97e98db9f4b62d27877
This commit is contained in:
parent
c8e9a2df77
commit
75edc16f07
12
manifest
12
manifest
@ -1,5 +1,5 @@
|
||||
C Fix\sCVS\smerge\sproblem.\s(CVS\s1693)
|
||||
D 2004-06-25T12:08:47
|
||||
C Fix\sa\sbug\sin\sthe\snew\sfull-sync\sjournal\sformat.\s(CVS\s1733)
|
||||
D 2004-06-26T01:48:19
|
||||
F Makefile.in cb7a9889c38723f72b2506c4236ff30a05ff172b
|
||||
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
|
||||
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
|
||||
@ -50,7 +50,7 @@ F src/os_unix.c bd62e20d3abfb96c41fe737715b328d1dbb52bf7
|
||||
F src/os_unix.h 00c1f82b526ab2fb7ee5ddd555ea4ed68363c93a
|
||||
F src/os_win.c 84549f6cc815237533c5d0eb3697352b03478d96
|
||||
F src/os_win.h babd4e912967c6b09088cfe38a45e8005a07ba44
|
||||
F src/pager.c e4c7e844d8ce52bf23d53d25bd5fc506abdcf441
|
||||
F src/pager.c e3969171742e7d9681977703feed4853f5ee206a
|
||||
F src/pager.h bc58d32a9dee464f7268fb68652c130a4216e438
|
||||
F src/parse.y 097438674976355a10cf177bd97326c548820b86
|
||||
F src/pragma.c 0750e1c360647dbe0a991f16133b0fe5e42e5039
|
||||
@ -229,7 +229,7 @@ F www/tclsqlite.tcl 19191cf2a1010eaeff74c51d83fd5f5a4d899075
|
||||
F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9
|
||||
F www/version3.tcl 563ba3ac02f64da27ab17f3edbe8e56bfd0293fb
|
||||
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
|
||||
P 4905e74925a4e9d467c51dc174f265b9395ae9fa
|
||||
R 98cae54b77ddaa39769902b12d5a271c
|
||||
P dfab1e9ac0fbe57fe4a1cbe6c363ef43b3b075ef
|
||||
R e246eb7b8fa1d2e1a6e20fbeb7cc5c16
|
||||
U danielk1977
|
||||
Z 7a7f720eca297a401dca9b9f9bbfe29b
|
||||
Z ead895d5ca480d6e5d884e35379e8164
|
||||
|
@ -1 +1 @@
|
||||
dfab1e9ac0fbe57fe4a1cbe6c363ef43b3b075ef
|
||||
02bd3acd7efde9cc6b67c97e98db9f4b62d27877
|
17
src/pager.c
17
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.142 2004/06/25 11:11:54 danielk1977 Exp $
|
||||
** @(#) $Id: pager.c,v 1.143 2004/06/26 01:48:19 danielk1977 Exp $
|
||||
*/
|
||||
#include "os.h" /* Must be first to enable large file support */
|
||||
#include "sqliteInt.h"
|
||||
@ -234,6 +234,7 @@ struct Pager {
|
||||
off_t journalOff; /* Current byte offset in the journal file */
|
||||
off_t journalHdr; /* Byte offset to previous journal header */
|
||||
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 */
|
||||
};
|
||||
@ -838,7 +839,7 @@ static int pager_playback_one_page(Pager *pPager, OsFile *jfd, int useCksum){
|
||||
** it could cause invalid data to be written into the journal. We need to
|
||||
** detect this invalid data (with high probability) and ignore it.
|
||||
*/
|
||||
if( pgno==0 ){
|
||||
if( pgno==0 || pgno==PAGER_MJ_PGNO(pPager) ){
|
||||
return SQLITE_DONE;
|
||||
}
|
||||
if( pgno>(unsigned)pPager->dbSize ){
|
||||
@ -1264,7 +1265,9 @@ static int pager_stmt_playback(Pager *pPager){
|
||||
goto end_stmt_playback;
|
||||
}
|
||||
pPager->journalOff = pPager->stmtJSize;
|
||||
while( pPager->journalOff < hdrOff ){
|
||||
pPager->cksumInit = pPager->stmtCksum;
|
||||
assert( JOURNAL_HDR_SZ(pPager)<(pPager->pageSize+8) );
|
||||
while( pPager->journalOff <= (hdrOff-(pPager->pageSize+8)) ){
|
||||
rc = pager_playback_one_page(pPager, &pPager->jfd, 1);
|
||||
assert( rc!=SQLITE_DONE );
|
||||
if( rc!=SQLITE_OK ) goto end_stmt_playback;
|
||||
@ -1278,6 +1281,9 @@ static int pager_stmt_playback(Pager *pPager){
|
||||
assert( rc!=SQLITE_DONE );
|
||||
goto end_stmt_playback;
|
||||
}
|
||||
if( nRec==0 ){
|
||||
nRec = (szJ - pPager->journalOff) / (pPager->pageSize+8);
|
||||
}
|
||||
for(i=nRec-1; i>=0 && pPager->journalOff < szJ; i--){
|
||||
rc = pager_playback_one_page(pPager, &pPager->jfd, 1);
|
||||
assert( rc!=SQLITE_DONE );
|
||||
@ -1291,6 +1297,9 @@ end_stmt_playback:
|
||||
if( rc!=SQLITE_OK ){
|
||||
pPager->errMask |= PAGER_ERR_CORRUPT;
|
||||
rc = SQLITE_CORRUPT;
|
||||
}else{
|
||||
pPager->journalOff = szJ;
|
||||
/* pager_reload_cache(pPager); */
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
@ -1470,6 +1479,7 @@ int sqlite3pager_open(
|
||||
pPager->readOnly = readOnly;
|
||||
pPager->needSync = 0;
|
||||
pPager->noSync = pPager->tempFile || !useJournal;
|
||||
pPager->fullSync = (pPager->noSync?0:1);
|
||||
pPager->pFirst = 0;
|
||||
pPager->pFirstSynced = 0;
|
||||
pPager->pLast = 0;
|
||||
@ -2879,6 +2889,7 @@ int sqlite3pager_stmt_begin(Pager *pPager){
|
||||
pPager->stmtJSize = pPager->journalOff;
|
||||
pPager->stmtSize = pPager->dbSize;
|
||||
pPager->stmtHdrOff = 0;
|
||||
pPager->stmtCksum = pPager->cksumInit;
|
||||
if( !pPager->stmtOpen ){
|
||||
rc = sqlite3pager_opentemp(zTemp, &pPager->stfd);
|
||||
if( rc ) goto stmt_begin_failed;
|
||||
|
Loading…
Reference in New Issue
Block a user