mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
If recovery is run before a checkpoint, change back to a CHECKPOINT lock before performing the actual checkpoint.
FossilOrigin-Name: dc98ee169cfa43c89f1b36fb1150d4788710fda3
This commit is contained in:
14
manifest
14
manifest
@@ -1,5 +1,5 @@
|
||||
C Only\spass\s-1\sas\sthe\ssize\sparameter\sto\sxShmGet\swhen\sthe\scaller\sdoes\snot\scare\swhat\ssize\smapping\sis\sreturned.\sOnly\scall\sxShmSize\swhen\sthe\sunderlying\sallocation\s(not\sthe\smapping)\sshould\sbe\sresized.
|
||||
D 2010-05-06T18:04:51
|
||||
C If\srecovery\sis\srun\sbefore\sa\scheckpoint,\schange\sback\sto\sa\sCHECKPOINT\slock\sbefore\sperforming\sthe\sactual\scheckpoint.
|
||||
D 2010-05-06T18:27:20
|
||||
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
||||
F Makefile.in a5cad1f8f3e021356bfcc6c77dc16f6f1952bbc3
|
||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
||||
@@ -224,7 +224,7 @@ F src/vdbeblob.c 5327132a42a91e8b7acfb60b9d2c3b1c5c863e0e
|
||||
F src/vdbemem.c 2a82f455f6ca6f78b59fb312f96054c04ae0ead1
|
||||
F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2
|
||||
F src/vtab.c a0f8a40274e4261696ef57aa806de2776ab72cda
|
||||
F src/wal.c 1730243c6491a5b4e325c8977b15fcb9aa4486c6
|
||||
F src/wal.c 0463fb96923211ed9e0bbcaab4493b47cc15f701
|
||||
F src/wal.h b4c42014b5fa3b4e6244ac8c65de7ff67adeb27c
|
||||
F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f
|
||||
F src/where.c 75fee9e255b62f773fcadd1d1f25b6f63ac7a356
|
||||
@@ -762,7 +762,7 @@ F test/vtab_alter.test 9e374885248f69e251bdaacf480b04a197f125e5
|
||||
F test/vtab_err.test 0d4d8eb4def1d053ac7c5050df3024fd47a3fbd8
|
||||
F test/vtab_shared.test 0eff9ce4f19facbe0a3e693f6c14b80711a4222d
|
||||
F test/wal.test f0b78497bbe2e7f3c35a1c28e9772fe0dead1fc8
|
||||
F test/wal2.test 1d5b761f55070e242a983bf08634c79fb46724f2
|
||||
F test/wal2.test 8057c4ee98282d5ef66d3e2c0213420cf8cb38f9
|
||||
F test/walbak.test a0e45187c7d8928df035dfea29b99b016b21ca3c
|
||||
F test/walcrash.test f6d5fb2bb108876f04848720a488065d9deef69f
|
||||
F test/walfault.test ae37204f4375e0e5eba75094d0d0db7148de70a8
|
||||
@@ -813,7 +813,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
||||
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
||||
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
||||
P d0c0034b0baa83046c1d6b94c886f7039e4e06f5
|
||||
R 4a69eca7dd8c02399282e41c5a135767
|
||||
P 637f51ddf9e4a57e1f171b6d2c6c93152074267e
|
||||
R 793e2c795e1969f0da0cad66b2ecc195
|
||||
U dan
|
||||
Z 6b8130cf037212b2a014832ceb2e7bfd
|
||||
Z a7b405881b08330f6ecc62b20d53b83c
|
||||
|
@@ -1 +1 @@
|
||||
637f51ddf9e4a57e1f171b6d2c6c93152074267e
|
||||
dc98ee169cfa43c89f1b36fb1150d4788710fda3
|
@@ -919,6 +919,7 @@ int walIndexTryHdr(Wal *pWal, int *pisValid, int *pChanged){
|
||||
static int walIndexReadHdr(Wal *pWal, int *pChanged){
|
||||
int rc;
|
||||
int isValid = 0;
|
||||
int lockState;
|
||||
|
||||
assert( pWal->lockState>=SQLITE_SHM_READ );
|
||||
assert( pChanged );
|
||||
@@ -939,6 +940,7 @@ static int walIndexReadHdr(Wal *pWal, int *pChanged){
|
||||
** file and try again. If the header checksum verification fails this
|
||||
** time as well, run log recovery.
|
||||
*/
|
||||
lockState = pWal->lockState;
|
||||
if( SQLITE_OK==(rc = walSetLock(pWal, SQLITE_SHM_RECOVER)) ){
|
||||
/* This call to walIndexTryHdr() may not return an error code, as the
|
||||
** wal-index is already mapped. It may find that the header is invalid,
|
||||
@@ -950,7 +952,7 @@ static int walIndexReadHdr(Wal *pWal, int *pChanged){
|
||||
*pChanged = 1;
|
||||
rc = walIndexRecover(pWal);
|
||||
}
|
||||
walSetLock(pWal, SQLITE_SHM_READ);
|
||||
walSetLock(pWal, lockState);
|
||||
}
|
||||
|
||||
return rc;
|
||||
|
@@ -336,4 +336,34 @@ do_test wal2-4.3 {
|
||||
db close
|
||||
tvfs delete
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Test that if a database connection is forced to run recovery before it
|
||||
# can perform a checkpoint, it transistions from RECOVERY->CHECKPOINT
|
||||
# before doing so.
|
||||
#
|
||||
do_test wal2-5.1 {
|
||||
proc tvfs_cb {method args} {
|
||||
set ::shm_file [lindex $args 0]
|
||||
if {$method == "xShmLock"} { lappend ::locks [lindex $args 2] }
|
||||
return $::tvfs_cb_return
|
||||
}
|
||||
set tvfs_cb_return SQLITE_OK
|
||||
|
||||
testvfs tvfs tvfs_cb
|
||||
|
||||
sqlite3 db test.db -vfs tvfs
|
||||
execsql {
|
||||
PRAGMA journal_mode = WAL;
|
||||
CREATE TABLE x(y);
|
||||
INSERT INTO x VALUES(1);
|
||||
}
|
||||
|
||||
incr_tvfs_hdr $::shm_file 1 1
|
||||
set ::locks [list]
|
||||
execsql { PRAGMA wal_checkpoint }
|
||||
set ::locks
|
||||
} {CHECKPOINT RECOVER CHECKPOINT UNLOCK}
|
||||
|
||||
|
||||
|
||||
finish_test
|
||||
|
Reference in New Issue
Block a user