In synchronous=normal mode, do not sync the log after every transaction. In synchronous=full mode, sync the log and add any extra frames required to avoid blast-radius related problems after each transaction.
FossilOrigin-Name: 9bc9b6847303d0324543a9ded8dd0473490122d8
This commit is contained in:
parent
3de777fd8c
commit
6703239d2f
16
manifest
16
manifest
@ -1,5 +1,5 @@
|
||||
C Enhancements\sto\swal-mode\slocking\sscheme.
|
||||
D 2010-04-17T12:31:37
|
||||
C In\ssynchronous=normal\smode,\sdo\snot\ssync\sthe\slog\safter\severy\stransaction.\sIn\ssynchronous=full\smode,\ssync\sthe\slog\sand\sadd\sany\sextra\sframes\srequired\sto\savoid\sblast-radius\srelated\sproblems\safter\seach\stransaction.
|
||||
D 2010-04-17T15:42:43
|
||||
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
||||
F Makefile.in 4f2f967b7e58a35bb74fb7ec8ae90e0f4ca7868b
|
||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
||||
@ -131,7 +131,7 @@ F src/journal.c b0ea6b70b532961118ab70301c00a33089f9315c
|
||||
F src/legacy.c a199d7683d60cef73089e892409113e69c23a99f
|
||||
F src/lempar.c 7f026423f4d71d989e719a743f98a1cbd4e6d99e
|
||||
F src/loadext.c 1c7a61ce1281041f437333f366a96aa0d29bb581
|
||||
F src/log.c 6ac96c84ca4564f156de564ceddb3c1a2319ac6e
|
||||
F src/log.c a72baea84cecef9a4e45308b1504e6fe69c8284e
|
||||
F src/log.h a2654af46ce7b5732f4d5a731abfdd180f0a06d9
|
||||
F src/main.c c0e7192bad5b90544508b241eb2487ac661de890
|
||||
F src/malloc.c a08f16d134f0bfab6b20c3cd142ebf3e58235a6a
|
||||
@ -154,7 +154,7 @@ F src/os_common.h 240c88b163b02c21a9f21f87d49678a0aa21ff30
|
||||
F src/os_os2.c 75a8c7b9a00a2cf1a65f9fa4afbc27d46634bb2f
|
||||
F src/os_unix.c 5bf0015cebe2f21635da2af983c348eb88b3b4c1
|
||||
F src/os_win.c 1c7453c2df4dab26d90ff6f91272aea18bcf7053
|
||||
F src/pager.c 674d6558a618ca7714ba28741e6dc681692bffe2
|
||||
F src/pager.c 751ada65b9a4aa0b31c36ffa3f6548200a55ca16
|
||||
F src/pager.h ce5d076f3860a5f2d7460c582cd68383343b33cf
|
||||
F src/parse.y ace5c7a125d9f2a410e431ee3209034105045f7e
|
||||
F src/pcache.c ace8f6a5ecd4711cc66a1b23053be7109bd437cf
|
||||
@ -757,7 +757,7 @@ F test/vtabE.test 7c4693638d7797ce2eda17af74292b97e705cc61
|
||||
F test/vtab_alter.test 9e374885248f69e251bdaacf480b04a197f125e5
|
||||
F test/vtab_err.test 0d4d8eb4def1d053ac7c5050df3024fd47a3fbd8
|
||||
F test/vtab_shared.test 0eff9ce4f19facbe0a3e693f6c14b80711a4222d
|
||||
F test/wal.test 5fa3cdf2e93e79b0891af6cf7fab8ef9e07a23c6
|
||||
F test/wal.test a56ff378f58b145fd3bf38c277fbfe792cd47bdd
|
||||
F test/walcrash.test 45cfbab30bb7cbe0b2e9d5cabe90dbcad10cb89b
|
||||
F test/walslow.test 38076d5fad49e3678027be0f8110e6a32d531dc2
|
||||
F test/walthread.test 27e44ee6fd02f1f494a24f999c97086af3ab739d
|
||||
@ -804,7 +804,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
||||
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
||||
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
||||
P 9865d14d6041874bc1239ce7a061d5c75f2d33c9
|
||||
R f6bb150cf1f3c0e2bfeac5bd76d233a7
|
||||
P 8549c286497f3d2cd118be1334fce00d6f8a26c4
|
||||
R 6ac8dd31103bf297ef819af9a9f02a12
|
||||
U dan
|
||||
Z ea6a1c06d626e2f5d8edb2ab802e8ea3
|
||||
Z 35f390be152b1baf460a096be51e37de
|
||||
|
@ -1 +1 @@
|
||||
8549c286497f3d2cd118be1334fce00d6f8a26c4
|
||||
9bc9b6847303d0324543a9ded8dd0473490122d8
|
@ -881,7 +881,7 @@ int sqlite3LogOpen(
|
||||
zWal = sqlite3_mprintf("%s-wal", zDb);
|
||||
if( !zWal ) goto out;
|
||||
logNormalizePath(zWal);
|
||||
flags = (SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|SQLITE_OPEN_MAIN_DB);
|
||||
flags = (SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|SQLITE_OPEN_MAIN_JOURNAL);
|
||||
nWal = sqlite3Strlen30(zWal);
|
||||
|
||||
/* Enter the mutex that protects the linked-list of LogSummary structures */
|
||||
@ -1545,9 +1545,10 @@ int sqlite3LogFrames(
|
||||
|
||||
/* Sync the log file if the 'isSync' flag was specified. */
|
||||
if( isSync ){
|
||||
#if 0
|
||||
i64 iSegment = sqlite3OsSectorSize(pLog->pFd);
|
||||
i64 iOffset = iFrame * (nPgsz+sizeof(aFrame));
|
||||
i64 iOffset = logFrameOffset(iFrame+1, nPgsz);
|
||||
|
||||
assert( isCommit );
|
||||
|
||||
if( iSegment<SQLITE_DEFAULT_SECTOR_SIZE ){
|
||||
iSegment = SQLITE_DEFAULT_SECTOR_SIZE;
|
||||
@ -1568,7 +1569,6 @@ int sqlite3LogFrames(
|
||||
nLast++;
|
||||
iOffset += nPgsz;
|
||||
}
|
||||
#endif
|
||||
|
||||
rc = sqlite3OsSync(pLog->pFd, pLog->sync_flags);
|
||||
if( rc!=SQLITE_OK ){
|
||||
|
@ -3764,6 +3764,7 @@ static int pagerOpenLog(Pager *pPager){
|
||||
sqlite3OsFileControl(pPager->fd, SQLITE_FCNTL_LOCKSTATE, &locktype);
|
||||
assert( locktype==SQLITE_LOCK_SHARED );
|
||||
#endif
|
||||
pPager->state = PAGER_SHARED;
|
||||
}
|
||||
|
||||
return SQLITE_OK;
|
||||
@ -4880,7 +4881,7 @@ int sqlite3PagerCommitPhaseOne(
|
||||
PgHdr *pList = sqlite3PcacheDirtyList(pPager->pPCache);
|
||||
if( pList ){
|
||||
rc = sqlite3LogFrames(pPager->pLog, pPager->pageSize, pList,
|
||||
pPager->dbSize, 1, 1
|
||||
pPager->dbSize, 1, pPager->fullSync
|
||||
);
|
||||
}
|
||||
sqlite3PcacheCleanAll(pPager->pPCache);
|
||||
|
@ -23,9 +23,17 @@ proc reopen_db {} {
|
||||
sqlite3_wal db test.db
|
||||
}
|
||||
|
||||
set ::blobcnt 0
|
||||
proc blob {nByte} {
|
||||
incr ::blobcnt
|
||||
return [string range [string repeat "${::blobcnt}x" $nByte] 1 $nByte]
|
||||
}
|
||||
|
||||
proc sqlite3_wal {args} {
|
||||
eval sqlite3 $args
|
||||
[lindex $args 0] eval { PRAGMA journal_mode = wal }
|
||||
[lindex $args 0] eval { PRAGMA synchronous = normal }
|
||||
[lindex $args 0] function blob blob
|
||||
}
|
||||
|
||||
proc log_file_size {nFrame pgsz} {
|
||||
@ -49,6 +57,7 @@ proc log_deleted {logfile} {
|
||||
#
|
||||
|
||||
do_test wal-0.1 {
|
||||
execsql { PRAGMA synchronous = normal }
|
||||
execsql { PRAGMA journal_mode = wal }
|
||||
} {wal}
|
||||
|
||||
@ -235,13 +244,13 @@ do_test wal-8.2 {
|
||||
execsql {
|
||||
PRAGMA page_size = 1024;
|
||||
CREATE TABLE t1(x);
|
||||
INSERT INTO t1 VALUES(randomblob(900));
|
||||
INSERT INTO t1 VALUES(randomblob(900));
|
||||
INSERT INTO t1 SELECT randomblob(900) FROM t1; /* 4 */
|
||||
INSERT INTO t1 SELECT randomblob(900) FROM t1; /* 8 */
|
||||
INSERT INTO t1 SELECT randomblob(900) FROM t1; /* 16 */
|
||||
INSERT INTO t1 SELECT randomblob(900) FROM t1; /* 32 */
|
||||
INSERT INTO t1 SELECT randomblob(900) FROM t1; /* 64 */
|
||||
INSERT INTO t1 VALUES(blob(900));
|
||||
INSERT INTO t1 VALUES(blob(900));
|
||||
INSERT INTO t1 SELECT blob(900) FROM t1; /* 4 */
|
||||
INSERT INTO t1 SELECT blob(900) FROM t1; /* 8 */
|
||||
INSERT INTO t1 SELECT blob(900) FROM t1; /* 16 */
|
||||
INSERT INTO t1 SELECT blob(900) FROM t1; /* 32 */
|
||||
INSERT INTO t1 SELECT blob(900) FROM t1; /* 64 */
|
||||
PRAGMA checkpoint;
|
||||
}
|
||||
file size test.db
|
||||
@ -262,15 +271,15 @@ do_test wal-9.1 {
|
||||
execsql {
|
||||
PRAGMA page_size = 1024;
|
||||
CREATE TABLE t1(x PRIMARY KEY);
|
||||
INSERT INTO t1 VALUES(randomblob(900));
|
||||
INSERT INTO t1 VALUES(randomblob(900));
|
||||
INSERT INTO t1 SELECT randomblob(900) FROM t1; /* 4 */
|
||||
INSERT INTO t1 SELECT randomblob(900) FROM t1; /* 8 */
|
||||
INSERT INTO t1 SELECT randomblob(900) FROM t1; /* 16 */
|
||||
INSERT INTO t1 SELECT randomblob(900) FROM t1; /* 32 */
|
||||
INSERT INTO t1 SELECT randomblob(900) FROM t1; /* 64 */
|
||||
INSERT INTO t1 SELECT randomblob(900) FROM t1; /* 128 */
|
||||
INSERT INTO t1 SELECT randomblob(900) FROM t1; /* 256 */
|
||||
INSERT INTO t1 VALUES(blob(900));
|
||||
INSERT INTO t1 VALUES(blob(900));
|
||||
INSERT INTO t1 SELECT blob(900) FROM t1; /* 4 */
|
||||
INSERT INTO t1 SELECT blob(900) FROM t1; /* 8 */
|
||||
INSERT INTO t1 SELECT blob(900) FROM t1; /* 16 */
|
||||
INSERT INTO t1 SELECT blob(900) FROM t1; /* 32 */
|
||||
INSERT INTO t1 SELECT blob(900) FROM t1; /* 64 */
|
||||
INSERT INTO t1 SELECT blob(900) FROM t1; /* 128 */
|
||||
INSERT INTO t1 SELECT blob(900) FROM t1; /* 256 */
|
||||
}
|
||||
file size test.db
|
||||
} 0
|
||||
@ -557,20 +566,20 @@ do_test wal-11.2 {
|
||||
list [expr [file size test.db]/1024] [file size test.db-wal]
|
||||
} [list 3 [log_file_size 3 1024]]
|
||||
do_test wal-11.3 {
|
||||
execsql { INSERT INTO t1 VALUES( randomblob(900) ) }
|
||||
execsql { INSERT INTO t1 VALUES( blob(900) ) }
|
||||
list [expr [file size test.db]/1024] [file size test.db-wal]
|
||||
} [list 3 [log_file_size 4 1024]]
|
||||
|
||||
do_test wal-11.4 {
|
||||
execsql {
|
||||
BEGIN;
|
||||
INSERT INTO t1 SELECT randomblob(900) FROM t1; -- 2
|
||||
INSERT INTO t1 SELECT randomblob(900) FROM t1; -- 4
|
||||
INSERT INTO t1 SELECT randomblob(900) FROM t1; -- 8
|
||||
INSERT INTO t1 SELECT randomblob(900) FROM t1; -- 16
|
||||
INSERT INTO t1 SELECT blob(900) FROM t1; -- 2
|
||||
INSERT INTO t1 SELECT blob(900) FROM t1; -- 4
|
||||
INSERT INTO t1 SELECT blob(900) FROM t1; -- 8
|
||||
INSERT INTO t1 SELECT blob(900) FROM t1; -- 16
|
||||
}
|
||||
list [expr [file size test.db]/1024] [file size test.db-wal]
|
||||
} [list 3 [log_file_size 33 1024]]
|
||||
} [list 3 [log_file_size 32 1024]]
|
||||
do_test wal-11.5 {
|
||||
execsql {
|
||||
SELECT count(*) FROM t1;
|
||||
@ -580,7 +589,7 @@ do_test wal-11.5 {
|
||||
do_test wal-11.6 {
|
||||
execsql COMMIT
|
||||
list [expr [file size test.db]/1024] [file size test.db-wal]
|
||||
} [list 3 [log_file_size 42 1024]]
|
||||
} [list 3 [log_file_size 41 1024]]
|
||||
do_test wal-11.7 {
|
||||
execsql {
|
||||
SELECT count(*) FROM t1;
|
||||
@ -590,22 +599,21 @@ do_test wal-11.7 {
|
||||
do_test wal-11.8 {
|
||||
execsql { PRAGMA checkpoint }
|
||||
list [expr [file size test.db]/1024] [file size test.db-wal]
|
||||
} [list 37 [log_file_size 42 1024]]
|
||||
} [list 37 [log_file_size 41 1024]]
|
||||
do_test wal-11.9 {
|
||||
db close
|
||||
sqlite3_wal db test.db
|
||||
list [expr [file size test.db]/1024] [log_deleted test.db-wal]
|
||||
} {37 1}
|
||||
|
||||
sqlite3_wal db test.db
|
||||
do_test wal-11.10 {
|
||||
execsql {
|
||||
PRAGMA cache_size = 10;
|
||||
BEGIN;
|
||||
INSERT INTO t1 SELECT randomblob(900) FROM t1; -- 32
|
||||
INSERT INTO t1 SELECT blob(900) FROM t1; -- 32
|
||||
SELECT count(*) FROM t1;
|
||||
}
|
||||
list [expr [file size test.db]/1024] [file size test.db-wal]
|
||||
} [list 37 [log_file_size 40 1024]]
|
||||
} [list 37 [log_file_size 35 1024]]
|
||||
do_test wal-11.11 {
|
||||
execsql {
|
||||
SELECT count(*) FROM t1;
|
||||
@ -615,17 +623,17 @@ do_test wal-11.11 {
|
||||
} {32 16}
|
||||
do_test wal-11.12 {
|
||||
list [expr [file size test.db]/1024] [file size test.db-wal]
|
||||
} [list 37 [log_file_size 40 1024]]
|
||||
} [list 37 [log_file_size 35 1024]]
|
||||
do_test wal-11.13 {
|
||||
execsql {
|
||||
INSERT INTO t1 VALUES( randomblob(900) );
|
||||
INSERT INTO t1 VALUES( blob(900) );
|
||||
SELECT count(*) FROM t1;
|
||||
PRAGMA integrity_check;
|
||||
}
|
||||
} {17 ok}
|
||||
do_test wal-11.14 {
|
||||
list [expr [file size test.db]/1024] [file size test.db-wal]
|
||||
} [list 37 [log_file_size 40 1024]]
|
||||
} [list 37 [log_file_size 35 1024]]
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user