Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Correct an off-by-one bug in the previous commit. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
75a1130d86faf18e73cb46cda5d029f1 |
User & Date: | dan 2010-05-21 16:23:44.000 |
Context
2010-05-21
| ||
18:24 | Comment out the SQLITE_FCNTL_SIZE_HINT from os_unix.c since it does not seem to provide any performance gain there. (check-in: 7d01309da6 user: drh tags: trunk) | |
16:23 | Correct an off-by-one bug in the previous commit. (check-in: 75a1130d86 user: dan tags: trunk) | |
15:31 | Remove entries from wal-index hash tables when a rollback or savepoint rollback occurs. (check-in: 36795c2b23 user: dan tags: trunk) | |
Changes
Changes to src/wal.c.
︙ | ︙ | |||
1487 1488 1489 1490 1491 1492 1493 | u32 iZero; /* frame == (aHash[x]+iZero) */ int iLimit; /* Zero values greater than this */ walHashFind(pWal, iNewMx+1, &aHash, &unused1, &iZero); iLimit = iNewMx - iZero; if( iLimit>0 ){ int i; /* Used to iterate through aHash[] */ | | | 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 | u32 iZero; /* frame == (aHash[x]+iZero) */ int iLimit; /* Zero values greater than this */ walHashFind(pWal, iNewMx+1, &aHash, &unused1, &iZero); iLimit = iNewMx - iZero; if( iLimit>0 ){ int i; /* Used to iterate through aHash[] */ for(i=0; i<HASHTABLE_NPAGE; i++){ if( aHash[i]>iLimit ){ aHash[i] = 0; } } } } } |
︙ | ︙ |
Changes to test/wal2.test.
︙ | ︙ | |||
111 112 113 114 115 116 117 | } } if {$method == "xShmLock"} { lappend ::locks [lindex $args 2] } return SQLITE_OK } | < | 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | } } if {$method == "xShmLock"} { lappend ::locks [lindex $args 2] } return SQLITE_OK } execsql { SELECT count(a), sum(a) FROM t1 } db2 } $res do_test wal2-1.$tn.2 { set ::locks } $wal_locks } |
︙ | ︙ | |||
601 602 603 604 605 606 607 608 609 610 611 612 613 614 | execsql { PRAGMA wal_checkpoint } } {} db close #------------------------------------------------------------------------- # Test a theory about the checksum algorithm. Theory was false and this # test did not provoke a bug. file delete -force test.db test.db-wal test.db-journal do_test wal2-7.1.1 { sqlite3 db test.db execsql { PRAGMA page_size = 4096; PRAGMA journal_mode = WAL; CREATE TABLE t1(a, b); | > | 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 | execsql { PRAGMA wal_checkpoint } } {} db close #------------------------------------------------------------------------- # Test a theory about the checksum algorithm. Theory was false and this # test did not provoke a bug. # file delete -force test.db test.db-wal test.db-journal do_test wal2-7.1.1 { sqlite3 db test.db execsql { PRAGMA page_size = 4096; PRAGMA journal_mode = WAL; CREATE TABLE t1(a, b); |
︙ | ︙ | |||
622 623 624 625 626 627 628 629 630 631 | } {1} do_test wal2-7.1.3 { sqlite3 db2 test2.db execsql { PRAGMA wal_checkpoint } db2 execsql { SELECT * FROM sqlite_master } db2 } {} db2 close finish_test | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 | } {1} do_test wal2-7.1.3 { sqlite3 db2 test2.db execsql { PRAGMA wal_checkpoint } db2 execsql { SELECT * FROM sqlite_master } db2 } {} db2 close file delete -force test.db test.db-wal test.db-journal do_test wal2-8.1.2 { sqlite3 db test.db execsql { PRAGMA page_size = 1024; PRAGMA journal_mode = WAL; CREATE TABLE t1(x); INSERT INTO t1 VALUES(zeroblob(8188*1020)); CREATE TABLE t2(y); } execsql { PRAGMA wal_checkpoint; SELECT rootpage FROM sqlite_master WHERE tbl_name = 't2'; } } {8192} do_test wal2-8.1.3 { execsql { PRAGMA cache_size = 10; CREATE TABLE t3(z); BEGIN; INSERT INTO t3 VALUES(randomblob(900)); INSERT INTO t3 SELECT randomblob(900) FROM t3; INSERT INTO t2 VALUES('hello'); INSERT INTO t3 SELECT randomblob(900) FROM t3; INSERT INTO t3 SELECT randomblob(900) FROM t3; INSERT INTO t3 SELECT randomblob(900) FROM t3; INSERT INTO t3 SELECT randomblob(900) FROM t3; INSERT INTO t3 SELECT randomblob(900) FROM t3; INSERT INTO t3 SELECT randomblob(900) FROM t3; ROLLBACK; } execsql { INSERT INTO t2 VALUES('goodbye'); INSERT INTO t3 SELECT randomblob(900) FROM t3; INSERT INTO t3 SELECT randomblob(900) FROM t3; } } {} do_test wal2-8.1.4 { sqlite3 db2 test.db execsql { SELECT * FROM t2 } } {goodbye} db2 close finish_test |
Changes to test/walfault.test.
︙ | ︙ | |||
233 234 235 236 237 238 239 | unset ::shmfault_ioerr_methods(xShmGet) if {[file exists test.db-wal]==0} {error "Failed to create WAL file!"} sqlite3 db test.db -vfs shmfault } -sqlbody { SELECT count(*) FROM t1; } | | > > > > > > > > > > > > > > > > | 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | unset ::shmfault_ioerr_methods(xShmGet) if {[file exists test.db-wal]==0} {error "Failed to create WAL file!"} sqlite3 db test.db -vfs shmfault } -sqlbody { SELECT count(*) FROM t1; } do_shmfault_test walfault-shm-5.1 -coverageonly 1 -sqlprep { PRAGMA cache_size = 10; PRAGMA journal_mode = WAL; CREATE TABLE abc(a PRIMARY KEY); INSERT INTO abc VALUES(randomblob(900)); } -sqlbody { BEGIN; INSERT INTO abc SELECT randomblob(900) FROM abc; /* 1 */ INSERT INTO abc SELECT randomblob(900) FROM abc; /* 2 */ INSERT INTO abc SELECT randomblob(900) FROM abc; /* 4 */ INSERT INTO abc SELECT randomblob(900) FROM abc; /* 8 */ ROLLBACK; } do_shmfault_test walfault-shm-5.2 -coverageonly 1 -sqlprep { PRAGMA cache_size = 10; PRAGMA journal_mode = WAL; CREATE TABLE abc(a PRIMARY KEY); INSERT INTO abc VALUES(randomblob(900)); } -sqlbody { BEGIN; INSERT INTO abc SELECT randomblob(900) FROM abc; /* 1 */ SAVEPOINT spoint; INSERT INTO abc SELECT randomblob(900) FROM abc; /* 2 */ INSERT INTO abc SELECT randomblob(900) FROM abc; /* 4 */ INSERT INTO abc SELECT randomblob(900) FROM abc; /* 8 */ ROLLBACK TO spoint; COMMIT; } #------------------------------------------------------------------------- # When a database is checkpointed, SQLite does the following: # # 1. xShmLock(CHECKPOINT) to lock the WAL. # 2. xShmGet(-1) to get a mapping to read the wal-index header. # 3. If the mapping obtained in (2) is not large enough to cover the |
︙ | ︙ |