Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add some tests for journal_mode=off. Need to come up with a way of handling rollback attempts when there is no journal. (CVS 5034) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
e29b870ed0db6360a95fb017f56c0b53 |
User & Date: | drh 2008-04-19 20:53:26.000 |
Context
2008-04-22
| ||
14:31 | Avoid non-contiguous writes when creating a journal header. (CVS 5035) (check-in: dfacddbb50 user: danielk1977 tags: trunk) | |
2008-04-19
| ||
20:53 | Add some tests for journal_mode=off. Need to come up with a way of handling rollback attempts when there is no journal. (CVS 5034) (check-in: e29b870ed0 user: drh tags: trunk) | |
20:34 | Continuing work on journal_mode. Journal_mode=persist now appears to be working, though additional testing would be welcomed. (CVS 5033) (check-in: 277e4099ce user: drh tags: trunk) | |
Changes
Changes to src/pager.c.
︙ | ︙ | |||
14 15 16 17 18 19 20 | ** The pager is used to access a database disk file. It implements ** atomic commit and rollback through the use of a journal file that ** is separate from the database file. The pager also implements file ** locking to prevent two processes from writing the same database ** file simultaneously, or one process from reading the database while ** another is writing. ** | | | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ** The pager is used to access a database disk file. It implements ** atomic commit and rollback through the use of a journal file that ** is separate from the database file. The pager also implements file ** locking to prevent two processes from writing the same database ** file simultaneously, or one process from reading the database while ** another is writing. ** ** @(#) $Id: pager.c,v 1.431 2008/04/19 20:53:26 drh Exp $ */ #ifndef SQLITE_OMIT_DISKIO #include "sqliteInt.h" #include <assert.h> #include <string.h> /* |
︙ | ︙ | |||
1389 1390 1391 1392 1393 1394 1395 | #endif } pPager->pDirty = 0; pPager->dirtyCache = 0; pPager->nRec = 0; }else{ assert( pPager->pInJournal==0 ); | < | 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 | #endif } pPager->pDirty = 0; pPager->dirtyCache = 0; pPager->nRec = 0; }else{ assert( pPager->pInJournal==0 ); } if( !pPager->exclusiveMode ){ rc2 = osUnlock(pPager->fd, SHARED_LOCK); pPager->state = PAGER_SHARED; }else if( pPager->state==PAGER_SYNCED ){ pPager->state = PAGER_EXCLUSIVE; |
︙ | ︙ | |||
4620 4621 4622 4623 4624 4625 4626 | /* If a master journal file name has already been written to the ** journal file, then no sync is required. This happens when it is ** written, then the process fails to upgrade from a RESERVED to an ** EXCLUSIVE lock. The next time the process tries to commit the ** transaction the m-j name will have already been written. */ if( !pPager->setMaster ){ | < | 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 | /* If a master journal file name has already been written to the ** journal file, then no sync is required. This happens when it is ** written, then the process fails to upgrade from a RESERVED to an ** EXCLUSIVE lock. The next time the process tries to commit the ** transaction the m-j name will have already been written. */ if( !pPager->setMaster ){ rc = pager_incr_changecounter(pPager, 0); if( rc!=SQLITE_OK ) goto sync_exit; #ifndef SQLITE_OMIT_AUTOVACUUM if( nTrunc!=0 ){ /* If this transaction has made the database smaller, then all pages ** being discarded by the truncation must be written to the journal ** file. |
︙ | ︙ | |||
4741 4742 4743 4744 4745 4746 4747 | } #endif pPager->pStmt = 0; pPager->state = PAGER_SHARED; pagerLeave(pPager); return SQLITE_OK; } | < | 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 | } #endif pPager->pStmt = 0; pPager->state = PAGER_SHARED; pagerLeave(pPager); return SQLITE_OK; } assert( pPager->state==PAGER_SYNCED || !pPager->dirtyCache ); rc = pager_end_transaction(pPager); rc = pager_error(pPager, rc); pagerLeave(pPager); return rc; } |
︙ | ︙ |
Changes to test/delete.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the DELETE FROM statement. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the DELETE FROM statement. # # $Id: delete.test,v 1.23 2008/04/19 20:53:26 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Try to delete from a non-existant table. # do_test delete-1.1 { |
︙ | ︙ | |||
271 272 273 274 275 276 277 278 279 280 281 282 283 284 | execsql { PRAGMA count_changes=OFF; INSERT INTO t3 VALUES(123); SELECT * FROM t3; } } {123} db close catch {file attributes test.db -permissions 0444} catch {file attributes test.db -readonly 1} sqlite3 db test.db set ::DB [sqlite3_connection_pointer db] do_test delete-8.1 { catchsql { DELETE FROM t3; | > | 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | execsql { PRAGMA count_changes=OFF; INSERT INTO t3 VALUES(123); SELECT * FROM t3; } } {123} db close catch {file delete -force test.db-journal} catch {file attributes test.db -permissions 0444} catch {file attributes test.db -readonly 1} sqlite3 db test.db set ::DB [sqlite3_connection_pointer db] do_test delete-8.1 { catchsql { DELETE FROM t3; |
︙ | ︙ |
Changes to test/jrnlmode2.test.
︙ | ︙ | |||
8 9 10 11 12 13 14 | # May you share freely, never taking more than you give. # #*********************************************************************** # # This file runs the tests in the file ioerr.test with # persistent journal mode enabled. # | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # May you share freely, never taking more than you give. # #*********************************************************************** # # This file runs the tests in the file ioerr.test with # persistent journal mode enabled. # # $Id: jrnlmode2.test,v 1.2 2008/04/19 20:53:26 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl ifcapable {!pager_pragmas} { finish_test return |
︙ | ︙ | |||
38 39 40 41 42 43 44 | rename do_test really_do_test proc do_test {args} { set sc [concat really_do_test "jrlnmode2-[lindex $args 0]" \ [lrange $args 1 end]] eval $sc } | | > > > > | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | rename do_test really_do_test proc do_test {args} { set sc [concat really_do_test "jrlnmode2-[lindex $args 0]" \ [lrange $args 1 end]] eval $sc } source $testdir/delete.test source $testdir/delete2.test source $testdir/insert.test source $testdir/rollback.test source $testdir/select1.test source $testdir/select2.test source $testdir/trans.test source $testdir/update.test source $testdir/vacuum.test rename sqlite3 "" rename real_sqlite3 sqlite3 rename finish_test "" rename really_finish_test2 finish_test rename do_test "" rename really_do_test do_test finish_test |
Changes to test/jrnlmode3.test.
︙ | ︙ | |||
8 9 10 11 12 13 14 | # May you share freely, never taking more than you give. # #*********************************************************************** # # This file runs the tests in the file ioerr.test with # persistent journal mode enabled. # | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # May you share freely, never taking more than you give. # #*********************************************************************** # # This file runs the tests in the file ioerr.test with # persistent journal mode enabled. # # $Id: jrnlmode3.test,v 1.2 2008/04/19 20:53:26 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl ifcapable {!pager_pragmas} { finish_test return |
︙ | ︙ | |||
33 34 35 36 37 38 39 | [lindex $args 0] eval {PRAGMA journal_mode = persist} } set r } rename do_test really_do_test proc do_test {args} { | | | 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | [lindex $args 0] eval {PRAGMA journal_mode = persist} } set r } rename do_test really_do_test proc do_test {args} { set sc [concat really_do_test "jrlnmode3-[lindex $args 0]" \ [lrange $args 1 end]] eval $sc } source $testdir/malloc.test source $testdir/ioerr.test |
︙ | ︙ |
Added test/jrnlmode4.test.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | # 2007 March 26 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # # This file runs the tests in the file ioerr.test with # persistent journal mode enabled. # # $Id: jrnlmode4.test,v 1.1 2008/04/19 20:53:26 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl ifcapable {!pager_pragmas} { finish_test return } rename finish_test really_finish_test2 proc finish_test {} {} set ISQUICK 1 rename sqlite3 real_sqlite3 proc sqlite3 {args} { set r [eval "real_sqlite3 $args"] if { [llength $args] == 2 } { [lindex $args 0] eval {PRAGMA journal_mode = off} } set r } rename do_test really_do_test proc do_test {args} { set sc [concat really_do_test "jrlnmode4-[lindex $args 0]" \ [lrange $args 1 end]] eval $sc } source $testdir/delete.test source $testdir/delete2.test source $testdir/insert.test source $testdir/select1.test source $testdir/select2.test source $testdir/update.test source $testdir/vacuum.test rename sqlite3 "" rename real_sqlite3 sqlite3 rename finish_test "" rename really_finish_test2 finish_test rename do_test "" rename really_do_test do_test finish_test |