Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Improve testing of the wal.c changes on this branch. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | wal2 |
Files: | files | file ages | folders |
SHA3-256: |
63483e22c775183e01924b5cb3d0f365 |
User & Date: | dan 2018-12-26 20:42:32.396 |
References
2024-12-13
| ||
20:18 | Fix a problem with the output of "PRAGMA wal_checkpoint" introduced long ago by [63483e22c775183e]. (check-in: c5f7bba868 user: dan tags: wal2) | |
Context
2018-12-27
| ||
16:49 | Increase test coverage of wal.c provided by permutation "coverage-wal" on this branch. (check-in: 2f7f893a70 user: dan tags: wal2) | |
2018-12-26
| ||
20:42 | Improve testing of the wal.c changes on this branch. (check-in: 63483e22c7 user: dan tags: wal2) | |
19:10 | Merge latest trunk changes with this branch. (check-in: 404f9d99d3 user: dan tags: wal2) | |
Changes
Changes to src/wal.c.
︙ | ︙ | |||
572 573 574 575 576 577 578 | ** ** u32 walidxGetMxFrame(WalIndexHdr*, int iWal); // get mxFrame ** void walidxSetMxFrame(WalIndexHdr*, int iWal, u32 val); // set mxFrame ** int walidxGetFile(WalIndexHdr*) // get file ** void walidxSetFile(WalIndexHdr*, int val); // set file */ #define walidxGetMxFrame(pHdr, iWal) \ | | | 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 | ** ** u32 walidxGetMxFrame(WalIndexHdr*, int iWal); // get mxFrame ** void walidxSetMxFrame(WalIndexHdr*, int iWal, u32 val); // set mxFrame ** int walidxGetFile(WalIndexHdr*) // get file ** void walidxSetFile(WalIndexHdr*, int val); // set file */ #define walidxGetMxFrame(pHdr, iWal) \ ((iWal) ? ((pHdr)->mxFrame2 & 0x7FFFFFFF) : (pHdr)->mxFrame) static void walidxSetMxFrame(WalIndexHdr *pHdr, int iWal, u32 mxFrame){ if( iWal ){ pHdr->mxFrame2 = (pHdr->mxFrame2 & 0x80000000) | mxFrame; }else{ pHdr->mxFrame = mxFrame; } |
︙ | ︙ | |||
4423 4424 4425 4426 4427 4428 4429 4430 | if( isChanged && pWal->pDbFd->pMethods->iVersion>=3 ){ sqlite3OsUnfetch(pWal->pDbFd, 0, 0); } } /* Copy data from the log to the database file. */ if( rc==SQLITE_OK ){ | > | < < | | 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 | if( isChanged && pWal->pDbFd->pMethods->iVersion>=3 ){ sqlite3OsUnfetch(pWal->pDbFd, 0, 0); } } /* Copy data from the log to the database file. */ if( rc==SQLITE_OK ){ int iCkpt = walidxGetFile(&pWal->hdr); if( (walPagesize(pWal)!=nBuf) && walidxGetMxFrame(&pWal->hdr, iCkpt) ){ rc = SQLITE_CORRUPT_BKPT; }else{ rc = walCheckpoint(pWal, db, eMode2, xBusy2, pBusyArg, sync_flags, zBuf); } /* If no error occurred, set the output variables. */ if( rc==SQLITE_OK || rc==SQLITE_BUSY ){ if( pnLog ){ *pnLog = walidxGetMxFrame(&pWal->hdr,0)+walidxGetMxFrame(&pWal->hdr,1); } if( pnCkpt ){ if( isWalMode2(pWal) ){ if( (int)(walCkptInfo(pWal)->nBackfill) ){ *pnCkpt = walidxGetMxFrame(&pWal->hdr, iCkpt); }else{ *pnCkpt = 0; } }else{ *pnCkpt = walCkptInfo(pWal)->nBackfill; } } |
︙ | ︙ |
Changes to test/permutations.test.
︙ | ︙ | |||
440 441 442 443 444 445 446 447 448 449 450 451 452 453 | walprotocol.test walro2.test walrofault.test walro.test walshared.test walslow.test wal.test wal2savepoint.test wal2lock.test wal2recover2.test walvfs.test walfault2.test nockpt.test snapshot2.test snapshot3.test snapshot4.test snapshot_fault.test snapshot.test snapshot_up.test walcrash2.test walcrash3.test walcrash4.test walcrash.test } test_suite "coverage-pager" -description { Coverage tests for file pager.c. } -files { pager1.test pager2.test pagerfault.test pagerfault2.test walfault.test walbak.test journal2.test tkt-9d68c883.test | > | 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | walprotocol.test walro2.test walrofault.test walro.test walshared.test walslow.test wal.test wal2savepoint.test wal2lock.test wal2recover2.test walvfs.test walfault2.test nockpt.test snapshot2.test snapshot3.test snapshot4.test snapshot_fault.test snapshot.test snapshot_up.test walcrash2.test walcrash3.test walcrash4.test walcrash.test wal2fault.test } test_suite "coverage-pager" -description { Coverage tests for file pager.c. } -files { pager1.test pager2.test pagerfault.test pagerfault2.test walfault.test walbak.test journal2.test tkt-9d68c883.test |
︙ | ︙ |
Added test/wal2fault.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 | # 2010 May 03 # # 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 operation of the library in # "PRAGMA journal_mode=WAL" mode. # set testdir [file dirname $argv0] source $testdir/tester.tcl source $testdir/malloc_common.tcl source $testdir/lock_common.tcl ifcapable !wal {finish_test ; return } set testprefix wal2fault do_execsql_test 1.0 { CREATE TABLE t1(x,y); PRAGMA journal_mode = wal2; WITH s(i) AS ( SELECT 100 UNION ALL SELECT i-1 FROM s WHERE (i-1)>0 ) INSERT INTO t1 SELECT i, randomblob(i) FROM s; WITH s(i) AS ( SELECT 100 UNION ALL SELECT i-1 FROM s WHERE (i-1)>0 ) INSERT INTO t1 SELECT i, randomblob(i) FROM s; } {wal2} do_test 1.1 { expr [file size test.db-wal]>10000 } {1} faultsim_save_and_close do_faultsim_test 1 -prep { faultsim_restore_and_reopen execsql { PRAGMA journal_size_limit = 10000; SELECT count(*) FROM sqlite_master; } } -body { execsql { INSERT INTO t1 VALUES(1, 2); } } -test { faultsim_test_result {0 {}} } finish_test |
Changes to test/wal2savepoint.test.
︙ | ︙ | |||
50 51 52 53 54 55 56 57 58 59 60 | ROLLBACK TO abc; WITH s(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM s where i < 10) INSERT INTO t1 SELECT random(), random(), random() FROM s; COMMIT; SELECT count(*) FROM t1; PRAGMA integrity_check; } {210 ok} finish_test | > > > > > > > > > > > > > | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | ROLLBACK TO abc; WITH s(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM s where i < 10) INSERT INTO t1 SELECT random(), random(), random() FROM s; COMMIT; SELECT count(*) FROM t1; PRAGMA integrity_check; } {210 ok} do_execsql_test 1.4 { BEGIN; SAVEPOINT abc; WITH s(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM s where i < 100) INSERT INTO t1 SELECT random(), random(), random() FROM s; ROLLBACK TO abc; WITH s(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM s where i < 10) INSERT INTO t1 SELECT random(), random(), random() FROM s; COMMIT; SELECT count(*) FROM t1; PRAGMA integrity_check; } {220 ok} finish_test |