]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
All WAL frame overwrites even if there are active savepoints. This is safe
authordrh <drh@noemail.net>
Sat, 9 Jan 2016 23:55:47 +0000 (23:55 +0000)
committerdrh <drh@noemail.net>
Sat, 9 Jan 2016 23:55:47 +0000 (23:55 +0000)
because a ROLLBACK TO will cause all reverted pages to be rewritten to the
WAL file prior to COMMIT.

FossilOrigin-Name: 99b31a6b491c1c51227f478d3713b020d37a17cf

manifest
manifest.uuid
src/pager.c
src/pager.h
src/wal.c
test/wal.test

index 0d9cd208915490ee5430d86f0f19aba3d4ec41de..fad33f874f648e110b4e8893cbe0094cc0484f11 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C If\sit\sis\sknown\sthat\schecksums\swill\sbe\srecalculated\son\stransaction\scommit,\sskip\scalculating\schecksums\swhen\sappending\sframes\sto\sthe\swal\sfile.\sWhen\srecalculating\schecksums,\srecalculate\sthem\sstarting\swith\sthe\sfirst\soverwritten\sframe\s-\snot\sthe\sfirst\sframe\sin\sthe\stransaction.
-D 2016-01-09T18:57:35.280
+C All\sWAL\sframe\soverwrites\seven\sif\sthere\sare\sactive\ssavepoints.\s\sThis\sis\ssafe\nbecause\sa\sROLLBACK\sTO\swill\scause\sall\sreverted\spages\sto\sbe\srewritten\sto\sthe\nWAL\sfile\sprior\sto\sCOMMIT.
+D 2016-01-09T23:55:47.044
 F Makefile.in 7c8cc4c2f0179efc6fa9492141d1fb65f4807054
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 F Makefile.msc e45d8b9b56dfa3f2cd860b2c28bd9d304513b042
@@ -320,8 +320,8 @@ F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa
 F src/os_unix.c 82986e1e75782b54da7822dca42d36d974fc2948
 F src/os_win.c 386fba30419e8458b13209781c2af5590eab2811
 F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca
-F src/pager.c c241cace996e19248ddc60f4b8c2e654177e4d3b
-F src/pager.h bbbfe27618ac2df8aba22ee0dace08f013351c40
+F src/pager.c 58d2593612acb6b542de6715b4af397ea1fa0a35
+F src/pager.h bf25005b4656cd805af43487c3139fca9678d0cc
 F src/parse.y caad1e98edeca6960493d0c60d31b76820dd7776
 F src/pcache.c 73895411fa6b7bd6f0091212feabbe833b358d23
 F src/pcache.h 4d0ccaad264d360981ec5e6a2b596d6e85242545
@@ -409,7 +409,7 @@ F src/vdbesort.c a7ec02da4494c59dfd071126dd3726be5a11459d
 F src/vdbetrace.c 8befe829faff6d9e6f6e4dee5a7d3f85cc85f1a0
 F src/vtab.c 2a8b44aa372c33f6154208e7a7f6c44254549806
 F src/vxworks.h c18586c8edc1bddbc15c004fa16aeb1e1342b4fb
-F src/wal.c 38ca0c41b510b636dfada0801fad8a99a982dfa6
+F src/wal.c e1f55f68a7b512c5f6dc5059ca45474442b295ea
 F src/wal.h 907943dfdef10b583e81906679a347e0ec6f1b1b
 F src/walker.c 2e14d17f592d176b6dc879c33fbdec4fbccaa2ba
 F src/where.c c6d3d2f6af57d574a7365ee2b225a5024f2a6bec
@@ -1279,7 +1279,7 @@ F test/vtabI.test 751b07636700dbdea328e4265b6077ccd6811a3f
 F test/vtab_alter.test 9e374885248f69e251bdaacf480b04a197f125e5
 F test/vtab_err.test 0d4d8eb4def1d053ac7c5050df3024fd47a3fbd8
 F test/vtab_shared.test ea8778d5b0df200adef2ca7c00c3c37d4375f772
-F test/wal.test 351bd83d33d41aa1a32f48f74bfebeb8cfcfc23b
+F test/wal.test 65bfc68f3f09dcbc62cee9f794e560428d96cec7
 F test/wal2.test 1f841d2048080d32f552942e333fd99ce541dada
 F test/wal3.test b1d425f68a1f61d12563f0fa1ee6fca7d5afabf4
 F test/wal4.test 4744e155cd6299c6bd99d3eab1c82f77db9cdb3c
@@ -1407,7 +1407,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 5d113aef2c7d746e8eda88d4e36c04a39b0a11be
-R 68fe235d45cc69355e6b4ad2de6e1633
-U dan
-Z 339ef03cecb2ba4cae1a0043b973d562
+P 16b34f2537bbc7846d8e6dc2b35daae5af241c1b
+R 7a7df63cdc3481fc553f1ad7c8a16e77
+U drh
+Z 48de22511c800e5231d6beb3d37133dd
index 44ce854f87609d4d722ec0a07e0729d70cc84419..bb0195b3065bc3db8d0dfa7ffd166cc34941059b 100644 (file)
@@ -1 +1 @@
-16b34f2537bbc7846d8e6dc2b35daae5af241c1b
\ No newline at end of file
+99b31a6b491c1c51227f478d3713b020d37a17cf
\ No newline at end of file
index b333a746e489844d858655f64ed4a9dc1273bada..2c8dceb750bb6878f73c0caedc42db22b3a66fce 100644 (file)
@@ -7301,13 +7301,6 @@ int sqlite3PagerCloseWal(Pager *pPager){
   return rc;
 }
 
-/*
-** Return the number of open savepoints.
-**/
-int sqlite3PagerSavepointCount(Pager *pPager){
-  return pPager->nSavepoint;
-}
-
 #ifdef SQLITE_ENABLE_SNAPSHOT
 /*
 ** If this is a WAL database, obtain a snapshot handle for the snapshot
index c9b766a55c1645878adba9fcdad7c4b15977cafe..ba4eec438dbd65ac2bf9cfae8b215c2506c1f64c 100644 (file)
@@ -168,7 +168,6 @@ int sqlite3PagerSharedLock(Pager *pPager);
   int sqlite3PagerWalCallback(Pager *pPager);
   int sqlite3PagerOpenWal(Pager *pPager, int *pisOpen);
   int sqlite3PagerCloseWal(Pager *pPager);
-  int sqlite3PagerSavepointCount(Pager *pPager);
 # ifdef SQLITE_ENABLE_SNAPSHOT
   int sqlite3PagerSnapshotGet(Pager *pPager, sqlite3_snapshot **ppSnapshot);
   int sqlite3PagerSnapshotOpen(Pager *pPager, sqlite3_snapshot *pSnapshot);
index d3e2908ba15c52fd7f6718ea810d273353b43fd4..492e2a1dbcfe271519db9ff58a6a3358e8f21ea6 100644 (file)
--- a/src/wal.c
+++ b/src/wal.c
@@ -2981,9 +2981,7 @@ int sqlite3WalFrames(
 #endif
 
   pLive = (WalIndexHdr*)walIndexHdr(pWal);
-  if( memcmp(&pWal->hdr, (void *)pLive, sizeof(WalIndexHdr))!=0
-   && (isCommit || sqlite3PagerSavepointCount(pList->pPager)==0)
-  ){
+  if( memcmp(&pWal->hdr, (void *)pLive, sizeof(WalIndexHdr))!=0 ){
     iFirst = pLive->mxFrame+1;
   }
 
index 3646b46c176c84a5aba60b6687eabba39f61b3c8..abd3a3ce49b822d5bd8b3aa46771c4523bed4dcf 100644 (file)
@@ -728,9 +728,16 @@ do_test wal-11.9 {
   list [expr [file size test.db]/1024] [log_deleted test.db-wal]
 } {37 1}
 sqlite3_wal db test.db
-set nWal 39
-if {[permutation]!="mmap"} {set nWal 37}
-ifcapable !mmap {set nWal 37}
+
+# After adding the capability of WAL to overwrite prior uncommitted
+# frame in the WAL-file with revised content, the size of the WAL file
+# following cache-spill is smaller.
+#
+#set nWal 39
+#if {[permutation]!="mmap"} {set nWal 37}
+#ifcapable !mmap {set nWal 37}
+set nWal 34
+
 do_test wal-11.10 {
   execsql {
     PRAGMA cache_size = 10;