-C Make\ssure\sthe\squeueMutex\sis\sheld\sprior\sto\swriting\sthe\spQueueLast\sfield\nof\sthe\swrite\squeue\sin\sthe\sasync\sdemonstration\scode.\s\sTicket\s#3405.\s(CVS\s5744)
-D 2008-09-26T20:02:50
+C Add\sthe\s"truncate"\sjournal\smode\swhich\scommits\stransactions\sby\struncating\sthe\nrollback\sjournal\sfile\sto\szero\slength\sand\snot\scalling\sfsync().\s(CVS\s5745)
+D 2008-09-26T21:08:08
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in e4ab842f9a64ef61d57093539a8aab76b12810db
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F src/os_os2.c e391fc95adc744bbdcefd4d11e3066998185a0a0
F src/os_unix.c f33b69d8a85372b270fe37ee664a4c2140a5217d
F src/os_win.c 3209dc0ed734291764393ea8d534ba0d8696a540
-F src/pager.c 7a3ba14e27cf134e54f0f4f58d307de13a7ea28d
-F src/pager.h 1ef5a3f8e0b4c8b30f19c8e01d4fca2db9bb5797
+F src/pager.c 6426902ba983ce6872fcec20ba72796a79d6cead
+F src/pager.h 30e71f447ecbcfef707bb72cc813ce37ab5a2bc9
F src/parse.y d0f76d2cb8d6883d5600dc20beb961a6022b94b8
F src/pcache.c 52108517c38bcf023f3977085a66aacb520a5385
F src/pcache.h 0b6871e820159629915e8688b5c67a81a203773f
-F src/pragma.c e633b6b7dabc110e2abfed4e35ba34a4039cb65c
+F src/pragma.c 0b1c2d2a241dd79a7361bbeb8ff575a9e9d7cd71
F src/prepare.c c7e00ed1b0bdcf699b1aad651247d4dc3d281b0b
F src/printf.c 785f87120589c1db672e37c6eb1087c456e6f84d
F src/random.c 11bbdf7def3746a762fbdb56c9d04648135ad6d8
F test/join4.test 1a352e4e267114444c29266ce79e941af5885916
F test/join5.test 86675fc2919269aa923c84dd00ee4249b97990fe
F test/journal1.test 36f2d1bb9bf03f790f43fbdb439e44c0657fab19
-F test/jrnlmode.test 1ab9729d6bbb6fb355cbb4bb41f1f0c271fc251a
+F test/jrnlmode.test 54469696db41e185a37aed3b3848998cca4e0c37
F test/lastinsert.test 474d519c68cb79d07ecae56a763aa7f322c72f51
F test/laststmtchanges.test 18ead86c8a87ade949a1d5658f6dc4bb111d1b02
F test/like.test fef924922828d5a2a5bff80b9bdd9ff57a1ca500
F test/pagesize.test 0d9ff3fedfce6e5ffe8fa7aca9b6d3433a2e843b
F test/pcache.test 515b4c26e9f57660357dfff5b6b697acac1abc5f
F test/pcache2.test 2b4fa1bee5cfc338d8c04eb6ed7eaf41f478bf7c
-F test/permutations.test 41832b86c152c140bcdf75a35a7c82badd8912b9
+F test/permutations.test 9f9ee1a8899cc26c7f850c92bfc7efc85bb71161
F test/pragma.test c86359a8e0b28abdcc0ff4936f7966c446d0479a
F test/pragma2.test 5364893491b9231dd170e3459bfc2e2342658b47
F test/printf.test 262a5acd3158f788e9bdf7f18d718f3af32ff6ef
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 28fd0a50ca8529892f5b1ababd38d494889eed6d
-R 42f79e8d6bad8dc05f28b70884a1cf00
+P 5622a1e285fc4d5720f7180a0eb551952f2df331
+R d784c96d098146eb0a9f2a9c5180ad72
U drh
-Z c1f39a8806852672a67f740f0e33cd9d
+Z ac8d7bb3e53159a4cf0d1bb60149a10e
-5622a1e285fc4d5720f7180a0eb551952f2df331
\ No newline at end of file
+7c561f2e9264de676c1028943f6c3d06542fd802
\ No newline at end of file
** file simultaneously, or one process from reading the database while
** another is writing.
**
-** @(#) $Id: pager.c,v 1.494 2008/09/23 16:41:30 danielk1977 Exp $
+** @(#) $Id: pager.c,v 1.495 2008/09/26 21:08:08 drh Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"
pPager->stmtOpen = 0;
}
if( pPager->journalOpen ){
- if( pPager->exclusiveMode
+ if( pPager->journalMode==PAGER_JOURNALMODE_TRUNCATE
+ && (rc = sqlite3OsTruncate(pPager->jfd, 0))==SQLITE_OK ){
+ pPager->journalOff = 0;
+ pPager->journalStarted = 0;
+ }else if( pPager->exclusiveMode
|| pPager->journalMode==PAGER_JOURNALMODE_PERSIST
){
rc = zeroJournalHdr(pPager, hasMaster);
pPager->journalOff = 0;
pPager->journalStarted = 0;
}else{
+ assert( pPager->journalMode==PAGER_JOURNALMODE_DELETE || rc );
sqlite3OsClose(pPager->jfd);
pPager->journalOpen = 0;
if( rc==SQLITE_OK && !pPager->tempFile ){
}
/*
-** Get/set the journal-mode for this pager. Parameter eMode must be one
-** of PAGER_JOURNALMODE_QUERY, PAGER_JOURNALMODE_DELETE or
-** PAGER_JOURNALMODE_PERSIST. If the parameter is not _QUERY, then
-** the journal-mode is set to the value specified.
+** Get/set the journal-mode for this pager. Parameter eMode must be one of:
+**
+** PAGER_JOURNALMODE_QUERY
+** PAGER_JOURNALMODE_DELETE
+** PAGER_JOURNALMODE_TRUNCATE
+** PAGER_JOURNALMODE_PERSIST
+** PAGER_JOURNALMODE_OFF
**
-** The returned value is either PAGER_JOURNALMODE_DELETE or
-** PAGER_JOURNALMODE_PERSIST, indicating the current (possibly updated)
+** If the parameter is not _QUERY, then the journal-mode is set to the
+** value specified.
+**
+** The returned indicate the current (possibly updated)
** journal-mode.
*/
int sqlite3PagerJournalMode(Pager *pPager, int eMode){
assert( eMode==PAGER_JOURNALMODE_QUERY
|| eMode==PAGER_JOURNALMODE_DELETE
+ || eMode==PAGER_JOURNALMODE_TRUNCATE
|| 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->journalMode = eMode;
+ }else{
+ assert( eMode==PAGER_JOURNALMODE_QUERY );
}
return (int)pPager->journalMode;
}
** subsystem. The page cache subsystem reads and writes a file a page
** at a time and provides a journal for rollback.
**
-** @(#) $Id: pager.h,v 1.83 2008/09/18 17:34:44 danielk1977 Exp $
+** @(#) $Id: pager.h,v 1.84 2008/09/26 21:08:08 drh Exp $
*/
#ifndef _PAGER_H_
#define PAGER_JOURNALMODE_DELETE 0 /* Commit by deleting journal file */
#define PAGER_JOURNALMODE_PERSIST 1 /* Commit by zeroing journal header */
#define PAGER_JOURNALMODE_OFF 2 /* Journal omitted. */
+#define PAGER_JOURNALMODE_TRUNCATE 3 /* Commit by truncating journal */
/*
** See source code comments for a detailed description of the following
*************************************************************************
** This file contains code used to implement the PRAGMA command.
**
-** $Id: pragma.c,v 1.187 2008/09/16 14:38:03 danielk1977 Exp $
+** $Id: pragma.c,v 1.188 2008/09/26 21:08:08 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
*/
if( sqlite3StrICmp(zLeft,"journal_mode")==0 ){
int eMode;
- static char * const azModeName[] = {"delete", "persist", "off"};
+ static char * const azModeName[] = {"delete", "persist", "off", "truncate"};
if( zRight==0 ){
eMode = PAGER_JOURNALMODE_QUERY;
}else{
int n = strlen(zRight);
- eMode = 2;
+ eMode = sizeof(azModeName)/sizeof(azModeName[0]) - 1;
while( eMode>=0 && sqlite3StrNICmp(zRight, azModeName[eMode], n)!=0 ){
eMode--;
}
eMode = sqlite3PagerJournalMode(pPager, eMode);
}
assert( eMode==PAGER_JOURNALMODE_DELETE
+ || eMode==PAGER_JOURNALMODE_TRUNCATE
|| eMode==PAGER_JOURNALMODE_PERSIST
|| eMode==PAGER_JOURNALMODE_OFF );
sqlite3VdbeSetNumCols(v, 1);
# This file implements regression tests for SQLite library. The focus
# of these tests is the journal mode pragma.
#
-# $Id: jrnlmode.test,v 1.5 2008/08/02 20:09:37 drh Exp $
+# $Id: jrnlmode.test,v 1.6 2008/09/26 21:08:08 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
PRAGMA temp.journal_mode;
}
} {delete delete delete}
+do_test jrnlmode-1.7.1 {
+ execsql {
+ PRAGMA journal_mode = truncate;
+ }
+} {truncate}
+do_test jrnlmode-1.7.2 {
+ execsql {
+ PRAGMA journal_mode;
+ PRAGMA main.journal_mode;
+ PRAGMA temp.journal_mode;
+ }
+} {truncate truncate truncate}
do_test jrnlmode-1.8 {
execsql {
PRAGMA journal_mode = off;
ifcapable attach {
do_test jrnlmode-1.9 {
execsql {
- PRAGMA journal_mode = persist;
+ PRAGMA journal_mode = PERSIST;
ATTACH ':memory:' as aux1;
}
execsql {
} {persist persist}
do_test jrnlmode-1.10 {
execsql {
- PRAGMA main.journal_mode = off;
+ PRAGMA main.journal_mode = OFF;
}
execsql {
PRAGMA main.journal_mode;
} {off persist persist}
do_test jrnlmode-1.11 {
execsql {
- PRAGMA aux1.journal_mode = delete;
+ PRAGMA aux1.journal_mode = DELETE;
}
execsql {
PRAGMA main.journal_mode;
PRAGMA aux3.journal_mode;
}
} {delete delete delete delete delete}
+ do_test jrnlmode-1.14 {
+ execsql {
+ PRAGMA journal_mode = TRUNCATE;
+ }
+ execsql {
+ PRAGMA main.journal_mode;
+ PRAGMA temp.journal_mode;
+ PRAGMA aux1.journal_mode;
+ PRAGMA aux2.journal_mode;
+ PRAGMA aux3.journal_mode;
+ }
+ } {truncate truncate truncate truncate truncate}
do_test jrnlmode-1.99 {
execsql {
#
#***********************************************************************
#
-# $Id: permutations.test,v 1.30 2008/09/12 10:22:40 danielk1977 Exp $
+# $Id: permutations.test,v 1.31 2008/09/26 21:08:08 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
} -presql {
pragma locking_mode = 'exclusive'
} -include {
+ vacuum.test
rollback.test select1.test select2.test
malloc.test ioerr.test
}
+# Run some tests in exclusive locking mode with truncated journals.
+#
+run_tests "exclusive-truncate" -description {
+ Run tests in exclusive locking mode and truncate journal mode.
+} -presql {
+ pragma locking_mode = 'exclusive';
+ pragma journal_mode = TRUNCATE;
+} -include {
+ delete.test delete2.test insert.test rollback.test select1.test
+ select2.test update.test malloc.test ioerr.test
+}
+
# Run some tests in persistent journal mode.
#
run_tests "persistent_journal" -description {
select2.test trans.test update.test vacuum.test
}
+# Run some tests in truncating journal mode.
+#
+run_tests "truncate_journal" -description {
+ Run tests in persistent-journal mode.
+} -presql {
+ pragma journal_mode = truncate
+} -include {
+ delete.test delete2.test insert.test rollback.test select1.test
+ select2.test trans.test update.test vacuum.test
+ malloc.test ioerr.test
+}
+
# Run some error tests in persistent journal mode.
#
run_tests "persistent_journal_error" -description {