Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Do not fail a checkpoint just because active readers prevent backfill. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | wal-incr-ckpt |
Files: | files | file ages | folders |
SHA1: |
9aa4243e0cedcc9204994d04af1b2b7a |
User & Date: | drh 2010-05-31 12:30:52.000 |
Context
2010-05-31
| ||
13:11 | Change WAL test cases to account for the improved concurrency in the new checkpoint logic. (check-in: 2d6f248505 user: drh tags: wal-incr-ckpt) | |
12:30 | Do not fail a checkpoint just because active readers prevent backfill. (check-in: 9aa4243e0c user: drh tags: wal-incr-ckpt) | |
12:15 | Add WALTRACE() macros to help with debugging and analysis. (check-in: 765c33181a user: drh tags: wal-incr-ckpt) | |
Changes
Changes to src/wal.c.
︙ | ︙ | |||
1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 | rc = sqlite3OsSync(pWal->pDbFd, sync_flags); } } } /* Release the reader lock held while backfilling */ walUnlockExclusive(pWal, WAL_READ_LOCK(0), 1); } walIteratorFree(pIter); return rc; } /* | > > > > > | 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 | rc = sqlite3OsSync(pWal->pDbFd, sync_flags); } } } /* Release the reader lock held while backfilling */ walUnlockExclusive(pWal, WAL_READ_LOCK(0), 1); }else{ /* Reset the return code so as not to report a checkpoint failure ** just because active readers prevent any backfill. */ rc = SQLITE_OK; } walIteratorFree(pIter); return rc; } /* |
︙ | ︙ |
Changes to test/wal.test.
︙ | ︙ | |||
567 568 569 570 571 572 573 | # checkpointing the database. But not from writing to it. # do_test wal-10.$tn.11 { sql2 { BEGIN; SELECT * FROM t1 } } {1 2 3 4 5 6 7 8 9 10} do_test wal-10.$tn.12 { catchsql { PRAGMA wal_checkpoint } | | < < < | < < < < < < | | < | | 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 | # checkpointing the database. But not from writing to it. # do_test wal-10.$tn.11 { sql2 { BEGIN; SELECT * FROM t1 } } {1 2 3 4 5 6 7 8 9 10} do_test wal-10.$tn.12 { catchsql { PRAGMA wal_checkpoint } } {0 {}} ;# Reader no longer block checkpoints do_test wal-10.$tn.13 { execsql { INSERT INTO t1 VALUES(11, 12) } sql2 {SELECT * FROM t1} } {1 2 3 4 5 6 7 8 9 10} # Writers do not block checkpoints any more either. # do_test wal-10.$tn.14 { catchsql { PRAGMA wal_checkpoint } } {0 {}} # Similar to the test above. Except this time, a new read transaction is # started (db3) while the checkpointer is waiting for an old one (db2) to # finish. The checkpointer can finish, but any subsequent write operations # must wait until after db3 has closed the read transaction, as db3 is a # "region D" writer. # do_test wal-10.$tn.15 { sql2 { COMMIT; BEGIN; SELECT * FROM t1; } } {1 2 3 4 5 6 7 8 9 10 11 12} do_test wal-10.$tn.16 { catchsql { PRAGMA wal_checkpoint } } {1 {database is locked}} proc busyhandler x { if {$x==3} { sql3 { BEGIN; SELECT * FROM t1 } } if {$x==4} { sql2 COMMIT } |
︙ | ︙ |