-C Add\sfurther\stests\sfor\sthe\scode\sadded\son\sthis\sbranch.
-D 2017-11-04T21:06:35.734
+C Add\sfurther\stest\scases\sfor\sthe\snew\scode\son\sthis\sbranch.\sAnd\sa\scouple\sof\sfixes.
+D 2017-11-06T19:49:34.916
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 0b3c6b805fc1cf288a7c63b1ac0f78dcc0ad6a54b5b0d72fb0992b16360e7647
+F src/wal.c 32ee6550804a27c155bdeeddd9bf9bc6ca5331a901c763105bccd0b408049d20
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 811ab176ab8571c59c2aac889fdacc7cff8d7a1ceb083796540c2886620a599f
+F test/walro2.test 2f0f662f880580d6ecadda9d7cc647d90b1f9e0fb1d487c2a723bcea07eb17dd
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 18b268433d739486eac1b04947bd418655e4bc56e8dc63ffa558aa4552a32e30
-R 5345a5078e9be9411c860b392d7c8c77
+P a6716fcde38b28b8a03b40f9d16f78a57ec20f60cf391ff553692641cb7f0d3f
+R fb9f39269dd42d0221893523e00b9010
U dan
-Z 9992407e85299b3993fc8148a1281ba1
+Z ae1d97ffe1b3072414f0d45a94e66fe3
-a6716fcde38b28b8a03b40f9d16f78a57ec20f60cf391ff553692641cb7f0d3f
\ No newline at end of file
+71af9acb227a91d9ad8798c9d0b12d6967e863d050f5cb1fddb45f25ee1f47db
\ No newline at end of file
** from running recovery. */
rc = walLockShared(pWal, WAL_READ_LOCK(0));
if( rc!=SQLITE_OK ){
- return (rc==SQLITE_BUSY ? WAL_RETRY : rc);
+ if( rc==SQLITE_BUSY ) rc = WAL_RETRY;
+ goto begin_unlocked_out;
}
pWal->readLock = 0;
memcpy(&pWal->hdr, (void*)walIndexHdr(pWal), sizeof(WalIndexHdr));
rc = sqlite3OsFileSize(pWal->pWalFd, &szWal);
- if( rc!=SQLITE_OK || (szWal<WAL_HDRSIZE && pWal->hdr.mxFrame==0) ){
+ if( rc!=SQLITE_OK ){
+ goto begin_unlocked_out;
+ }
+ if( szWal<WAL_HDRSIZE ){
/* If the wal file is too small to contain a wal-header and the
** wal-index header has mxFrame==0, then it must be safe to proceed
** reading the database file only. However, the page cache cannot
** the db, run a checkpoint, truncated the wal file and disconnected
** since this client's last read transaction. */
*pChanged = 1;
+ rc = (pWal->hdr.mxFrame==0 ? SQLITE_OK : WAL_RETRY);
goto begin_unlocked_out;
}
/* Read and decode the next log frame. */
rc = sqlite3OsRead(pWal->pWalFd, aFrame, szFrame, iOffset);
- if( rc!=SQLITE_OK ){
- if( rc==SQLITE_IOERR_SHORT_READ ){
- /* If this branch is taken, some other client has truncated the
- ** *-wal file since the call to sqlite3OsFileSize() above. This
- ** indicates that a read-write client has connected to the system.
- ** So retry opening this read transaction. */
- rc = WAL_RETRY;
- }
- break;
- }
+ if( rc!=SQLITE_OK ) break;
if( !walDecodeFrame(pWal, &pgno, &nTruncate, aData, aFrame) ) break;
/* If nTruncate is non-zero, then a complete transaction has been
sql1 { SELECT * FROM t1 }
} {i ii}
+ #-----------------------------------------------------------------------
+ #
+ #
+ catch { code1 { db close } }
+ catch { code2 { db2 close } }
+ catch { code3 { db3 close } }
+
+ do_test 4.0 {
+ code1 { forcedelete test.db }
+ code1 { sqlite3 db test.db }
+ sql1 {
+ PRAGMA journal_mode = wal;
+ CREATE TABLE t1(x);
+ INSERT INTO t1 VALUES('hello');
+ INSERT INTO t1 VALUES('world');
+ }
+
+ forcecopy test.db test.db2
+ forcecopy test.db-wal test.db2-wal
+ forcecopy test.db-shm test.db2-shm
+
+ code1 { db close }
+ } {}
+
+ do_test 4.1.1 {
+ code2 { sqlite3 db2 file:test.db2?readonly_shm=1 }
+ sql2 { SELECT * FROM t1 }
+ } {hello world}
+
+ do_test 4.1.2 {
+ code3 { sqlite3 db3 test.db2 }
+ sql3 {
+ INSERT INTO t1 VALUES('!');
+ PRAGMA wal_checkpoint = truncate;
+ }
+ code3 { db3 close }
+ } {}
+ do_test 4.1.3 {
+ sql2 { SELECT * FROM t1 }
+ } {hello world !}
+
+ catch { code1 { db close } }
+ catch { code2 { db2 close } }
+ catch { code3 { db3 close } }
+
+ do_test 4.2.1 {
+ code1 { sqlite3 db test.db }
+ sql1 {
+ INSERT INTO t1 VALUES('!');
+ INSERT INTO t1 VALUES('!');
+
+ PRAGMA cache_size = 10;
+ CREATE TABLE t2(x);
+
+ BEGIN;
+ WITH s(i) AS (
+ SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<500
+ )
+ INSERT INTO t2 SELECT randomblob(500) FROM s;
+ SELECT count(*) FROM t2;
+ }
+ } {500}
+ do_test 4.2.2 {
+ file size test.db-wal
+ } {461152}
+ do_test 4.2.4 {
+ forcecopy test.db test.db2
+ forcecopy test.db-wal test.db2-wal
+ forcecopy test.db-shm test.db2-shm
+
+ code2 { sqlite3 db2 file:test.db2?readonly_shm=1 }
+ sql2 {
+ SELECT * FROM t1;
+ SELECT count(*) FROM t2;
+ }
+ } {hello world ! ! 0}
+
+ #-----------------------------------------------------------------------
+ #
+ #
+ catch { code1 { db close } }
+ catch { code2 { db2 close } }
+ catch { code3 { db3 close } }
+
+ do_test 5.0 {
+ code1 { forcedelete test.db }
+ code1 { sqlite3 db test.db }
+ sql1 {
+ PRAGMA journal_mode = wal;
+ CREATE TABLE t1(x);
+ INSERT INTO t1 VALUES('hello');
+ INSERT INTO t1 VALUES('world');
+ INSERT INTO t1 VALUES('!');
+ INSERT INTO t1 VALUES('world');
+ INSERT INTO t1 VALUES('hello');
+ }
+
+ forcecopy test.db test.db2
+ forcecopy test.db-wal test.db2-wal
+ forcecopy test.db-shm test.db2-shm
+
+ code1 { db close }
+ } {}
+
+ do_test 5.1 {
+ code2 { sqlite3 db2 file:test.db2?readonly_shm=1 }
+ sql2 {
+ SELECT * FROM t1;
+ }
+ } {hello world ! world hello}
+
+ do_test 5.2 {
+ code1 {
+ proc handle_read {op args} {
+ if {$op=="xRead" && [file tail [lindex $args 0]]=="test.db2-wal"} {
+ set ::res2 [sql2 { SELECT * FROM t1 }]
+ }
+ puts "$msg xRead $args"
+ return "SQLITE_OK"
+ }
+ testvfs tvfs -fullshm 1
+
+ sqlite3 db file:test.db2?vfs=tvfs
+ db eval { SELECT * FROM sqlite_master }
+
+ tvfs filter xRead
+ tvfs script handle_read
+ }
+ sql1 {
+ PRAGMA wal_checkpoint = truncate;
+ }
+ code1 { set ::res2 }
+ } {hello world ! world hello}
+
+ do_test 5.3 {
+ code1 { db close }
+ code1 { tvfs delete }
+ } {}
+
+
}
finish_test