Continuing progress on the journal_mode pragma. It still does not work. (CVS 5027)
FossilOrigin-Name: 4a72a7bb9c5793cdaf4ee038482053e042d8db54
This commit is contained in:
parent
dafc0ce818
commit
fdc40e9156
18
manifest
18
manifest
@ -1,5 +1,5 @@
|
||||
C Additional\swork\son\sticket\s#3015.\s\sThe\sprevious\sfix\s(check-in\s(4919))\sdid\nnot\sappear\sto\swork\sin\sall\scases\sand\sit\sdisabled\sindexing\sin\ssome\splaces\nwhere\sit\sshould\snot\shave.\s\sNew\stest\scases\sadded\sto\shelp\sinsure\sthat\sthe\ncurrent\sfix\sis\sbetter.\s(CVS\s5026)
|
||||
D 2008-04-17T19:14:02
|
||||
C Continuing\sprogress\son\sthe\sjournal_mode\spragma.\s\sIt\sstill\sdoes\snot\swork.\s(CVS\s5027)
|
||||
D 2008-04-17T20:59:38
|
||||
F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
|
||||
F Makefile.in 25b3282a4ac39388632c2fb0e044ff494d490952
|
||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
||||
@ -89,7 +89,7 @@ F src/btmutex.c 483ced3c52205b04b97df69161fadbf87f4f1ea2
|
||||
F src/btree.c ee340ad90103fe70526f7b0c3728d185dd470f20
|
||||
F src/btree.h c66cb17c6fffa84a88926dbef173bab4ae692fd4
|
||||
F src/btreeInt.h 8a2718652ed9413dc6acbb02a5c5a23a35a6e983
|
||||
F src/build.c e6f17bbb031c78e55389e3b90cd5cb150efef2b1
|
||||
F src/build.c f56940d7b785cd2f9bcb7e5b6e17157f6feb9c4c
|
||||
F src/callback.c 77b302b0d41468dcda78c70e706e5b84577f0fa0
|
||||
F src/complete.c 4cf68fd75d60257524cbe74f87351b9848399131
|
||||
F src/date.c e41ce4513fb0e359dc678d6bddb4ace135fe365d
|
||||
@ -127,10 +127,10 @@ F src/os_unix.c fdec4e5ee5dd555a6ad4a69f38ab35f0788536b4
|
||||
F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
|
||||
F src/os_win.c 3a60bddd07ea6f8adb2314dd5996ac97b988f403
|
||||
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
|
||||
F src/pager.c 84dc8bc0aa6d010d5904680801f353c4bc83717e
|
||||
F src/pager.c 60c81c923ab40a2934fb8bc0993823e01688a3f3
|
||||
F src/pager.h 45ec2188593afd48a25c743529646771d75e83e4
|
||||
F src/parse.y bc1b1cc6f86a0e0b669abdd88ddbdc7c8b67318d
|
||||
F src/pragma.c 113f14da852b4f94edcf4af718702287b15641e8
|
||||
F src/parse.y fc4bd35c6088901f7c8daead26c6fb11c87d22e7
|
||||
F src/pragma.c 2e4bb2e76e48a32750529fdc4bfe86ac5f54e01b
|
||||
F src/prepare.c adc7e1fc08dfbab63cd213d4c0aff8f3fa70d477
|
||||
F src/printf.c 05d2b44d7b5b80c8a4a09108ddad9c20e254370d
|
||||
F src/random.c 2b2db2de4ab491f5a14d3480466f8f4b5a5db74a
|
||||
@ -631,7 +631,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
|
||||
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
||||
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
|
||||
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
|
||||
P 79571e2c74fa365b7f471428c48e1678375b8c9d
|
||||
R 520ded2b9978aef5a40facaf74c1da68
|
||||
P 0d2e258e1a3276e55903ba2ded987f8d8a18cacd
|
||||
R a3d09c936cfdc9f30d64221d6e47db54
|
||||
U drh
|
||||
Z 73173026efe001e86c69d0ed8d1aa811
|
||||
Z 6c3e52b390c6e8cd0898e3f15efd7bdb
|
||||
|
@ -1 +1 @@
|
||||
0d2e258e1a3276e55903ba2ded987f8d8a18cacd
|
||||
4a72a7bb9c5793cdaf4ee038482053e042d8db54
|
@ -22,7 +22,7 @@
|
||||
** COMMIT
|
||||
** ROLLBACK
|
||||
**
|
||||
** $Id: build.c,v 1.480 2008/04/11 17:11:27 danielk1977 Exp $
|
||||
** $Id: build.c,v 1.481 2008/04/17 20:59:38 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include <ctype.h>
|
||||
@ -3235,6 +3235,8 @@ int sqlite3OpenTempDatabase(Parse *pParse){
|
||||
}
|
||||
assert( (db->flags & SQLITE_InTrans)==0 || db->autoCommit );
|
||||
assert( db->aDb[1].pSchema );
|
||||
sqlite3PagerJournalMode(sqlite3BtreePager(db->aDb[1].pBt),
|
||||
db->dfltJournalMode);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
74
src/pager.c
74
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.428 2008/04/17 17:02:01 drh Exp $
|
||||
** @(#) $Id: pager.c,v 1.429 2008/04/17 20:59:38 drh Exp $
|
||||
*/
|
||||
#ifndef SQLITE_OMIT_DISKIO
|
||||
#include "sqliteInt.h"
|
||||
@ -350,7 +350,7 @@ struct Pager {
|
||||
u8 setMaster; /* True if a m-j name has been written to jrnl */
|
||||
u8 doNotSync; /* Boolean. While true, do not spill the cache */
|
||||
u8 exclusiveMode; /* Boolean. True if locking_mode==EXCLUSIVE */
|
||||
u8 persistJournal; /* True if persistent_journal=ON */
|
||||
u8 journalMode; /* On of the PAGER_JOURNALMODE_* values */
|
||||
u8 changeCountDone; /* Set after incrementing the change-counter */
|
||||
u32 vfsFlags; /* Flags for sqlite3_vfs.xOpen() */
|
||||
int errCode; /* One of several kinds of errors */
|
||||
@ -1318,13 +1318,15 @@ static void pager_unlock(Pager *pPager){
|
||||
** do not attempt the rollback.
|
||||
*/
|
||||
static void pagerUnlockAndRollback(Pager *p){
|
||||
assert( p->state>=PAGER_RESERVED || p->journalOpen==0 );
|
||||
/* assert( p->state>=PAGER_RESERVED || p->journalOpen==0 ); */
|
||||
if( p->errCode==SQLITE_OK && p->state>=PAGER_RESERVED ){
|
||||
sqlite3PagerRollback(p);
|
||||
}
|
||||
pager_unlock(p);
|
||||
#if 0
|
||||
assert( p->errCode || !p->journalOpen || (p->exclusiveMode&&!p->journalOff) );
|
||||
assert( p->errCode || !p->stmtOpen || p->exclusiveMode );
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1358,7 +1360,9 @@ static int pager_end_transaction(Pager *pPager){
|
||||
pPager->stmtOpen = 0;
|
||||
}
|
||||
if( pPager->journalOpen ){
|
||||
if( pPager->exclusiveMode && (rc = zeroJournalHdr(pPager))==SQLITE_OK ){
|
||||
if( (pPager->exclusiveMode ||
|
||||
pPager->journalMode==PAGER_JOURNALMODE_PERSIST)
|
||||
&& (rc = zeroJournalHdr(pPager))==SQLITE_OK ){
|
||||
pPager->journalOff = 0;
|
||||
pPager->journalStarted = 0;
|
||||
}else{
|
||||
@ -2715,7 +2719,6 @@ int sqlite3PagerClose(Pager *pPager){
|
||||
enable_simulated_io_errors();
|
||||
PAGERTRACE2("CLOSE %d\n", PAGERID(pPager));
|
||||
IOTRACE(("CLOSE %p\n", pPager))
|
||||
assert( pPager->errCode || (pPager->journalOpen==0 && pPager->stmtOpen==0) );
|
||||
if( pPager->journalOpen ){
|
||||
sqlite3OsClose(pPager->jfd);
|
||||
}
|
||||
@ -3865,7 +3868,6 @@ static int pager_open_journal(Pager *pPager){
|
||||
int rc;
|
||||
assert( !MEMDB );
|
||||
assert( pPager->state>=PAGER_RESERVED );
|
||||
assert( pPager->journalOpen==0 );
|
||||
assert( pPager->useJournal );
|
||||
assert( pPager->pInJournal==0 );
|
||||
sqlite3PagerPagecount(pPager);
|
||||
@ -3877,27 +3879,29 @@ static int pager_open_journal(Pager *pPager){
|
||||
goto failed_to_open_journal;
|
||||
}
|
||||
|
||||
if( pPager->tempFile ){
|
||||
flags |= (SQLITE_OPEN_DELETEONCLOSE|SQLITE_OPEN_TEMP_JOURNAL);
|
||||
}else{
|
||||
flags |= (SQLITE_OPEN_MAIN_JOURNAL);
|
||||
}
|
||||
#ifdef SQLITE_ENABLE_ATOMIC_WRITE
|
||||
rc = sqlite3JournalOpen(
|
||||
pVfs, pPager->zJournal, pPager->jfd, flags, jrnlBufferSize(pPager)
|
||||
);
|
||||
#else
|
||||
rc = sqlite3OsOpen(pVfs, pPager->zJournal, pPager->jfd, flags, 0);
|
||||
#endif
|
||||
assert( rc!=SQLITE_OK || pPager->jfd->pMethods );
|
||||
pPager->journalOff = 0;
|
||||
pPager->setMaster = 0;
|
||||
pPager->journalHdr = 0;
|
||||
if( rc!=SQLITE_OK ){
|
||||
if( rc==SQLITE_NOMEM ){
|
||||
sqlite3OsDelete(pVfs, pPager->zJournal, 0);
|
||||
if( pPager->journalOpen==0 ){
|
||||
if( pPager->tempFile ){
|
||||
flags |= (SQLITE_OPEN_DELETEONCLOSE|SQLITE_OPEN_TEMP_JOURNAL);
|
||||
}else{
|
||||
flags |= (SQLITE_OPEN_MAIN_JOURNAL);
|
||||
}
|
||||
#ifdef SQLITE_ENABLE_ATOMIC_WRITE
|
||||
rc = sqlite3JournalOpen(
|
||||
pVfs, pPager->zJournal, pPager->jfd, flags, jrnlBufferSize(pPager)
|
||||
);
|
||||
#else
|
||||
rc = sqlite3OsOpen(pVfs, pPager->zJournal, pPager->jfd, flags, 0);
|
||||
#endif
|
||||
assert( rc!=SQLITE_OK || pPager->jfd->pMethods );
|
||||
pPager->journalOff = 0;
|
||||
pPager->setMaster = 0;
|
||||
pPager->journalHdr = 0;
|
||||
if( rc!=SQLITE_OK ){
|
||||
if( rc==SQLITE_NOMEM ){
|
||||
sqlite3OsDelete(pVfs, pPager->zJournal, 0);
|
||||
}
|
||||
goto failed_to_open_journal;
|
||||
}
|
||||
goto failed_to_open_journal;
|
||||
}
|
||||
pPager->journalOpen = 1;
|
||||
pPager->journalStarted = 0;
|
||||
@ -3981,7 +3985,8 @@ int sqlite3PagerBegin(DbPage *pPg, int exFlag){
|
||||
}
|
||||
pPager->dirtyCache = 0;
|
||||
PAGERTRACE2("TRANSACTION %d\n", PAGERID(pPager));
|
||||
if( pPager->useJournal && !pPager->tempFile ){
|
||||
if( pPager->useJournal && !pPager->tempFile
|
||||
&& pPager->journalMode!=PAGER_JOURNALMODE_OFF ){
|
||||
rc = pager_open_journal(pPager);
|
||||
}
|
||||
}
|
||||
@ -4118,18 +4123,18 @@ static int pager_write(PgHdr *pPg){
|
||||
return rc;
|
||||
}
|
||||
assert( pPager->state>=PAGER_RESERVED );
|
||||
if( !pPager->journalOpen && pPager->useJournal ){
|
||||
if( !pPager->journalOpen && pPager->useJournal
|
||||
&& pPager->journalMode!=PAGER_JOURNALMODE_OFF ){
|
||||
rc = pager_open_journal(pPager);
|
||||
if( rc!=SQLITE_OK ) return rc;
|
||||
}
|
||||
assert( pPager->journalOpen || !pPager->useJournal );
|
||||
pPager->dirtyCache = 1;
|
||||
|
||||
/* The transaction journal now exists and we have a RESERVED or an
|
||||
** EXCLUSIVE lock on the main database file. Write the current page to
|
||||
** the transaction journal if it is not there already.
|
||||
*/
|
||||
if( !pPg->inJournal && (pPager->useJournal || MEMDB) ){
|
||||
if( !pPg->inJournal && (pPager->journalOpen || MEMDB) ){
|
||||
if( (int)pPg->pgno <= pPager->origDbSize ){
|
||||
if( MEMDB ){
|
||||
PgHistory *pHist = PGHDR_TO_HIST(pPg, pPager);
|
||||
@ -5217,13 +5222,14 @@ int sqlite3PagerLockingMode(Pager *pPager, int eMode){
|
||||
int sqlite3PagerJournalMode(Pager *pPager, int eMode){
|
||||
assert( eMode==PAGER_JOURNALMODE_QUERY
|
||||
|| eMode==PAGER_JOURNALMODE_DELETE
|
||||
|| eMode==PAGER_JOURNALMODE_PERSIST );
|
||||
|| eMode==PAGER_JOURNALMODE_PERSIST
|
||||
|| eMode==PAGER_JOURNALMODE_OFF );
|
||||
assert( PAGER_JOURNALMODE_QUERY<0 );
|
||||
assert( PAGER_JOURNALMODE_DELETE>=0 && PAGER_JOURNALMODE_PERSIST>=0 );
|
||||
if( eMode>=0 && !pPager->tempFile ){
|
||||
pPager->persistJournal = eMode;
|
||||
if( eMode>=0 ){
|
||||
pPager->journalMode = eMode;
|
||||
}
|
||||
return (int)pPager->persistJournal;
|
||||
return (int)pPager->journalMode;
|
||||
}
|
||||
|
||||
#ifdef SQLITE_TEST
|
||||
|
@ -14,7 +14,7 @@
|
||||
** the parser. Lemon will also generate a header file containing
|
||||
** numeric codes for all of the tokens.
|
||||
**
|
||||
** @(#) $Id: parse.y,v 1.242 2008/03/29 12:50:33 rse Exp $
|
||||
** @(#) $Id: parse.y,v 1.243 2008/04/17 20:59:38 drh Exp $
|
||||
*/
|
||||
|
||||
// All token codes are small integers with #defines that begin with "TK_"
|
||||
@ -932,8 +932,9 @@ cmd ::= VACUUM nm. {sqlite3Vacuum(pParse);}
|
||||
///////////////////////////// The PRAGMA command /////////////////////////////
|
||||
//
|
||||
%ifndef SQLITE_OMIT_PRAGMA
|
||||
cmd ::= PRAGMA nm(X) dbnm(Z) EQ nmnum(Y). {sqlite3Pragma(pParse,&X,&Z,&Y,0);}
|
||||
cmd ::= PRAGMA nm(X) dbnm(Z) EQ ON(Y). {sqlite3Pragma(pParse,&X,&Z,&Y,0);}
|
||||
cmd ::= PRAGMA nm(X) dbnm(Z) EQ nmnum(Y). {sqlite3Pragma(pParse,&X,&Z,&Y,0);}
|
||||
cmd ::= PRAGMA nm(X) dbnm(Z) EQ ON(Y). {sqlite3Pragma(pParse,&X,&Z,&Y,0);}
|
||||
cmd ::= PRAGMA nm(X) dbnm(Z) EQ DELETE(Y). {sqlite3Pragma(pParse,&X,&Z,&Y,0);}
|
||||
cmd ::= PRAGMA nm(X) dbnm(Z) EQ minus_num(Y). {
|
||||
sqlite3Pragma(pParse,&X,&Z,&Y,1);
|
||||
}
|
||||
|
10
src/pragma.c
10
src/pragma.c
@ -11,7 +11,7 @@
|
||||
*************************************************************************
|
||||
** This file contains code used to implement the PRAGMA command.
|
||||
**
|
||||
** $Id: pragma.c,v 1.175 2008/04/17 17:02:02 drh Exp $
|
||||
** $Id: pragma.c,v 1.176 2008/04/17 20:59:38 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include <ctype.h>
|
||||
@ -461,9 +461,11 @@ void sqlite3Pragma(
|
||||
*/
|
||||
int ii;
|
||||
assert(pDb==&db->aDb[0]);
|
||||
for(ii=2; ii<db->nDb; ii++){
|
||||
pPager = sqlite3BtreePager(db->aDb[ii].pBt);
|
||||
sqlite3PagerJournalMode(pPager, eMode);
|
||||
for(ii=1; ii<db->nDb; ii++){
|
||||
if( db->aDb[ii].pBt ){
|
||||
pPager = sqlite3BtreePager(db->aDb[ii].pBt);
|
||||
sqlite3PagerJournalMode(pPager, eMode);
|
||||
}
|
||||
}
|
||||
db->dfltJournalMode = eMode;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user