-C In\scases\swhere\sa\sreadonly_shm\sclient\scannot\stake\sthe\sDMS\slock\son\sthe\s*-shm\nfile,\shave\sit\sparse\sthe\swal\sfile\sand\screate\sa\swal-index\sto\saccess\sit\sin\sheap\nmemory.
-D 2017-11-04T18:10:03.528
+C Add\sfurther\stests\sfor\sthe\scode\sadded\son\sthis\sbranch.
+D 2017-11-04T21:06:35.734
F Makefile.in 5bae3f2f3d42f2ad52b141562d74872c97ac0fca6c54953c91bb150a0e6427a8
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc 3a5cb477ec3ce5274663b693164e349db63348667cd45bad78cc13d580b691e2
F src/vdbetrace.c 48e11ebe040c6b41d146abed2602e3d00d621d7ebe4eb29b0a0f1617fd3c2f6c
F src/vtab.c 0e4885495172e1bdf54b12cce23b395ac74ef5729031f15e1bc1e3e6b360ed1a
F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
-F src/wal.c 2b287b5250e89d548c6bbd1d204d0db41046bb3984b9b4a79fc84e22359f1beb
+F src/wal.c 0b3c6b805fc1cf288a7c63b1ac0f78dcc0ad6a54b5b0d72fb0992b16360e7647
F src/wal.h 8de5d2d3de0956d6f6cb48c83a4012d5f227b8fe940f3a349a4b7e85ebcb492a
F src/walker.c d591e8a9ccf60abb010966b354fcea4aa08eba4d83675c2b281a8764c76cc22f
F src/where.c b7a075f5fb3d912a891dcc3257f538372bb4a1622dd8ca7d752ad95ce8949ba4
F test/walpersist.test 8c6b7e3ec1ba91b5e4dc4e0921d6d3f87cd356a6
F test/walprotocol.test 0b92feb132ccebd855494d917d3f6c2d717ace20
F test/walro.test 906586c3ae7a991d8c840ceed92400aee21a0a3e4155ce7c4220399777311552
-F test/walro2.test 611ceebd190edeca9bf39e5068cbc864f15294371b4acf9ee837db477840af54
+F test/walro2.test 811ab176ab8571c59c2aac889fdacc7cff8d7a1ceb083796540c2886620a599f
F test/walshared.test 0befc811dcf0b287efae21612304d15576e35417
F test/walslow.test c05c68d4dc2700a982f89133ce103a1a84cc285f
F test/walthread.test de8dbaf6d9e41481c460ba31ca61e163d7348f8e
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P f569c3517234881f9425075aab65a32ffd0deb8e793f421a241d8cca881da33f
-R 10fc0a1645ce290a2a283e11360fe887
+P 18b268433d739486eac1b04947bd418655e4bc56e8dc63ffa558aa4552a32e30
+R 5345a5078e9be9411c860b392d7c8c77
U dan
-Z 79ea7f3203670e23f752126d91be88fd
+Z 9992407e85299b3993fc8148a1281ba1
-18b268433d739486eac1b04947bd418655e4bc56e8dc63ffa558aa4552a32e30
\ No newline at end of file
+a6716fcde38b28b8a03b40f9d16f78a57ec20f60cf391ff553692641cb7f0d3f
\ No newline at end of file
}
aData = &aFrame[WAL_FRAME_HDRSIZE];
+ /* Check to see if a complete transaction has been appended to the
+ ** wal file since the heap-memory wal-index was created. If so, the
+ ** heap-memory wal-index is discarded and WAL_RETRY returned to
+ ** the caller. */
aSaveCksum[0] = pWal->hdr.aFrameCksum[0];
aSaveCksum[1] = pWal->hdr.aFrameCksum[1];
for(iOffset=walFrameOffset(pWal->hdr.mxFrame+1, pWal->hdr.szPage);
}
if( !walDecodeFrame(pWal, &pgno, &nTruncate, aData, aFrame) ) break;
- /* If nTruncate is non-zero, this is a commit record. */
+ /* If nTruncate is non-zero, then a complete transaction has been
+ ** appended to this wal file. Set rc to WAL_RETRY and break out of
+ ** the loop. */
if( nTruncate ){
rc = WAL_RETRY;
break;
set testdir [file dirname $argv0]
source $testdir/tester.tcl
source $testdir/lock_common.tcl
-set ::testprefix walro
+source $testdir/wal_common.tcl
+set ::testprefix walro2
# These tests are only going to work on unix.
#
code3 { db3 close }
sql1 { COMMIT }
} {}
- breakpoint
do_test 2.3.3 {
sql1 { SELECT * FROM t1 }
} {a b c d e f g h i j}
+
+
+ #-----------------------------------------------------------------------
+ # 3.1.*: That a readonly_shm connection can read a database file if both
+ # the *-wal and *-shm files are zero bytes in size.
+ #
+ # 3.2.*: That it flushes the cache if, between transactions on a db with a
+ # zero byte *-wal file, some other connection modifies the db, then
+ # does "PRAGMA wal_checkpoint=truncate" to truncate the wal file
+ # back to zero bytes in size.
+ #
+ # 3.3.*: That, if between transactions some other process wraps the wal
+ # file, the readonly_shm client reruns recovery.
+ #
+ catch { code1 { db close } }
+ catch { code2 { db2 close } }
+ catch { code3 { db3 close } }
+ do_test 3.1.0 {
+ list [file exists test.db-wal] [file exists test.db-shm]
+ } {0 0}
+ do_test 3.1.1 {
+ close [open test.db-wal w]
+ close [open test.db-shm w]
+ code1 {
+ sqlite3 db file:test.db?readonly_shm=1
+ }
+ sql1 { SELECT * FROM t1 }
+ } {a b c d e f g h}
+
+ do_test 3.2.0 {
+ list [file size test.db-wal] [file size test.db-shm]
+ } {0 0}
+ do_test 3.2.1 {
+ code2 { sqlite3 db2 test.db }
+ sql2 { INSERT INTO t1 VALUES(1, 2) ; PRAGMA wal_checkpoint=truncate }
+ code2 { db2 close }
+ sql1 { SELECT * FROM t1 }
+ } {a b c d e f g h 1 2}
+ do_test 3.2.2 {
+ list [file size test.db-wal] [file size test.db-shm]
+ } {0 32768}
+
+ do_test 3.3.0 {
+ code2 { sqlite3 db2 test.db }
+ sql2 {
+ INSERT INTO t1 VALUES(3, 4);
+ INSERT INTO t1 VALUES(5, 6);
+ INSERT INTO t1 VALUES(7, 8);
+ INSERT INTO t1 VALUES(9, 10);
+ }
+ code2 { db2 close }
+ code1 { db close }
+ list [file size test.db-wal] [file size test.db-shm]
+ } [list [wal_file_size 4 1024] 32768]
+ do_test 3.3.1 {
+ code1 { sqlite3 db file:test.db?readonly_shm=1 }
+ sql1 { SELECT * FROM t1 }
+ } {a b c d e f g h 1 2 3 4 5 6 7 8 9 10}
+ do_test 3.3.2 {
+ code2 { sqlite3 db2 test.db }
+ sql2 {
+ PRAGMA wal_checkpoint;
+ DELETE FROM t1;
+ INSERT INTO t1 VALUES('i', 'ii');
+ }
+ code2 { db2 close }
+ list [file size test.db-wal] [file size test.db-shm]
+ } [list [wal_file_size 4 1024] 32768]
+ do_test 3.3.3 {
+ sql1 { SELECT * FROM t1 }
+ } {i ii}
+
}
finish_test