Compare commits
196 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 87ed2e565e | |||
| b23a628422 | |||
| 852e308f34 | |||
| b21b427e5f | |||
| bc534cef73 | |||
| 38b95d70b9 | |||
| 4b3af91fbd | |||
| 92b9d4f870 | |||
| e8c2de0e0f | |||
| a87cf441bb | |||
| 1039aa3bf5 | |||
| 82d685dae8 | |||
| 78d1a8447c | |||
| e1b49b635a | |||
| bc410e8769 | |||
| 3c0047482d | |||
| e7b5d785a5 | |||
| 79640bb5dc | |||
| 291e2668b5 | |||
| 825751eb69 | |||
| 67b28465fc | |||
| efa511f1a8 | |||
| 3419721072 | |||
| 497d44ec5e | |||
| bd18310b5f | |||
| 3c430b72ca | |||
| 9f455fe428 | |||
| 55c98cfe95 | |||
| 699a832669 | |||
| 6f918c6b7c | |||
| ff86bd6d25 | |||
| 9e8706d02f | |||
| 153f4dce38 | |||
| ccb5519a54 | |||
| effc0d41f4 | |||
| 5cf971bdc7 | |||
| 6b716403f9 | |||
| 712ad6bf38 | |||
| 0524562918 | |||
| b959075416 | |||
| 686166eb32 | |||
| 3d6fbe469b | |||
| 52660d4d37 | |||
| 7204db1f61 | |||
| 5e5362267b | |||
| 6063442979 | |||
| ad77991569 | |||
| ea98a50afe | |||
| 37468f242b | |||
| 9af5d394e3 | |||
| 19e1883874 | |||
| da6f00cc63 | |||
| aa45304859 | |||
| e9ef82f592 | |||
| 5bd2d02612 | |||
| 7d322c14cf | |||
| 81d50a0880 | |||
| cb4a48e249 | |||
| f5528a1168 | |||
| 742f74ec19 | |||
| 76e67700e0 | |||
| 0d8cea5109 | |||
| 68796a609b | |||
| ba9c7c10cc | |||
| 7d13a403c4 | |||
| b7e87a53c7 | |||
| e24103baad | |||
| 4891bf00db | |||
| 467d804e1a | |||
| ff46ff5c73 | |||
| b60eb8bf6e | |||
| 5d30acad2f | |||
| d352e7d6ac | |||
| 47409209c2 | |||
| 07a7cd3714 | |||
| 47e42cd143 | |||
| 757372ab56 | |||
| 9d086cc562 | |||
| 1fd73f2693 | |||
| 5267068d3d | |||
| 0205717b93 | |||
| cc74eafee5 | |||
| 45d92dd539 | |||
| 6fe6b73a8d | |||
| 7a1cc96197 | |||
| 1e6ee1929c | |||
| 832406c2b4 | |||
| 7331bc0002 | |||
| 6f5c4810bc | |||
| b9b790e8cc | |||
| ecd48447b2 | |||
| f578ed6838 | |||
| b17135d81f | |||
| 5d2f5f4655 | |||
| 1adff07cb9 | |||
| 5b39dd45e8 | |||
| d17b9114aa | |||
| 6c9cc2c4f8 | |||
| ca773a51de | |||
| ade7cd53ab | |||
| e3d452a826 | |||
| faff28a478 | |||
| 70cfee98e5 | |||
| d94023257b | |||
| 1651f418e5 | |||
| 77508c4768 | |||
| ce8a1720d6 | |||
| d9da500bd7 | |||
| 82ac3d8211 | |||
| 73b1ef33ef | |||
| b77b56bd52 | |||
| 86b7bb29da | |||
| e81feadb41 | |||
| 6c45111957 | |||
| 029eb1bf15 | |||
| 2a27e5e4cb | |||
| 6702d6dadc | |||
| 6c75609f48 | |||
| 981dcb6236 | |||
| 3f17a238bb | |||
| 5666f09523 | |||
| 8f1396ae8b | |||
| aed427074b | |||
| 348093c719 | |||
| b90edad19d | |||
| b321a9b0fa | |||
| 234f384386 | |||
| 7271df982d | |||
| f54bc90ca3 | |||
| fa4d43fb64 | |||
| c77906eedd | |||
| e1c2be1134 | |||
| 2303f0859c | |||
| 938ede2078 | |||
| 0f1e95e616 | |||
| ebc672832f | |||
| 67f562233f | |||
| 80189c5bfe | |||
| 17e08c6149 | |||
| e809deee13 | |||
| 226fda81af | |||
| c25b39e41d | |||
| 1a2a4f12dc | |||
| 50c9522c24 | |||
| 9bf3da81a0 | |||
| 174f4fa241 | |||
| aae84d814c | |||
| ea8c9a43aa | |||
| ca97a18493 | |||
| 69105498b9 | |||
| bd74861e91 | |||
| 6d671d4c09 | |||
| 8caab4aebe | |||
| b3168a0056 | |||
| 2c34d3c61e | |||
| d59a566707 | |||
| 254bcdd02d | |||
| e31602c62d | |||
| 1e469f79b1 | |||
| 6fdd8fc5f0 | |||
| e5fd180648 | |||
| b83e6e9420 | |||
| d9df7cb876 | |||
| 281ee2f754 | |||
| f552a23740 | |||
| 3eeda95d36 | |||
| 1f3762607d | |||
| d445ed094a | |||
| ce909d1aae | |||
| 0f297b6e50 | |||
| 2d111c8bbb | |||
| 665f3d209b | |||
| c5140b39ce | |||
| 93543215e0 | |||
| e698c1f79e | |||
| 597bf19266 | |||
| eeb778d506 | |||
| 2c4328ed87 | |||
| f17e510ee5 | |||
| ca72570a11 | |||
| d597b966d9 | |||
| c30d437376 | |||
| e05f922583 | |||
| 6456b3929c | |||
| 816fc35956 | |||
| 8eed108df1 | |||
| 6cbf8e173f | |||
| 2df2b3d05f | |||
| 40927fd61e | |||
| 50182fa846 | |||
| 5d122d308f | |||
| 288e98fb4b | |||
| bfcf8d6d67 | |||
| 24f1b25c7b | |||
| 3400e78f38 | |||
| 055cc1e431 |
@@ -1578,6 +1578,7 @@ TESTEXT = \
|
||||
$(TOP)\ext\misc\amatch.c \
|
||||
$(TOP)\ext\misc\appendvfs.c \
|
||||
$(TOP)\ext\misc\basexx.c \
|
||||
$(TOP)\ext\misc\bgckpt.c \
|
||||
$(TOP)\ext\misc\cksumvfs.c \
|
||||
$(TOP)\ext\misc\closure.c \
|
||||
$(TOP)\ext\misc\csv.c \
|
||||
|
||||
+57
-84
@@ -92,7 +92,6 @@ array set teaish__Config [proj-strip-hash-comments {
|
||||
-tm.tcl.in TEAISH_TM_TCL_IN
|
||||
-options {}
|
||||
-pragmas {}
|
||||
-src {}
|
||||
}
|
||||
|
||||
#
|
||||
@@ -220,9 +219,7 @@ proc teaish-configure-core {} {
|
||||
=> {Full pathname of tclsh to use. It is used for trying to find
|
||||
tclConfig.sh. Warning: if its containing dir has multiple tclsh
|
||||
versions, it may select the wrong tclConfig.sh!
|
||||
Defaults to the $TCLSH environment variable.}
|
||||
|
||||
tcl-stubs=0 => {Enable use of Tcl stubs library.}
|
||||
Defaults to the $TCLSH environment variable.}
|
||||
|
||||
# TEA has --with-tclinclude but it appears to only be useful for
|
||||
# building an extension against an uninstalled copy of TCL's own
|
||||
@@ -334,33 +331,29 @@ proc teaish-configure-core {} {
|
||||
-url - -v ""
|
||||
-tm.tcl - -v ""
|
||||
-tm.tcl.in - -v ""
|
||||
-src - -v ""
|
||||
} {
|
||||
#proj-assert 0 {Just testing}
|
||||
set isPIFlag [expr {"-" ne $pflag}]
|
||||
if {$isPIFlag} {
|
||||
if {[info exists ::teaish__PkgInfo($pflag)]} {
|
||||
# Was already set - skip it.
|
||||
continue;
|
||||
}
|
||||
proj-assert {{-} eq $key};# "Unexpected pflag=$pflag key=$key type=$type val=$val"
|
||||
proj-assert {{-} eq $key}
|
||||
set key $f2d($pflag)
|
||||
}
|
||||
if {"" ne $key} {
|
||||
if {"<nope>" ne [get-define $key "<nope>"]} {
|
||||
# Was already set - skip it.
|
||||
continue
|
||||
}
|
||||
proj-assert {"" ne $key}
|
||||
set got [get-define $key "<nope>"]
|
||||
if {"<nope>" ne $got} {
|
||||
# Was already set - skip it.
|
||||
continue
|
||||
}
|
||||
switch -exact -- $type {
|
||||
-v {}
|
||||
-e { set val [eval $val] }
|
||||
default { proj-error "Invalid type flag: $type" }
|
||||
}
|
||||
#puts "***** defining default $pflag $key {$val} isPIFlag=$isPIFlag"
|
||||
if {$key ne ""} {
|
||||
define $key $val
|
||||
}
|
||||
#puts "***** defining default $pflag $key {$val} isPIFlag=$isPIFlag got=$got"
|
||||
define $key $val
|
||||
if {$isPIFlag} {
|
||||
set ::teaish__PkgInfo($pflag) $val
|
||||
}
|
||||
@@ -500,8 +493,6 @@ proc teaish__configure_phase1 {} {
|
||||
}
|
||||
teaish-checks-run -post
|
||||
|
||||
define TEAISH_USE_STUBS [opt-bool tcl-stubs]
|
||||
|
||||
apply {{} {
|
||||
# Set up "vsatisfies" code for pkgIndex.tcl.in,
|
||||
# _teaish.tester.tcl.in, and for a configure-time check. We would
|
||||
@@ -531,7 +522,7 @@ proc teaish__configure_phase1 {} {
|
||||
set vputs "puts \[ $vsat \]"
|
||||
#puts "*** vputs = $vputs"
|
||||
scan [exec echo $vputs | $tclsh] %d vvcheck
|
||||
if {![info exists vvcheck] || 0 == $vvcheck} {
|
||||
if {0 == $vvcheck} {
|
||||
proj-fatal -up $tclsh "check failed:" $vsat
|
||||
}
|
||||
}
|
||||
@@ -594,8 +585,7 @@ proc teaish__configure_phase1 {} {
|
||||
#
|
||||
if {0x0f & $::teaish__Config(pkginit-policy)} {
|
||||
file delete -force -- [get-define TEAISH_PKGINIT_TCL]
|
||||
proj-dot-ins-append [get-define TEAISH_PKGINIT_TCL_IN] \
|
||||
[get-define TEAISH_PKGINIT_TCL]
|
||||
proj-dot-ins-append [get-define TEAISH_PKGINIT_TCL_IN]
|
||||
}
|
||||
if {0x0f & $::teaish__Config(tm-policy)} {
|
||||
file delete -force -- [get-define TEAISH_TM_TCL]
|
||||
@@ -605,20 +595,17 @@ proc teaish__configure_phase1 {} {
|
||||
apply {{} {
|
||||
# Queue up any remaining dot-in files
|
||||
set dotIns [list]
|
||||
foreach {dIn => dOut} {
|
||||
TEAISH_TESTER_TCL_IN => TEAISH_TESTER_TCL
|
||||
TEAISH_TEST_TCL_IN => TEAISH_TEST_TCL
|
||||
TEAISH_MAKEFILE_IN => TEAISH_MAKEFILE
|
||||
foreach d {
|
||||
TEAISH_TESTER_TCL_IN
|
||||
TEAISH_TEST_TCL_IN
|
||||
TEAISH_MAKEFILE_IN
|
||||
} {
|
||||
lappend dotIns [get-define $dIn ""] [get-define $dOut ""]
|
||||
lappend dotIns [get-define $d ""]
|
||||
}
|
||||
lappend dotIns $::autosetup(srcdir)/Makefile.in Makefile; # must be after TEAISH_MAKEFILE_IN.
|
||||
# Much later: probably because of timestamps for deps purposes :-?
|
||||
#puts "dotIns=$dotIns"
|
||||
foreach {i o} $dotIns {
|
||||
if {"" ne $i && "" ne $o} {
|
||||
#puts " pre-dot-ins-append: \[$i\] -> \[$o\]"
|
||||
proj-dot-ins-append $i $o
|
||||
lappend dotIns $::autosetup(srcdir)/Makefile.in; # must be after TEAISH_MAKEFILE_IN
|
||||
foreach f $dotIns {
|
||||
if {"" ne $f} {
|
||||
proj-dot-ins-append $f
|
||||
}
|
||||
}
|
||||
}}
|
||||
@@ -653,10 +640,10 @@ proc teaish__configure_phase1 {} {
|
||||
#
|
||||
# NO [define]s after this point!
|
||||
#
|
||||
proj-dot-ins-process -validate
|
||||
proj-if-opt-truthy teaish-dump-defines {
|
||||
proj-file-write config.defines.txt $tdefs
|
||||
}
|
||||
proj-dot-ins-process -validate
|
||||
|
||||
}; # teaish__configure_phase1
|
||||
|
||||
@@ -830,9 +817,7 @@ proc teaish__check_tcl {} {
|
||||
if {"" ne $withSh &&
|
||||
[catch {exec echo "puts stdout \$auto_path" | "$withSh"} result] == 0} {
|
||||
foreach i $result {
|
||||
if {![string match //zip* $i] && [file isdirectory $i]} {
|
||||
# isdirectory actually passes on //zipfs:/..., but those are
|
||||
# useless for our purposes
|
||||
if {[file isdirectory $i]} {
|
||||
set tcllibdir $i/$extDirName
|
||||
break
|
||||
}
|
||||
@@ -1081,7 +1066,7 @@ If you are attempting an out-of-tree build, use
|
||||
]]} {
|
||||
if {[string match *.in $extM]} {
|
||||
define TEAISH_MAKEFILE_IN $extM
|
||||
define TEAISH_MAKEFILE _[file rootname [file tail $extM]]
|
||||
define TEAISH_MAKEFILE [file rootname [file tail $extM]]
|
||||
} else {
|
||||
define TEAISH_MAKEFILE_IN ""
|
||||
define TEAISH_MAKEFILE $extM
|
||||
@@ -1149,8 +1134,8 @@ If you are attempting an out-of-tree build, use
|
||||
set flist [list $dirExt/teaish.test.tcl.in $dirExt/teaish.test.tcl]
|
||||
if {[proj-first-file-found ttt $flist]} {
|
||||
if {[string match *.in $ttt]} {
|
||||
# Generate _teaish.test.tcl from $ttt
|
||||
set xt _[file rootname [file tail $ttt]]
|
||||
# Generate teaish.test.tcl from $ttt
|
||||
set xt [file rootname [file tail $ttt]]
|
||||
file delete -force -- $xt; # ensure no stale copy is used
|
||||
define TEAISH_TEST_TCL $xt
|
||||
define TEAISH_TEST_TCL_IN $ttt
|
||||
@@ -1317,6 +1302,7 @@ proc teaish-ldflags-prepend {args} {
|
||||
# object files (which are typically in the build tree)).
|
||||
#
|
||||
proc teaish-src-add {args} {
|
||||
set i 0
|
||||
proj-parse-simple-flags args flags {
|
||||
-dist 0 {expr 1}
|
||||
-dir 0 {expr 1}
|
||||
@@ -1401,7 +1387,7 @@ proc teaish__cleanup_rule {{tgt clean}} {
|
||||
return ${tgt}-_${x}_
|
||||
}
|
||||
|
||||
# @teaish-make-obj ?flags? ?...args?
|
||||
# @teaish-make-obj objfile srcfile ?...args?
|
||||
#
|
||||
# Uses teaish-make-add to inject makefile rules for $objfile from
|
||||
# $srcfile, which is assumed to be C code which uses libtcl. Unless
|
||||
@@ -1415,45 +1401,43 @@ proc teaish__cleanup_rule {{tgt clean}} {
|
||||
# Any arguments after the 2nd may be flags described below or, if no
|
||||
# -recipe is provided, flags for the compiler call.
|
||||
#
|
||||
# -obj obj-filename.o
|
||||
#
|
||||
# -src src-filename.c
|
||||
#
|
||||
# -recipe {...}
|
||||
# Uses the trimmed value of {...} as the recipe, prefixing it with
|
||||
# a single hard-tab character.
|
||||
#
|
||||
# -deps {...}
|
||||
# List of extra files to list as dependencies of $o.
|
||||
# List of extra files to list as dependencies of $o. Good luck
|
||||
# escaping non-trivial cases properly.
|
||||
#
|
||||
# -clean
|
||||
# Generate cleanup rules as well.
|
||||
proc teaish-make-obj {args} {
|
||||
proj-parse-simple-flags args flags {
|
||||
-clean 0 {expr 1}
|
||||
-recipe => {}
|
||||
-deps => {}
|
||||
-obj => {}
|
||||
-src => {}
|
||||
}
|
||||
#parray flags
|
||||
if {"" eq $flags(-obj)} {
|
||||
set args [lassign $args flags(-obj)]
|
||||
if {"" eq $flags(-obj)} {
|
||||
proj-error "Missing -obj flag."
|
||||
proc teaish-make-obj {o src args} {
|
||||
set consume 0
|
||||
set clean 0
|
||||
set flag ""
|
||||
array set flags {}
|
||||
set xargs {}
|
||||
foreach arg $args {
|
||||
if {$consume} {
|
||||
set consume 0
|
||||
set flags($flag) $arg
|
||||
continue
|
||||
}
|
||||
switch -exact -- $arg {
|
||||
-clean {incr clean}
|
||||
-recipe -
|
||||
-deps {
|
||||
set flag $arg
|
||||
incr consume
|
||||
}
|
||||
default {
|
||||
lappend xargs $arg
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach f {-deps -src} {
|
||||
set flags($f) [string trim [string map {\n " "} $flags($f)]]
|
||||
}
|
||||
foreach f {-deps -src} {
|
||||
set flags($f) [string trim $flags($f)]
|
||||
}
|
||||
#parray flags
|
||||
#puts "-- args=$args"
|
||||
teaish-make-add \
|
||||
"# [proj-scope 1] -> [proj-scope] $flags(-obj) $flags(-src)" -nl \
|
||||
"$flags(-obj): $flags(-src) $::teaish__Config(teaish.tcl)"
|
||||
"# [proj-scope 1] -> [proj-scope] $o $src" -nl \
|
||||
"$o: $src $::teaish__Config(teaish.tcl)"
|
||||
if {[info exists flags(-deps)]} {
|
||||
teaish-make-add " " [join $flags(-deps)]
|
||||
}
|
||||
@@ -1461,12 +1445,12 @@ proc teaish-make-obj {args} {
|
||||
if {[info exists flags(-recipe)]} {
|
||||
teaish-make-add [string trim $flags(-recipe)] -nl
|
||||
} else {
|
||||
teaish-make-add [join [list \$(CC.tcl) -c $flags(-src) {*}$args]] -nl
|
||||
teaish-make-add [join [list \$(CC.tcl) -c $src {*}$xargs]] -nl
|
||||
}
|
||||
if {$flags(-clean)} {
|
||||
if {$clean} {
|
||||
set rule [teaish__cleanup_rule]
|
||||
teaish-make-add \
|
||||
"clean: $rule\n$rule:\n\trm -f \"$flags(-obj)\"\n"
|
||||
"clean: $rule\n$rule:\n\trm -f \"$o\"\n"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2094,17 +2078,6 @@ proc teaish-pkginfo-set {args} {
|
||||
set v $x
|
||||
}
|
||||
|
||||
-src {
|
||||
set d $::teaish__Config(extension-dir)
|
||||
foreach f $v {
|
||||
lappend ::teaish__Config(dist-files) $f
|
||||
lappend ::teaish__Config(extension-src) $d/$f
|
||||
lappend ::teaish__PkgInfo(-src) $f
|
||||
# ^^^ so that default-value initialization in
|
||||
# teaish-configure-core recognizes that it's been set.
|
||||
}
|
||||
}
|
||||
|
||||
-tm.tcl -
|
||||
-tm.tcl.in {
|
||||
if {0x30 & $::teaish__Config(pkgindex-policy)} {
|
||||
@@ -2542,7 +2515,7 @@ proc teaish__install {{dDest ""}} {
|
||||
] {
|
||||
teaish__verbose 1 msg-result "Copying files to $destDir..."
|
||||
file mkdir $destDir
|
||||
foreach f [glob -nocomplain -directory $srcDir *] {
|
||||
foreach f [glob -directory $srcDir *] {
|
||||
if {[string match {*~} $f] || [string match "#*#" [file tail $f]]} {
|
||||
# Editor-generated backups and emacs lock files
|
||||
continue
|
||||
|
||||
@@ -99,7 +99,7 @@ proc test__affert {failMode args} {
|
||||
lassign $args script msg
|
||||
}
|
||||
incr ::test__Counters($what)
|
||||
if {![uplevel 1 expr [list $script]]} {
|
||||
if {![uplevel 1 [concat expr [list $script]]]} {
|
||||
if {"" eq $msg} {
|
||||
set msg $script
|
||||
}
|
||||
@@ -136,40 +136,6 @@ proc assert {args} {
|
||||
tailcall test__affert 1 {*}$args
|
||||
}
|
||||
|
||||
#
|
||||
# @assert-matches ?-e? pattern ?-e? rhs ?msg?
|
||||
#
|
||||
# Equivalent to assert {[string match $pattern $rhs]} except that
|
||||
# if either of those are prefixed with an -e flag, they are eval'd
|
||||
# and their results are used.
|
||||
#
|
||||
proc assert-matches {args} {
|
||||
set evalLhs 0
|
||||
set evalRhs 0
|
||||
if {"-e" eq [lindex $args 0]} {
|
||||
incr evalLhs
|
||||
set args [lassign $args -]
|
||||
}
|
||||
set args [lassign $args pattern]
|
||||
if {"-e" eq [lindex $args 0]} {
|
||||
incr evalRhs
|
||||
set args [lassign $args -]
|
||||
}
|
||||
set args [lassign $args rhs msg]
|
||||
|
||||
if {$evalLhs} {
|
||||
set pattern [uplevel 1 $pattern]
|
||||
}
|
||||
if {$evalRhs} {
|
||||
set rhs [uplevel 1 $rhs]
|
||||
}
|
||||
#puts "***pattern=$pattern\n***rhs=$rhs"
|
||||
tailcall test__affert 1 \
|
||||
[join [list \[ string match [list $pattern] [list $rhs] \]]] $msg
|
||||
# why does this not work? [list \[ string match [list $pattern] [list $rhs] \]] $msg
|
||||
# "\[string match [list $pattern] [list $rhs]\]"
|
||||
}
|
||||
|
||||
#
|
||||
# @test-assert testId script ?msg?
|
||||
#
|
||||
@@ -191,7 +157,7 @@ proc test-expect {testId script result} {
|
||||
puts "test $testId"
|
||||
set x [string trim [uplevel 1 $script]]
|
||||
set result [string trim $result]
|
||||
tailcall test__affert 0 [list "{$x}" eq "{$result}"] \
|
||||
tailcall test__affert 0 [list $x eq $result] \
|
||||
"\nEXPECTED: <<$result>>\nGOT: <<$x>>"
|
||||
}
|
||||
|
||||
@@ -203,7 +169,7 @@ proc test-expect {testId script result} {
|
||||
#
|
||||
proc test-catch {cmd args} {
|
||||
if {[catch {
|
||||
uplevel 1 $cmd {*}$args
|
||||
$cmd {*}$args
|
||||
} rc xopts]} {
|
||||
puts "[test-current-scope] ignoring failure of: $cmd [lindex $args 0]: $rc"
|
||||
return 1
|
||||
@@ -211,37 +177,6 @@ proc test-catch {cmd args} {
|
||||
return 0
|
||||
}
|
||||
|
||||
#
|
||||
# @test-catch-matching pattern (script|cmd args...)
|
||||
#
|
||||
# Works like test-catch, but it expects its argument(s) to to throw an
|
||||
# error matching the given string (checked with [string match]). If
|
||||
# they do not throw, or the error does not match $pattern, this
|
||||
# function throws, else it returns 1.
|
||||
#
|
||||
# If there is no second argument, the $cmd is assumed to be a script,
|
||||
# and will be eval'd in the caller's scope.
|
||||
#
|
||||
# TODO: add -glob and -regex flags to control matching flavor.
|
||||
#
|
||||
proc test-catch-matching {pattern cmd args} {
|
||||
if {[catch {
|
||||
#puts "**** catch-matching cmd=$cmd args=$args"
|
||||
if {0 == [llength $args]} {
|
||||
uplevel 1 $cmd {*}$args
|
||||
} else {
|
||||
$cmd {*}$args
|
||||
}
|
||||
} rc xopts]} {
|
||||
if {[string match $pattern $rc]} {
|
||||
return 1
|
||||
} else {
|
||||
error "[test-current-scope] exception does not match {$pattern}: {$rc}"
|
||||
}
|
||||
}
|
||||
error "[test-current-scope] expecting to see an error matching {$pattern}"
|
||||
}
|
||||
|
||||
if {![array exists ::teaish__BuildFlags]} {
|
||||
array set ::teaish__BuildFlags {}
|
||||
}
|
||||
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
|
||||
Wal2 Mode Notes
|
||||
===============
|
||||
|
||||
## Activating/Deactivating Wal2 Mode
|
||||
|
||||
"Wal2" mode is very similar to "wal" mode. To change a database to wal2 mode,
|
||||
use the command:
|
||||
|
||||
>
|
||||
PRAGMA journal_mode = wal2;
|
||||
|
||||
It is not possible to change a database directly from "wal" mode to "wal2"
|
||||
mode. Instead, it must first be changed to rollback mode. So, to change a wal
|
||||
mode database to wal2 mode, the following two commands may be used:
|
||||
|
||||
>
|
||||
PRAGMA journal_mode = delete;
|
||||
PRAGMA journal_mode = wal2;
|
||||
|
||||
A database in wal2 mode may only be accessed by versions of SQLite compiled
|
||||
from this branch. Attempting to use any other version of SQLite results in an
|
||||
SQLITE_NOTADB error. A wal2 mode database may be changed back to rollback mode
|
||||
(making it accessible by all versions of SQLite) using:
|
||||
|
||||
>
|
||||
PRAGMA journal_mode = delete;
|
||||
|
||||
## The Advantage of Wal2 Mode
|
||||
|
||||
In legacy wal mode, when a writer writes data to the database, it doesn't
|
||||
modify the database file directly. Instead, it appends new data to the
|
||||
"<database>-wal" file. Readers read data from both the original database
|
||||
file and the "<database>-wal" file. At some point, data is copied from the
|
||||
"<database>-wal" file into the database file, after which the wal file can
|
||||
be deleted or overwritten. Copying data from the wal file into the database
|
||||
file is called a "checkpoint", and may be done explictly (either by "PRAGMA
|
||||
wal_checkpoint" or sqlite3_wal_checkpoint_v2()), or
|
||||
automatically (by configuring "PRAGMA wal_autocheckpoint" - this is the
|
||||
default).
|
||||
|
||||
Checkpointers do not block writers, and writers do not block checkpointers.
|
||||
However, if a writer writes to the database while a checkpoint is ongoing,
|
||||
then the new data is appended to the end of the wal file. This means that,
|
||||
even following the checkpoint, the wal file cannot be overwritten or deleted,
|
||||
and so all subsequent transactions must also be appended to the wal file. The
|
||||
work of the checkpointer is not wasted - SQLite remembers which parts of the
|
||||
wal file have already been copied into the db file so that the next checkpoint
|
||||
does not have to do so again - but it does mean that the wal file may grow
|
||||
indefinitely if the checkpointer never gets a chance to finish without a
|
||||
writer appending to the wal file. There are also circumstances in which
|
||||
long-running readers may prevent a checkpointer from checkpointing the entire
|
||||
wal file - also causing the wal file to grow indefinitely in a busy system.
|
||||
|
||||
Wal2 mode does not have this problem. In wal2 mode, wal files do not grow
|
||||
indefinitely even if the checkpointer never has a chance to finish
|
||||
uninterrupted.
|
||||
|
||||
In wal2 mode, the system uses two wal files instead of one. The files are named
|
||||
"<database>-wal" and "<database>-wal2", where "<database>" is of
|
||||
course the name of the database file. When data is written to the database, the
|
||||
writer begins by appending the new data to the first wal file. Once the first
|
||||
wal file has grown large enough, writers switch to appending data to the second
|
||||
wal file. At this point the first wal file can be checkpointed (after which it
|
||||
can be overwritten). Then, once the second wal file has grown large enough and
|
||||
the first wal file has been checkpointed, writers switch back to the first wal
|
||||
file. And so on.
|
||||
|
||||
## Application Programming
|
||||
|
||||
From the point of view of the user, the main differences between wal and
|
||||
wal2 mode are to do with checkpointing:
|
||||
|
||||
* In wal mode, a checkpoint may be attempted at any time. In wal2
|
||||
mode, the checkpointer has to wait until writers have switched
|
||||
to the "other" wal file before a checkpoint can take place.
|
||||
|
||||
* In wal mode, the wal-hook (callback registered using
|
||||
sqlite3_wal_hook()) is invoked after a transaction is committed
|
||||
with the total number of pages in the wal file as an argument. In wal2
|
||||
mode, the argument is either the total number of uncheckpointed pages in
|
||||
both wal files, or - if the "other" wal file is empty or already
|
||||
checkpointed - 0.
|
||||
|
||||
Clients are recommended to use the same strategies for checkpointing wal2 mode
|
||||
databases as for wal databases - by registering a wal-hook using
|
||||
sqlite3_wal_hook() and attempting a checkpoint when the parameter
|
||||
exceeds a certain threshold.
|
||||
|
||||
However, it should be noted that although the wal-hook is invoked after each
|
||||
transaction is committed to disk and database locks released, it is still
|
||||
invoked from within the sqlite3_step() call used to execute the "COMMIT"
|
||||
command. In BEGIN CONCURRENT systems, where the "COMMIT" is often protected by
|
||||
an application mutex, this may reduce concurrency. In such systems, instead of
|
||||
executing a checkpoint from within the wal-hook, a thread might defer this
|
||||
action until after the application mutex has been released.
|
||||
|
||||
|
||||
@@ -0,0 +1,228 @@
|
||||
/*
|
||||
** 2017-10-11
|
||||
**
|
||||
** The author disclaims copyright to this source code. In place of
|
||||
** a legal notice, here is a blessing:
|
||||
**
|
||||
** May you do good and not evil.
|
||||
** May you find forgiveness for yourself and forgive others.
|
||||
** May you share freely, never taking more than you give.
|
||||
**
|
||||
******************************************************************************
|
||||
**
|
||||
*/
|
||||
|
||||
#if !defined(SQLITE_TEST) || defined(SQLITE_OS_UNIX)
|
||||
|
||||
#include "sqlite3.h"
|
||||
#include <string.h>
|
||||
#include <pthread.h>
|
||||
|
||||
/*
|
||||
** API declarations.
|
||||
*/
|
||||
typedef struct Checkpointer Checkpointer;
|
||||
int sqlite3_bgckpt_create(const char *zFilename, Checkpointer **pp);
|
||||
int sqlite3_bgckpt_checkpoint(Checkpointer *p, int bBlock);
|
||||
void sqlite3_bgckpt_destroy(Checkpointer *p);
|
||||
|
||||
|
||||
struct Checkpointer {
|
||||
sqlite3 *db; /* Database handle */
|
||||
|
||||
pthread_t thread; /* Background thread */
|
||||
pthread_mutex_t mutex;
|
||||
pthread_cond_t cond;
|
||||
|
||||
int rc; /* Error from "PRAGMA wal_checkpoint" */
|
||||
int bCkpt; /* True if checkpoint requested */
|
||||
int bExit; /* True if exit requested */
|
||||
};
|
||||
|
||||
static void *bgckptThreadMain(void *pCtx){
|
||||
int rc = SQLITE_OK;
|
||||
Checkpointer *p = (Checkpointer*)pCtx;
|
||||
|
||||
while( rc==SQLITE_OK ){
|
||||
int bExit;
|
||||
|
||||
pthread_mutex_lock(&p->mutex);
|
||||
if( p->bCkpt==0 && p->bExit==0 ){
|
||||
pthread_cond_wait(&p->cond, &p->mutex);
|
||||
}
|
||||
p->bCkpt = 0;
|
||||
bExit = p->bExit;
|
||||
pthread_mutex_unlock(&p->mutex);
|
||||
|
||||
if( bExit ) break;
|
||||
rc = sqlite3_exec(p->db, "PRAGMA wal_checkpoint", 0, 0, 0);
|
||||
if( rc==SQLITE_BUSY ){
|
||||
rc = SQLITE_OK;
|
||||
}
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&p->mutex);
|
||||
p->rc = rc;
|
||||
pthread_mutex_unlock(&p->mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sqlite3_bgckpt_destroy(Checkpointer *p){
|
||||
if( p ){
|
||||
void *ret = 0;
|
||||
|
||||
/* Signal the background thread to exit */
|
||||
pthread_mutex_lock(&p->mutex);
|
||||
p->bExit = 1;
|
||||
pthread_cond_broadcast(&p->cond);
|
||||
pthread_mutex_unlock(&p->mutex);
|
||||
|
||||
pthread_join(p->thread, &ret);
|
||||
sqlite3_close(p->db);
|
||||
sqlite3_free(p);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int sqlite3_bgckpt_create(const char *zFilename, Checkpointer **pp){
|
||||
Checkpointer *pNew = 0;
|
||||
int rc;
|
||||
|
||||
pNew = (Checkpointer*)sqlite3_malloc(sizeof(Checkpointer));
|
||||
if( pNew==0 ){
|
||||
rc = SQLITE_NOMEM;
|
||||
}else{
|
||||
memset(pNew, 0, sizeof(Checkpointer));
|
||||
rc = sqlite3_open(zFilename, &pNew->db);
|
||||
}
|
||||
|
||||
if( rc==SQLITE_OK ){
|
||||
pthread_mutex_init(&pNew->mutex, 0);
|
||||
pthread_cond_init(&pNew->cond, 0);
|
||||
pthread_create(&pNew->thread, 0, bgckptThreadMain, (void*)pNew);
|
||||
}
|
||||
|
||||
if( rc!=SQLITE_OK ){
|
||||
sqlite3_bgckpt_destroy(pNew);
|
||||
pNew = 0;
|
||||
}
|
||||
*pp = pNew;
|
||||
return rc;
|
||||
}
|
||||
|
||||
int sqlite3_bgckpt_checkpoint(Checkpointer *p, int bBlock){
|
||||
int rc;
|
||||
pthread_mutex_lock(&p->mutex);
|
||||
rc = p->rc;
|
||||
if( rc==SQLITE_OK ){
|
||||
p->bCkpt = 1;
|
||||
pthread_cond_broadcast(&p->cond);
|
||||
}
|
||||
pthread_mutex_unlock(&p->mutex);
|
||||
return rc;
|
||||
}
|
||||
|
||||
#ifdef SQLITE_TEST
|
||||
#include "tclsqlite.h"
|
||||
|
||||
const char *sqlite3ErrName(int rc);
|
||||
|
||||
static void SQLITE_TCLAPI bgckpt_del(void * clientData){
|
||||
Checkpointer *pCkpt = (Checkpointer*)clientData;
|
||||
sqlite3_bgckpt_destroy(pCkpt);
|
||||
}
|
||||
|
||||
/*
|
||||
** Tclcmd: $ckpt SUBCMD ...
|
||||
*/
|
||||
static int SQLITE_TCLAPI bgckpt_obj_cmd(
|
||||
void * clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Obj *CONST objv[]
|
||||
){
|
||||
Checkpointer *pCkpt = (Checkpointer*)clientData;
|
||||
const char *aCmd[] = { "checkpoint", "destroy", 0 };
|
||||
int iCmd;
|
||||
|
||||
if( objc<2 ){
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "SUBCMD ...");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
if( Tcl_GetIndexFromObj(interp, objv[1], aCmd, "sub-command", 0, &iCmd) ){
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
switch( iCmd ){
|
||||
case 0: {
|
||||
int rc;
|
||||
int bBlock = 0;
|
||||
|
||||
if( objc>3 ){
|
||||
Tcl_WrongNumArgs(interp, 2, objv, "?BLOCKING?");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if( objc==3 && Tcl_GetBooleanFromObj(interp, objv[2], &bBlock) ){
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
rc = sqlite3_bgckpt_checkpoint(pCkpt, bBlock);
|
||||
if( rc!=SQLITE_OK ){
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(sqlite3ErrName(rc), -1));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 1: {
|
||||
Tcl_DeleteCommand(interp, Tcl_GetString(objv[0]));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
** Tclcmd: bgckpt CMDNAME FILENAME
|
||||
*/
|
||||
static int SQLITE_TCLAPI bgckpt_cmd(
|
||||
void * clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Obj *CONST objv[]
|
||||
){
|
||||
const char *zCmd;
|
||||
const char *zFilename;
|
||||
int rc;
|
||||
Checkpointer *pCkpt;
|
||||
|
||||
if( objc!=3 ){
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "CMDNAME FILENAME");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
zCmd = Tcl_GetString(objv[1]);
|
||||
zFilename = Tcl_GetString(objv[2]);
|
||||
|
||||
rc = sqlite3_bgckpt_create(zFilename, &pCkpt);
|
||||
if( rc!=SQLITE_OK ){
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(sqlite3ErrName(rc), -1));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
Tcl_CreateObjCommand(interp, zCmd, bgckpt_obj_cmd, (void*)pCkpt, bgckpt_del);
|
||||
Tcl_SetObjResult(interp, objv[1]);
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
int Bgckpt_Init(Tcl_Interp *interp){
|
||||
Tcl_CreateObjCommand(interp, "bgckpt", bgckpt_cmd, 0, 0);
|
||||
return TCL_OK;
|
||||
}
|
||||
#endif /* SQLITE_TEST */
|
||||
|
||||
#else
|
||||
# include "tclsqlite.h"
|
||||
int Bgckpt_Init(Tcl_Interp *interp){ return TCL_OK; }
|
||||
#endif
|
||||
@@ -49,36 +49,6 @@
|
||||
versions (approximately) 104-107 are extinct) we should change our
|
||||
usage of those methods to remove the "await".
|
||||
*/
|
||||
//#if 0
|
||||
/**
|
||||
2026-04-04: this file gets included by both the "opfs" and "opfs-wl"
|
||||
VFSes. It would, in hindsight, hypothetically be possible to restructure
|
||||
it very slightly to support both VFSes via a single Worker instance.
|
||||
|
||||
Some of the changes we would need for that:
|
||||
|
||||
- The xLock/xUnlock "op codes" would need to differ for each impl.
|
||||
i.e. we'd need state.opIds.xLock{,WL} and state.opIds.xUnlock{,WL}
|
||||
to distinguish between the two, rather than doing so when this Worker
|
||||
is loaded.
|
||||
|
||||
- We would need to centralize loading of this Worker, outside of
|
||||
the VFS-specific pieces, and change the handshake in order to be
|
||||
able to distinguish between clients which support
|
||||
Atomics.waitAsync() and those which do not ("opfs-wl" requires
|
||||
waitAsync()).
|
||||
|
||||
One down-side would be for clients which, for whatever reason, want
|
||||
to use both "opfs" and "opfs-wl" within the same session: because
|
||||
both would go through the same Worker, any operations for one VFS
|
||||
would, while they're being processed on this side of the proxy,
|
||||
effectively block the other VFS from doing anything, potentially
|
||||
deadlocking. This use case seems unlikely enough that it can
|
||||
possibly be ruled out (or even reasonably flat-out prohibited by
|
||||
the library).
|
||||
*/
|
||||
//#/if
|
||||
|
||||
"use strict";
|
||||
const urlParams = new URL(globalThis.location.href).searchParams;
|
||||
const vfsName = urlParams.get('vfs');
|
||||
@@ -708,9 +678,9 @@ const installAsyncProxy = function(){
|
||||
const lockName = "sqlite3-vfs-opfs:" + fh.filenameAbs;
|
||||
const oldLockType = fh.xLock;
|
||||
return new Promise((resolveWaitLoop) => {
|
||||
//log("xLock() initial promise entered...");
|
||||
//error("xLock() initial promise entered...");
|
||||
navigator.locks.request(lockName, { mode: requestedMode }, async (lock) => {
|
||||
//log("xLock() Web Lock entered.", fh);
|
||||
//error("xLock() Web Lock entered.", fh);
|
||||
__implicitLocks.delete(fid);
|
||||
let rc = 0;
|
||||
try{
|
||||
@@ -756,7 +726,7 @@ const installAsyncProxy = function(){
|
||||
storeAndNotify('xUnlock', rc);
|
||||
return rc;
|
||||
}
|
||||
//log("xUnlock()",fid, lockType, fh);
|
||||
//error("xUnlock()",fid, lockType, fh);
|
||||
let rc = 0;
|
||||
if( lockType === state.sq3Codes.SQLITE_LOCK_NONE ){
|
||||
/* SQLite usually unlocks all the way to NONE */
|
||||
@@ -766,7 +736,7 @@ const installAsyncProxy = function(){
|
||||
fh.xLock = lockType;
|
||||
}else if( lockType === state.sq3Codes.SQLITE_LOCK_SHARED
|
||||
&& existing.mode === 'exclusive' ){
|
||||
/* downgrade EXCLUSIVE -> SHARED */
|
||||
/* downgrade Exclusive -> Shared */
|
||||
rc = await wlCloseHandle(fh);
|
||||
if( 0===rc ){
|
||||
fh.xLock = lockType;
|
||||
@@ -912,6 +882,16 @@ const installAsyncProxy = function(){
|
||||
operation */
|
||||
) || [];
|
||||
//error("waitLoop() whichOp =",opId, f.opHandlers[opId].key, args);
|
||||
//#if 0
|
||||
if( isWebLocker && (opId==opIds.xLock || opIds==opIds.xUnlock) ){
|
||||
/* An expert suggests that this introduces a race condition,
|
||||
but my eyes aren't seeing it. The hope was that this
|
||||
would improve the lock speed a tick, but it does not
|
||||
appear to. */
|
||||
hnd(...args);
|
||||
continue;
|
||||
}
|
||||
//#/if
|
||||
await hnd(...args);
|
||||
}catch(e){
|
||||
error('in waitLoop():', e);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//#if not omit-oo1
|
||||
//#ifnot omit-oo1
|
||||
/*
|
||||
2022-08-24
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
slightly simpler client-side interface than the slightly-lower-level
|
||||
Worker API does.
|
||||
|
||||
In non-ESM builds this file necessarily exposes one global symbol,
|
||||
but clients may freely `delete` that symbol after calling it.
|
||||
This script necessarily exposes one global symbol, but clients may
|
||||
freely `delete` that symbol after calling it.
|
||||
*/
|
||||
//#if not defined target:es6-module
|
||||
'use strict';
|
||||
//#/if
|
||||
/**
|
||||
Configures an sqlite3 Worker API #1 Worker such that it can be
|
||||
manipulated via a Promise-based interface and returns a factory
|
||||
@@ -111,12 +109,10 @@
|
||||
the callback is called one time for each row of the result set,
|
||||
passed the same worker message format as the worker API emits:
|
||||
|
||||
{
|
||||
type:typeString,
|
||||
{type:typeString,
|
||||
row:VALUE,
|
||||
rowNumber:1-based-#,
|
||||
columnNames: array
|
||||
}
|
||||
columnNames: array}
|
||||
|
||||
Where `typeString` is an internally-synthesized message type string
|
||||
used temporarily for worker message dispatching. It can be ignored
|
||||
@@ -127,16 +123,19 @@
|
||||
callback.
|
||||
|
||||
At the end of the result set, the same event is fired with
|
||||
(row=undefined, rowNumber=null) to indicate that the end of the
|
||||
result set has been reached. The rows arrive via worker-posted
|
||||
messages, with all the implications of that.
|
||||
(row=undefined, rowNumber=null) to indicate that
|
||||
the end of the result set has been reached. Note that the rows
|
||||
arrive via worker-posted messages, with all the implications
|
||||
of that.
|
||||
|
||||
Notable shortcomings:
|
||||
|
||||
- "v1" of this this API is not suitable for use as an ESM module
|
||||
because ESM worker modules were not widely supported when it was
|
||||
developed. For use as an ESM module, see the "v2" interface later
|
||||
on in this file.
|
||||
- This API was not designed with ES6 modules in mind. Neither Firefox
|
||||
nor Safari support, as of March 2023, the {type:"module"} flag to the
|
||||
Worker constructor, so that particular usage is not something we're going
|
||||
to target for the time being:
|
||||
|
||||
https://developer.mozilla.org/en-US/docs/Web/API/Worker/Worker
|
||||
*/
|
||||
globalThis.sqlite3Worker1Promiser = function callee(config = callee.defaultConfig){
|
||||
// Inspired by: https://stackoverflow.com/a/52439530
|
||||
@@ -255,14 +254,10 @@ globalThis.sqlite3Worker1Promiser = function callee(config = callee.defaultConfi
|
||||
|
||||
globalThis.sqlite3Worker1Promiser.defaultConfig = {
|
||||
worker: function(){
|
||||
//#if target:es6-bundler-friendly
|
||||
//#if target=es6-module
|
||||
return new Worker(new URL("sqlite3-worker1-bundler-friendly.mjs", import.meta.url),{
|
||||
type: 'module'
|
||||
});
|
||||
//#elif target:es6-module
|
||||
return new Worker(new URL("sqlite3-worker1.mjs", import.meta.url),{
|
||||
type: 'module'
|
||||
});
|
||||
//#else
|
||||
let theJs = "sqlite3-worker1.js";
|
||||
if(this.currentScript){
|
||||
@@ -278,15 +273,15 @@ globalThis.sqlite3Worker1Promiser.defaultConfig = {
|
||||
}
|
||||
}
|
||||
return new Worker(theJs + globalThis.location.search);
|
||||
//#/if
|
||||
//#endif
|
||||
}
|
||||
//#if not target:es6-module
|
||||
//#ifnot target=es6-module
|
||||
.bind({
|
||||
currentScript: globalThis?.document?.currentScript
|
||||
})
|
||||
//#/if
|
||||
//#endif
|
||||
,
|
||||
onerror: (...args)=>console.error('sqlite3Worker1Promiser():',...args)
|
||||
onerror: (...args)=>console.error('worker1 promiser error',...args)
|
||||
}/*defaultConfig*/;
|
||||
|
||||
/**
|
||||
@@ -301,7 +296,7 @@ globalThis.sqlite3Worker1Promiser.defaultConfig = {
|
||||
after calling the original function and will reject if that
|
||||
function throws.
|
||||
*/
|
||||
globalThis.sqlite3Worker1Promiser.v2 = function callee(config = callee.defaultConfig){
|
||||
sqlite3Worker1Promiser.v2 = function(config){
|
||||
let oldFunc;
|
||||
if( 'function' == typeof config ){
|
||||
oldFunc = config;
|
||||
@@ -331,25 +326,21 @@ globalThis.sqlite3Worker1Promiser.v2 = function callee(config = callee.defaultCo
|
||||
}
|
||||
return p;
|
||||
}.bind({
|
||||
/* We do this because clients are recommended to delete
|
||||
globalThis.sqlite3Worker1Promiser. */
|
||||
/* We do this because clients are
|
||||
recommended to delete globalThis.sqlite3Worker1Promiser. */
|
||||
original: sqlite3Worker1Promiser
|
||||
});
|
||||
|
||||
globalThis.sqlite3Worker1Promiser.v2.defaultConfig =
|
||||
globalThis.sqlite3Worker1Promiser.defaultConfig;
|
||||
|
||||
//#if target:es6-module
|
||||
//#if target=es6-module
|
||||
/**
|
||||
When built as a module, we export sqlite3Worker1Promiser.v2()
|
||||
instead of sqlite3Worker1Promise() because (A) its interface is more
|
||||
conventional for ESM usage and (B) the ESM export option for this
|
||||
API did not exist until v2 was created, so there's no backwards
|
||||
conventional for ESM usage and (B) the ESM option export option for
|
||||
this API did not exist until v2 was created, so there's no backwards
|
||||
incompatibility.
|
||||
*/
|
||||
export default sqlite3Worker1Promiser.v2;
|
||||
delete globalThis.sqlite3Worker1Promiser;
|
||||
//#/if /* target:es6-module */
|
||||
//#endif /* target=es6-module */
|
||||
//#else
|
||||
/* Built with the omit-oo1 flag. */
|
||||
//#/if if not omit-oo1
|
||||
//#endif ifnot omit-oo1
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">
|
||||
<link rel="stylesheet" href="common/emscripten.css"/>
|
||||
<link rel="stylesheet" href="common/testing.css"/>
|
||||
//#if target:es6-module
|
||||
<title>Worker1-promiser (ESM) tests</title>
|
||||
//#if target=es6-module
|
||||
<title>worker-promise (via ESM) tests</title>
|
||||
//#else
|
||||
<title>Worker1-promiser tests</title>
|
||||
//#/if
|
||||
<title>worker-promise tests</title>
|
||||
//#endif
|
||||
</head>
|
||||
<body>
|
||||
<header id='titlebar'><span>worker-promise tests</span></header>
|
||||
@@ -32,11 +32,11 @@
|
||||
<hr>
|
||||
<div id='test-output'></div>
|
||||
<script src="common/SqliteTestUtil.js"></script>
|
||||
//#if target:es6-module
|
||||
//#if target=es6-module
|
||||
<script src="demo-worker1-promiser.mjs" type="module"></script>
|
||||
//#else
|
||||
<script src="jswasm/sqlite3-worker1-promiser.js"></script>
|
||||
<script src="demo-worker1-promiser.js"></script>
|
||||
//#/if
|
||||
//#endif
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -13,13 +13,13 @@
|
||||
Demonstration of the sqlite3 Worker API #1 Promiser: a Promise-based
|
||||
proxy for for the sqlite3 Worker #1 API.
|
||||
*/
|
||||
//#if target:es6-module
|
||||
//#if target=es6-module
|
||||
import {default as promiserFactory} from "./jswasm/sqlite3-worker1-promiser.mjs";
|
||||
//#else
|
||||
"use strict";
|
||||
const promiserFactory = globalThis.sqlite3Worker1Promiser.v2;
|
||||
delete globalThis.sqlite3Worker1Promiser;
|
||||
//#/if
|
||||
//#endif
|
||||
(async function(){
|
||||
const T = globalThis.SqliteTestUtil;
|
||||
const eOutput = document.querySelector('#test-output');
|
||||
@@ -40,7 +40,7 @@ delete globalThis.sqlite3Worker1Promiser;
|
||||
};
|
||||
|
||||
const promiserConfig = {
|
||||
//#if not target:es6-module
|
||||
//#ifnot target=es6-module
|
||||
/**
|
||||
The v1 interfaces uses an onready function. The v2 interface optionally
|
||||
accepts one but does not require it. If provided, it is called _before_
|
||||
@@ -53,7 +53,7 @@ delete globalThis.sqlite3Worker1Promiser;
|
||||
before workerPromise is set. */
|
||||
console.warn("This is the v2 interface - you don't need an onready() function.");
|
||||
},
|
||||
//#/if
|
||||
//#endif
|
||||
debug: 1 ? undefined : (...args)=>console.debug('worker debug',...args),
|
||||
onunhandled: function(ev){
|
||||
error("Unhandled worker message:",ev.data);
|
||||
@@ -115,7 +115,6 @@ delete globalThis.sqlite3Worker1Promiser;
|
||||
"insert into t(a,b) values(1,2),(3,4),(5,6)"
|
||||
].join(';'),
|
||||
resultRows: [], columnNames: [],
|
||||
lastInsertRowId: true,
|
||||
countChanges: sqConfig.bigIntEnabled ? 64 : true
|
||||
}, function(ev){
|
||||
ev = ev.result;
|
||||
@@ -123,9 +122,7 @@ delete globalThis.sqlite3Worker1Promiser;
|
||||
.assert(0===ev.columnNames.length)
|
||||
.assert(sqConfig.bigIntEnabled
|
||||
? (3n===ev.changeCount)
|
||||
: (3===ev.changeCount))
|
||||
.assert('bigint'===typeof ev.lastInsertRowId)
|
||||
.assert(ev.lastInsertRowId>=3);
|
||||
: (3===ev.changeCount));
|
||||
});
|
||||
|
||||
await wtest('exec',{
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
-->
|
||||
<script src="jqterm/jquery.terminal.bundle.min.js"></script>
|
||||
<link rel="stylesheet" href="jqterm/jquery.terminal.min.css">
|
||||
//#/if
|
||||
//#endif
|
||||
<style>
|
||||
/* The following styles are for app-level use. */
|
||||
:root {
|
||||
@@ -322,9 +322,8 @@
|
||||
<h1>Usage Summary</h1>
|
||||
|
||||
<ul>
|
||||
<li class='hidden unhide-if-terminal-available'>In
|
||||
<a href="https://github.com/jcubic/jquery.terminal">"terminal
|
||||
mode"</a> it accepts input just like the CLI shell does.</li>
|
||||
<li class='hidden unhide-if-terminal-available'>In "terminal
|
||||
mode" it accepts input just like the CLI shell does.</li>
|
||||
<li>In split-view mode:
|
||||
<ul>
|
||||
<li>Input can be executed with either the Run
|
||||
|
||||
@@ -780,6 +780,7 @@ TESTSRC += \
|
||||
$(TOP)/ext/misc/amatch.c \
|
||||
$(TOP)/ext/misc/appendvfs.c \
|
||||
$(TOP)/ext/misc/basexx.c \
|
||||
$(TOP)/ext/misc/bgckpt.c \
|
||||
$(TOP)/ext/misc/cksumvfs.c \
|
||||
$(TOP)/ext/misc/closure.c \
|
||||
$(TOP)/ext/misc/csv.c \
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
C Rename\sthe\sext/misc/analyze.c\sextension\sto\sext/misc/diskused.c,\sto\savoid\nconfusion\swith\sthe\ssrc/analyze.c\sfile.\s\sThe\sfunction\sis\snow\scalled\n"diskused(X)"\sinstead\sof\s"analyze(X)".\s\sThe\sCLI\scommand\sis\srenamed\nfrom\s".dbstat"\sto\s".diskused".
|
||||
D 2026-05-29T14:57:38.380
|
||||
C Merge\sthe\slatest\strunk\senhancements\sand\sfixes\sinto\sthe\swal2\sbranch.
|
||||
D 2026-05-29T18:08:48.599
|
||||
F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
@@ -7,7 +7,7 @@ F AGENTS.md 44ddfb38ef23e277888bd70ae378e6cbf5f5cab0e2a4420bd21d89b6caff7a4a
|
||||
F LICENSE.md 6bc480fc673fb4acbc4094e77edb326267dd460162d7723c7f30bee2d3d9e97d
|
||||
F Makefile.in 5fda086f33b144da08119255da1d2557f983d0764a13707f05acf0159fd89ba5
|
||||
F Makefile.linux-generic bd3e3cacd369821a6241d4ea1967395c962dfe3057e38cb0a435cee0e8b789d0
|
||||
F Makefile.msc 3b2129c90e15ea734682c8769b567012200ac30d7ff1e73c4717e23edbe1bb4b
|
||||
F Makefile.msc 1b910fff2865b4517db9e525ce33bf62988cc8f72feaf6f8fafbe6e41f7f881e
|
||||
F README.md f00091ffb5c6379b783afb57ca5f443a5742e119082f37c407f64a5e16c56346
|
||||
F VERSION 99cf3be5f13d091183e4314b7fc2e0c0e69accfbe64608b45a313338bbdd7b62
|
||||
F art/icon-243x273.gif 9750b734f82fdb3dc43127753d5e6fbf3b62c9f4e136c2fbf573b2f57ea87af5
|
||||
@@ -51,9 +51,9 @@ F autosetup/proj.tcl 67683f214977a416baafc4c1020f9940ff047a7306b2292c5872d628746
|
||||
F autosetup/sqlite-config.tcl 2205b8bcc193a5d46584ebc1cf44c7a93a977d155e20dc38b18dcce720e58074
|
||||
F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9
|
||||
F autosetup/teaish/README.txt b40071e6f8506500a2f7f71d5fc69e0bf87b9d7678dd9da1e5b4d0acbf40b1ca
|
||||
F autosetup/teaish/core.tcl e014dd95900c7f9a34e8e0f460f47e94841059827bce8b4c49668b0c7ae3f1a0
|
||||
F autosetup/teaish/core.tcl 1ebbe849d8e716424a3ffe9384c7e8b352b3e1194d3d4a153b125cc5176b3715
|
||||
F autosetup/teaish/feature.tcl 18194fb79a24d30e5bbdeab40999616f39278b53a27525349ded033af2fd73be
|
||||
F autosetup/teaish/tester.tcl 1799514c2652db49561b3386c5242b94534d1663f2cfac861a955e071895fdd0
|
||||
F autosetup/teaish/tester.tcl 091745984473faea6985254b9986c6dfd0cce06f68bc515ba4afc1e6b3742fa8
|
||||
F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x
|
||||
F contrib/sqlitecon.tcl eb4c6578e08dd353263958da0dc620f8400b869a50d06e271ab0be85a51a08d3
|
||||
F doc/F2FS.txt c1d4a0ae9711cfe0e1d8b019d154f1c29e0d3abfe820787ba1e9ed7691160fcd
|
||||
@@ -69,6 +69,7 @@ F doc/trusted-schema.md 33625008620e879c7bcfbbfa079587612c434fa094d338b08242288d
|
||||
F doc/vdbesort-memory.md 4da2639c14cd24a31e0af694b1a8dd37eaf277aff3867e9a8cc14046bc49df56
|
||||
F doc/vfs-shm.txt 1a55f3f0e7b6745931b117ba5c9df3640d7a0536f532ef0052563100f4416f86
|
||||
F doc/wal-lock.md 7db0cd61e2000b545b78ce89b0c2a9a8dd8d64c097839258ac10d7c5c4156ec1
|
||||
F doc/wal2.md a807405a05e19a4945c5905a9ffa0fe45b8560dd7572461192501f565c19cdb5
|
||||
F ext/README.md 6eb1ac267d917767952ed0ef63f55de003b6a5da433ce1fa389e1a9532e73132
|
||||
F ext/expert/README.md b321c2762bb93c18ea102d5a5f7753a4b8bac646cb392b3b437f633caf2020c3
|
||||
F ext/expert/expert.c d548d603a4cc9e61f446cc179c120c6713511c413f82a4a32b1e1e69d3f086a4
|
||||
@@ -365,6 +366,7 @@ F ext/misc/appendvfs.c 9642c7a194a2a25dca7ad3e36af24a0a46d7702168c4ad7e59c9f9b0e
|
||||
F ext/misc/base64.c 1445761667c16356e827fc6418294c869468be934429aaa8315035e76dd58acf
|
||||
F ext/misc/base85.c c713c7c81b05558c488cbdd8c68d612d5a97f9f0b8adf1167148dd7c89ce3f96
|
||||
F ext/misc/basexx.c 89ad6b76558efbceb627afd5e2ef1d84b2e96d9aaf9b7ecb20e3d00b51be6fcf
|
||||
F ext/misc/bgckpt.c 18cfc9c39ffab3299f730f86ae2991c8574c0bd9ec80efd2f89196798a7b7181
|
||||
F ext/misc/blobio.c a867c4c4617f6ec223a307ebfe0eabb45e0992f74dd47722b96f3e631c0edb2a
|
||||
F ext/misc/btreeinfo.c 5fe97f798a9ee90e92b3031ed7969ec3f558661bb36b821c3ba045a17cfb951c
|
||||
F ext/misc/cksumvfs.c 9d7d0cf1a8893ac5d48922bfe9f3f217b4a61a6265f559263a02bb2001259913
|
||||
@@ -600,7 +602,7 @@ F ext/wasm/api/sqlite3-api-oo1.c-pp.js 35e4727010f15fd72ead0dd1eb4e3c2c9bb1cc60e
|
||||
F ext/wasm/api/sqlite3-api-prologue.js 0084e15d66fbcd75cacbaa58e3b473d5e57082c30f3122be7fdadff5589cf6b6
|
||||
F ext/wasm/api/sqlite3-api-worker1.c-pp.js 1fa34e9b0e3b90a8898e4f700d7125e44c81877f182627bb8564b97989bc6e78
|
||||
F ext/wasm/api/sqlite3-license-version-header.js 98d90255a12d02214db634e041c8e7f2f133d9361a8ebf000ba9c9af4c6761cc
|
||||
F ext/wasm/api/sqlite3-opfs-async-proxy.c-pp.js 25e31482b04293a33d7599f1459eb552b3eb36ca10c02c816122d3308bf80cb2
|
||||
F ext/wasm/api/sqlite3-opfs-async-proxy.c-pp.js 3f85af55609f1452b29c476e59893cbeed417c59560795f50911318e916083b1
|
||||
F ext/wasm/api/sqlite3-vfs-helper.c-pp.js 3f828cc66758acb40e9c5b4dcfd87fd478a14c8fb7f0630264e6c7fa0e57515d
|
||||
F ext/wasm/api/sqlite3-vfs-kvvfs.c-pp.js 27fb135ba3b805b66c90a7333b56080345bf1db79335c3e48b6d01ad7aa09607
|
||||
F ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js 4325cb9a5ebfbff7cd3060e309b167116a2a1bcb9f8d69dd8e6d023dbdd783bb
|
||||
@@ -608,7 +610,7 @@ F ext/wasm/api/sqlite3-vfs-opfs-wl.c-pp.js 3dbd918ef037cd8fa9c7b4dccb3c8637b2286
|
||||
F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 3da8fe72dc9e76614a9c102b92e777ce03f81d788b607701c828d8fcbac44b06
|
||||
F ext/wasm/api/sqlite3-vtab-helper.c-pp.js 366596d8ff73d4cefb938bbe95bc839d503c3fab6c8335ce4bf52f0d8a7dee81
|
||||
F ext/wasm/api/sqlite3-wasm.c ddf9d435b2e901eaceb805ff694e9609c2f32b5cf89a4f164e734a6fa303fdd2
|
||||
F ext/wasm/api/sqlite3-worker1-promiser.c-pp.js 46919740f8176c10f691431a81c769c35657e3b537e2ed2bde691f9017b0ee8a
|
||||
F ext/wasm/api/sqlite3-worker1-promiser.c-pp.js 46f303ba8ddd1b2f0a391798837beddfa72e8c897038c8047eda49ce7d5ed46b
|
||||
F ext/wasm/api/sqlite3-worker1.c-pp.js 21b20d3b8d43471d1647123616a7e5435b1e4b6fa447714f91ffc7f950ea01e8
|
||||
F ext/wasm/common/SqliteTestUtil.js dae753b95e72248c4395d8de8359e0d055cd9928488e8dd84aef89e46d23b32e
|
||||
F ext/wasm/common/emscripten.css 11bd104b6c0d597c67d40cc8ecc0a60dae2b965151e3b6a37fa5708bac3acd15
|
||||
@@ -620,14 +622,14 @@ F ext/wasm/demo-123.html 8c70a412ce386bd3796534257935eb1e3ea5c581e5d5aea0490b823
|
||||
F ext/wasm/demo-123.js c7b3cca50c55841c381a9ca4f9396e5bbdc6114273d0b10a43e378e32e7be5bf
|
||||
F ext/wasm/demo-jsstorage.html 409c4be4af5f207fb2877160724b91b33ea36a3cd8c204e8da1acb828ffe588e
|
||||
F ext/wasm/demo-jsstorage.js 467cb4126ff679ebcdb112d100d073af26b9808d0a0b52d66a40e28f59c5099b
|
||||
F ext/wasm/demo-worker1-promiser.c-pp.html 38e917d4dafa75b4aa0e9e1663abe734c1f701f6da141318bd01ffe3f6e47a77
|
||||
F ext/wasm/demo-worker1-promiser.c-pp.js d210aa1e8a74ea6244fe2290de5710bb55b3a9ed681aaba04e38ceb66550f417
|
||||
F ext/wasm/demo-worker1-promiser.c-pp.html 635cf90685805e21772a5f7a35d1ace80f98a9ef7c42ff04d7a125ddca7e5db8
|
||||
F ext/wasm/demo-worker1-promiser.c-pp.js fcc628cb42fcfaf07d250477801de1e6deb1e319d003976612a0db8d76b9fccc
|
||||
F ext/wasm/demo-worker1.html 2c178c1890a2beb5a5fecb1453e796d067a4b8d3d2a04d65ca2eb1ab2c68ef5d
|
||||
F ext/wasm/demo-worker1.js fdfa90aa9d6b402bfed802cf1595fe4da6cc834ac38c8ff854bf1ee01f5ff9bb
|
||||
F ext/wasm/example_extra_init.c 2347cd69d19d839ef4e5e77b7855103a7fe3ef2af86f2e8c95839afd8b05862f
|
||||
F ext/wasm/fiddle/fiddle-worker.js e45bfe9ce4cf0d0270ca0ed254af8deecc7d46c399db4a56fd1d0846d5e258ec
|
||||
F ext/wasm/fiddle/fiddle.js 2a0984cc4a35e6889c0d84ee9bf853317d5545ddb3966dfb995bbe589f923c4c
|
||||
F ext/wasm/fiddle/index.c-pp.html 5fd1f462864710d1b00d27fc4bc6190cb846cc865d7cc93b99644423f2c4cc84
|
||||
F ext/wasm/fiddle/index.c-pp.html 72c7e5517217960b3809648429ea396a7cbad0ffb2c92f6a2f5703abecb27317
|
||||
F ext/wasm/index-dist.html db23748044e286773f2768eec287669501703b5d5f72755e8db73607dc54d290
|
||||
F ext/wasm/index.html 5bf6cf1b0a3c8b9f5f54d77f2219d7ae87a15162055ce308109c49b1dcab4239
|
||||
F ext/wasm/jaccwabyt/jaccwabyt.js 4e2b797dc170851c9c530c3567679f4aa509eec0fab73b466d945b00b356574b
|
||||
@@ -660,7 +662,7 @@ F ext/wasm/tests/opfs/sahpool/index.html be736567fd92d3ecb9754c145755037cbbd2bca
|
||||
F ext/wasm/tests/opfs/sahpool/sahpool-pausing.js f264925cfc82155de38cecb3d204c36e0f6991460fff0cb7c15079454679a4e2
|
||||
F ext/wasm/tests/opfs/sahpool/sahpool-worker.js bd25a43fc2ab2d1bafd8f2854ad3943ef673f7c3be03e95ecf1612ff6e8e2a61
|
||||
F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0
|
||||
F main.mk 0bbfd0c3d2d3ac908b2a6ab4017bd650be0e694291b7f97490877b7c28a147e4
|
||||
F main.mk 7717e67d2545d3cdfacd8fc9fb5e48f448a35fa65e85a01db36483bd9ab4040e
|
||||
F make.bat a136fd0b1c93e89854a86d5f4edcf0386d211e5d5ec2434480f6eea436c7420c
|
||||
F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271
|
||||
F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504
|
||||
@@ -678,7 +680,7 @@ F src/auth.c b5ece4e1edccad082c0332fa0087df225473bae0feea9269f824312201377185
|
||||
F src/backup.c 6ebe22ccbedfcb92423833992130e8d65824be4e6599c3a03f540ab38fc7d13c
|
||||
F src/bitvec.c e242d4496774dfc88fa278177dd23b607dce369ccafb3f61b41638eea2c9b399
|
||||
F src/btmutex.c 30dada73a819a1ef5b7583786370dce1842e12e1ad941e4d05ac29695528daea
|
||||
F src/btree.c 2f74489af68281d143f5c4e9ef8ba280cee86fce67a64b3eff9344bbabc5dadf
|
||||
F src/btree.c cf1721682bc4d1cd7eb760ad63a9bb1cf9852f9a5c515fc4c55c80519653d763
|
||||
F src/btree.h e823c46d87f63d904d735a24b76146d19f51f04445ea561f71cc3382fd1307f0
|
||||
F src/btreeInt.h 9c0f9ea5c9b5f4dcaea18111d43efe95f2ac276cd86d770dce10fd99ccc93886
|
||||
F src/build.c 866e584cdf40fbc83f530af9fd4d0991582a6fdbd8a9911b7cdbbea5f26a4a9e
|
||||
@@ -726,13 +728,13 @@ F src/os_setup.h 8efc64eda6a6c2f221387eefc2e7e45fd5a3d5c8337a7a83519ba4fbd2957ae
|
||||
F src/os_unix.c 83759942d1ea8d59daed50901c123016f845fada74caf3496b8a2537c9a08838
|
||||
F src/os_win.c 8df4b34ec6a08616a7ac33164999524ef773fa359d39ae9ae0e7e1ae4f167440
|
||||
F src/os_win.h c06ccc3a090cf54202ea58981c298817f3309d4c9e4d52ad0a02927346493721
|
||||
F src/pager.c e0b3b6e39c3a783957d640b28401401d1f3c556803c80695958dd2b9db4ef72d
|
||||
F src/pager.h 6137149346e6c8a3ddc1eeb40aee46381e9bc8b0fcc6dda8a1efde993c2275b8
|
||||
F src/pager.c 5d795a66965165995dc332f2eda46dc200c394e4756e3eab23406f5c4ed7403d
|
||||
F src/pager.h fc0c95d27f2aefffcb39b4373b3557e89e1b4b9a36b183cc04d6f22002bf0ad2
|
||||
F src/parse.y d5a3c5b0277a441c38b35071c05e2b61ff5fc918a63309c809f4b6706179c320
|
||||
F src/pcache.c 588cc3c5ccaaadde689ed35ce5c5c891a1f7b1f4d1f56f6cf0143b74d8ee6484
|
||||
F src/pcache.h 092b758d2c5e4dabb30eae46d8dfad77c0f70b16bf3ff1943f7a232b0fe0d4ba
|
||||
F src/pcache1.c 131ca0daf4e66b4608d2945ae76d6ed90de3f60539afbd5ef9ec65667a5f2fcd
|
||||
F src/pragma.c 789ef67117b74b5be0a2db6681f7f0c55e6913791b9da309aefd280de2c8a74d
|
||||
F src/pragma.c 06feccc280ac006b084e5a03a85466aba46aa75bdd7b3cca5a7343e46a0b8875
|
||||
F src/prepare.c 084a037fd3810cb7ffbfc001cd58c0ffac68ba36598a5084b55ea2a090014ebd
|
||||
F src/printf.c 2bc09ee91d69c709528575bbbee2199e16d6a7e68e1508ac7cf998a7289170ca
|
||||
F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
|
||||
@@ -789,7 +791,7 @@ F src/test_schema.c b06d3ddc3edc173c143878f3edb869dd200d57d918ae2f38820534f9a5e3
|
||||
F src/test_sqllog.c 5abf04865758c0a3915b4ec2b2ee5ab75f74c00e2f05bf503b9083e0ab6829d7
|
||||
F src/test_superlock.c 3387fc794a68d8c6b6ed059aabacbfe870dc502c5cf65562f36aac78b4a4d629
|
||||
F src/test_syscall.c c5bf039261973135068aa68f4d185a6147333dcf266977989f8245b3a1968f1b
|
||||
F src/test_tclsh.c c01706ac60bd3176754d3ccd37da74c6ad97c2e14489f8ed71b497c1c0ac0dd4
|
||||
F src/test_tclsh.c 179e8c9fc722240275d5d9c5d9ff0d8e652c7614f601b8699c41d9c703f7ec38
|
||||
F src/test_tclvar.c ae873248a0188459b1c16ca7cc431265dacce524399e8b46725c2b3b7e048424
|
||||
F src/test_thread.c 3edb4a5b5aeb1a6e9a275dccc848ac95acab7f496b3e9230f6d2d04953a2b862
|
||||
F src/test_vdbecov.c 5c426d9cd2b351f5f9ceb30cabf8c64a63bfcad644c507e0bd9ce2f6ae1a3bf3
|
||||
@@ -805,11 +807,11 @@ F src/upsert.c 215328c3f91623c520ec8672c44323553f12caeb4f01b1090ebdca99fdf7b4f1
|
||||
F src/utf.c 7267c3fb9e2467020507601af3354c2446c61f444387e094c779dccd5ca62165
|
||||
F src/util.c 98cf12c8ba65623a76c1eb6e6afa98ff40107c9919bf79af42f4bfc70e654232
|
||||
F src/vacuum.c d3d35d8ae893d419ade5fa196d761a83bddcbb62137a1a157ae751ef38b26e82
|
||||
F src/vdbe.c 8ed6f274dff8b9fb961d050a9ab933e7f6509221718bec862e85729d171c1606
|
||||
F src/vdbe.c a8ba99604891c2e7779419f00274d7711be3765a9b343f0981c28f30d7dac5f3
|
||||
F src/vdbe.h 70e862ac8a11b590f8c1eaac17a0078429d42bc4ea3f757a9af0f451dd966a71
|
||||
F src/vdbeInt.h c31ba4dc8d280c2b1dc89c6fcee68f2555e3813ab34279552c20b964c0e338b1
|
||||
F src/vdbeapi.c 6cdcbe5c7afa754c998e73d2d5d2805556268362914b952811bdfb9c78a37cf1
|
||||
F src/vdbeaux.c bd3aaf77593a5590f617ce173e8677a21eca18522eadc1c4bc81b53f6d1c7e19
|
||||
F src/vdbeaux.c c09e10e7701357ef998c053b325439a2448534213e8fee11630627a4f327deb4
|
||||
F src/vdbeblob.c b3f0640db9642fbdc88bd6ebcc83d6009514cafc98f062f675f2c8d505d82692
|
||||
F src/vdbemem.c efacb8f229422d2a4db0ed38e49b7f3897862a98d82b261aa3b43d7a2d98c6da
|
||||
F src/vdbesort.c b69220f4ea9ffea5fdef34d968c60305444eea909252a81933b54c296d9cca70
|
||||
@@ -817,8 +819,8 @@ F src/vdbetrace.c 49e689f751505839742f4a243a1a566e57d5c9eaf0d33bbaa26e2de3febf7b
|
||||
F src/vdbevtab.c fc46b9cbd759dc013f0b3724549cc0d71379183c667df3a5988f7e2f1bd485f3
|
||||
F src/vtab.c 5437ce986db2f70e639ce8a3fe68dcdfe64b0f1abb14eaebecdabd5e0766cc68
|
||||
F src/vxworks.h 9d18819c5235b49c2340a8a4d48195ec5d5afb637b152406de95a9436beeaeab
|
||||
F src/wal.c 7340d4f9bb827bd349127cac6b2cf0cb7f76b9fda645f7b9b0bf7a6e0b1e2e7c
|
||||
F src/wal.h ba252daaa94f889f4b2c17c027e823d9be47ce39da1d3799886bbd51f0490452
|
||||
F src/wal.c 6fdaac2cb9a53f47052138a41ed7d102c701c6f98fba87826511c47ad31bf563
|
||||
F src/wal.h 97b8a9903387401377b59507e86b93a148ef1ad4e5ce0f23659a12dcdce56af2
|
||||
F src/walker.c d5006d6b005e4ea7302ad390957a8d41ed83faa177e412f89bc5600a7462a014
|
||||
F src/where.c 33e4a6558ee69f33d6a4e7069e3a40a55959d14e5653a9a83926e70305d471f3
|
||||
F src/whereInt.h 8d94cb116c9e06205c3d5ac87af065fc044f8cf08bfdccd94b6ea1c1308e65da
|
||||
@@ -1000,7 +1002,7 @@ F test/corrupt6.test fc6a891716139665dae0073b6945e3670bf92568
|
||||
F test/corrupt7.test ffa86896fe63a3d00b0a131e1e64f402e4da9f7e5d89609d6501c851e511d73a
|
||||
F test/corrupt8.test 2399dfe40d2c0c63af86706e30f3e6302a8d0516
|
||||
F test/corrupt9.test 730a3db08d4ab9aa43392ea30d9c2b4879cbff85
|
||||
F test/corruptA.test 112f4b2ae0b95ebf3ea63718642fb969a93acea557ace3a307234d19c245989b
|
||||
F test/corruptA.test 56e8f321adaf3411960e9d2c7136669d8e1a91cbde6cf401ea84e6d6c7ccbe10
|
||||
F test/corruptB.test 73a8d6c0b9833697ecf16b63e3c5c05c945b5dec
|
||||
F test/corruptC.test 7d6d9e907334ea3ccb7111a0656cafa30a28f8a5f2aaf1c45ad712236302856a
|
||||
F test/corruptD.test 614320aa519f6bf6c7dd2f581f9513ff7b6826954180cca1a606d0e25ea084a3
|
||||
@@ -1513,7 +1515,7 @@ F test/pcache.test c8acbedd3b6fd0f9a7ca887a83b11d24a007972b
|
||||
F test/pcache2.test af7f3deb1a819f77a6d0d81534e97d1cf62cd442
|
||||
F test/pendingrace.test e99efc5ab3584da3dfc8cd6a0ec4e5a42214820574f5ea24ee93f1d84655f463
|
||||
F test/percentile.test eaee1ff3e35d5fe933ac98d927c9a7d2f4f1a1a19ee22e7d45e97a6d9ee32077
|
||||
F test/permutations.test e6de4f5777f7785737ac3d1d964b8656e5477a134665b2fe8a91884ab9b685b3
|
||||
F test/permutations.test db0a650837cf1eb2128b9c33aac8059933338cf25ccd4c7a089115d6b23368cf
|
||||
F test/pg_common.tcl 3b27542224db1e713ae387459b5d117c836a5f6e328846922993b6d2b7640d9f
|
||||
F test/pragma.test 7d07b7bb76e273215d6a20c4f83c3062cc28976c737ccb70a686025801e86c8f
|
||||
F test/pragma2.test e5d5c176360c321344249354c0c16aec46214c9f
|
||||
@@ -1544,7 +1546,7 @@ F test/quote.test 7b01b2a261bc26d9821aea9f4941ce1e08191d62fc55ba8862440fb3a59197
|
||||
F test/randexpr1.tcl 40dec52119ed3a2b8b2a773bce24b63a3a746459
|
||||
F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df
|
||||
F test/rbu.test 168573d353cd0fd10196b87b0caa322c144ef736
|
||||
F test/rdonly.test 64e2696c322e3538df0b1ed624e21f9a23ed9ff8
|
||||
F test/rdonly.test 21e99ee237265d0cf95a0c84b50c784e834acaa4ef05d92a27b262626a656682
|
||||
F test/readonly.test 0d307c335b3421898cfe64a783a376138aa003849b6bff61ee2d21e805bc0051
|
||||
F test/recover.test 643139b911ac880a1e881d7621f02cfb546b608b8f2494d7d26fd5ed103b1ceb
|
||||
F test/regexp1.sql fd15d317973dd0c9cd9ee7b8bda45ef1c0a5e126223fc53c86d71b5d407e6fb4
|
||||
@@ -1577,7 +1579,7 @@ F test/rowvaluefault.test 963ae9cdaed30a85a29668dd514e639f3556cae903ee9f172ea972
|
||||
F test/rowvaluevtab.test cd9747bb3f308086944c07968f547ad6b05022e698d80b9ffbdfe09ce0b8da6f
|
||||
F test/rtree.test 0c8d9dd458d6824e59683c19ab2ffa9ef946f798
|
||||
F test/run-wordcount.sh 891e89c4c2d16e629cd45951d4ed899ad12afc09
|
||||
F test/savepoint.test 6e9804a17767f08432c7a5e738b9a8f4b891d243110b63d3a41d270d3d1378ec
|
||||
F test/savepoint.test 63a120ec4fbbd5025b238c259d12ed0516fbf4bca6384041cb995ade9a5f00d2
|
||||
F test/savepoint2.test 9b8543940572a2f01a18298c3135ad0c9f4f67d7
|
||||
F test/savepoint4.test c8f8159ade6d2acd9128be61e1230f1c1edc6cc0
|
||||
F test/savepoint5.test 0735db177e0ebbaedc39812c8d065075d563c4fd
|
||||
@@ -1722,7 +1724,7 @@ F test/temptable2.test 76821347810ecc88203e6ef0dd6897b6036ac788e9dd3e6b04fd4d163
|
||||
F test/temptable3.test d11a0974e52b347e45ee54ef1923c91ed91e4637
|
||||
F test/temptrigfault.tes fc5918e64f3867156fefe7cfca9d8e1f495134a5229b2b511b0dc11c07f2eab4
|
||||
F test/temptrigger.test a00f258ed8d21a0e8fd4f322f15e8cfb5cef2e43655670e07a753e3fb4769d61
|
||||
F test/tester.tcl 2d943f60200e0a36bcd3f1f0baf181a751cd3604ef6b6bd4c8dc39b4e8a53116
|
||||
F test/tester.tcl 7a86598eed39bfbfc5dea5f1c35c3e6b0843b2155188ec6f5ed4d2c9fb9d841c
|
||||
F test/testloadext.c 862b848783eaed9985fbce46c65cd214664376b549fae252b364d5d1ef350a27
|
||||
F test/testrunner.tcl 8171b887ab78d55b73fd971e22690eff0fabec913fbf3b5fbeaf159b3f00b2dc x
|
||||
F test/testrunner_data.tcl 4b3cf036d39c98b83f9289a5c047eb01089c932d4f59a81bf764f6800589b959
|
||||
@@ -1946,7 +1948,7 @@ F test/upsert3.test 88d7d590a1948a9cb6eac1b54b0642f67a9f35a1fc0f19b200e97d5d39e3
|
||||
F test/upsert4.test 25d2a1da92f149331ae0c51ca6e3eee78189577585eab92de149900d62994fa5
|
||||
F test/upsert5.test 9953b180d02d1369cdbb6c73c900834e5fef8cb78e98e07511c8762ec21cc176
|
||||
F test/upsertfault.test f21ca47740841fdb4d61acfa7b17646d773e67724fe8c185b71c018db8a94b35
|
||||
F test/uri.test 1250724af9beeed2d6c3716f5b990c483200c54f408d3c0ec9543a3c7961f8fc
|
||||
F test/uri.test 234147e5eda1ef143a8b74ac8f8e9bae363aafa6b8c5813119052f268765d62f
|
||||
F test/uri2.test 9d3ba7a53ee167572d53a298ee4a5d38ec4a8fb7
|
||||
F test/utf16align.test 9fde0bb5d3a821594aa68c6829ab9c5453a084384137ebb9f6153e2d678039da
|
||||
F test/vacuum-into.test 5a489714feecfdabfc7b293be4111564a173dee92c0d6818dd0207f3ade65783
|
||||
@@ -1992,8 +1994,20 @@ F test/vtab_shared.test 5253bff2355a9a3f014c15337da7e177ab0ef8ad
|
||||
F test/vtabdistinct.test 7688f0889358f849fd60bbfde1ded38b014b18066076d4bfbb75395804dfe072
|
||||
F test/vtabdrop.test 65d4cf6722972e5499bdaf0c0d70ee3b8133944a4e4bc31862563f32a7edca12
|
||||
F test/vtabrhs1.test 9b5ecbc74a689500c33a4b2b36761f9bcc22fcc4e3f9d21066ee0c9c74cf5f6c
|
||||
F test/wal.test 519c550255c78f55959e9159b93ebbfad2b4e9f36f5b76284da41f572f9d27da
|
||||
F test/wal.test a5d6c7f4bd79251ed344229d96d44ecdfb896bdbd32b7e65f118756699c7e473
|
||||
F test/wal2.test f058016abe4627d2664db4b4b87990298d925e66a4c5a2c8e674a0ff6f4c841d
|
||||
F test/wal2big.test 829141cbecdda4329db8fa38705424c4a73db72a06b9540b06811a825d330409
|
||||
F test/wal2fault.test 2e8e60cacd5bcd451618aeffd05f676894d17202d3e2986e288d36e2c5993249
|
||||
F test/wal2lock.test 0ef98d72dc6bcf7711dedd684760488400d9a9a6eec0dc5d3822060437793552
|
||||
F test/wal2openclose.test 2b26be723ea7f4263c8d5d70b37efd1c359561a0526e39466c45fe8e6478daee
|
||||
F test/wal2recover.test 348a3f2a4c79359790f70fd692dcd0c8f04e42a85365e688778c945e10bae02b
|
||||
F test/wal2recover2.test 3fe5d5932b16a3a38304a85bafed1f965faef40c230fd450838a0502e61343bb
|
||||
F test/wal2recover3.test 4a91689e165a38bc401736e6518188c2b0ff4fa1566d1810b8867536db128177
|
||||
F test/wal2rewrite.test 6ca6f631ffcf871240beab5f02608913fd075c6d0d31310b026c8383c65c9f9c
|
||||
F test/wal2rollback.test 23adc4a099b23f6aaea8b04fdca1c35861d887dd80f8be7da2d5273eb777e428
|
||||
F test/wal2savepoint.test c380512ec1f97012cfc753e718bf3df38f51e7c319110e1cae25094a33b371c4
|
||||
F test/wal2simple.test d2d94fe1f30700c9f30e46c16f1c3d7d245b861a1be2bfe5ead701484c6dd38e
|
||||
F test/wal2snapshot.test 7a5f4629a3c43a43c3440b8b2ea9f07de91a46b0b9eea5f08f62b5bf5b6468df
|
||||
F test/wal3.test 5de023bb862fd1eb9d2ad26fa8d9c43abb5370582e5b08b2ae0d6f93661bc310
|
||||
F test/wal4.test 4744e155cd6299c6bd99d3eab1c82f77db9cdb3c
|
||||
F test/wal5.test 9c11da7aeccd83a46d79a556ad11a18d3cb15aa9
|
||||
@@ -2020,7 +2034,7 @@ F test/walnoshm.test 844b3eb7d8e8ee76c834ef723babec57b0be51fa52ef7e321c289ed0fe3
|
||||
F test/waloverwrite.test dad2f26567f1b45174e54fbf9a8dc1cb876a7f03
|
||||
F test/walpersist.test 8d78a1ec91299163451417b451a2bac3481f8eb9f455b1ca507a6625c927ca6e
|
||||
F test/walprotocol.test 1b3f922125e341703f6e946d77fdc564d38fb3e07a9385cfdc6c99cac1ecf878
|
||||
F test/walprotocol2.test 7d3b6b4bf0b12f8007121b1e6ef714bc99101fb3b48e46371df1db868eebc131
|
||||
F test/walprotocol2.test 7e4bedd5ee83607e2928ac438bf7332a396b980d3e02aa0746509ce11ad1f13c
|
||||
F test/walrestart.test 5168c0c2414d1971d8dec949c1070a0144cf15402361ba0d0e6a8054f5598a64
|
||||
F test/walro.test 78a84bc0fdae1385c06b017215c426b6845734d6a5a3ac75c918dd9b801b1b9d
|
||||
F test/walro2.test 33955a6fd874dd9724005e17f77fef89d334b3171454a1256fe4941a96766cdc
|
||||
@@ -2149,7 +2163,7 @@ F tool/mkamalzip.tcl 8aa5ebe7973c8b8774062d34e15fea9815c4cc2ceea3a9b184695f00591
|
||||
F tool/mkautoconfamal.sh 06fbe090b81c24e592c1f22b404334f805ba74d482a9260f2ac81e6f3d3386d8
|
||||
F tool/mkccode.tcl c42a8f8cf78f92e83795d5447460dbce7aaf78a3bbf9082f1507dc71a3665f3c x
|
||||
F tool/mkcombo.tcl 2a5189b219c4a495e1ff7fc980bd568d3cfb82ae9d50c84e77f7a161e96fc132
|
||||
F tool/mkctimec.tcl 68f3ee9e2e6a06524b25d79b5b61a883053466080a39da59e0a0697f0c4d9a3b x
|
||||
F tool/mkctimec.tcl bbaa2265949d8825c68ceacd76d5c230b247493547ce9e6c08335e73055cdf4d x
|
||||
F tool/mkfptab.c 24ea40113f96584caca3f6dd06b4ad5adffa0f39023910cb83fa7ef2ffa9b0ba
|
||||
F tool/mkkeywordhash.c 82d5af1d0e677900739fba59155cddac172d8c712c2d91ab73d6e6bcb30060f0
|
||||
F tool/mkmsvcmin.tcl d76c45efda1cce2d4005bcea7b8a22bb752e3256009f331120fb4fecb14ebb7a
|
||||
@@ -2203,13 +2217,13 @@ F tool/tclConfigShToMake.sh 7c065d81c2d178e15e45a77372c6e5a38b5a1b08755301cd6f20
|
||||
F tool/varint.c 5d94cb5003db9dbbcbcc5df08d66f16071aee003
|
||||
F tool/vdbe-compress.tcl fa2f37ab39b2a0087fafb6a7f3ce19503e25e624ffa8ed9951717ab72920c088
|
||||
F tool/vdbe_profile.tcl 3ac5a4a9449f4baf77059358ea050db3e34395ccf59c5464d29b91746d5b961e
|
||||
F tool/version-info.c 33d0390ef484b3b1cb685d59362be891ea162123cea181cb8e6d2cf6ddf2700c
|
||||
F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd72273503ae7d5
|
||||
F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
|
||||
F tool/warnings.sh a554d13f6e5cf3760f041b87939e3d616ec6961859c3245e8ef701d1eafc2ca2
|
||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||
F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c
|
||||
P d15cd64160192119a5f12afec14dbfbb30fb38a8557cb9dc559b3f061c15687a
|
||||
R b94ebbf5e61926662e4d4c59c4ea9472
|
||||
P 28d1d29ad465b150ea705af8352c0e6599b3f42c15474b2ae89e8a2c2b9b097c c7839f7a1749b38f8a36c06d93a7b59095e91ce753e8dd020de273ca8f73a239
|
||||
R da9eb2c8c6fc545fa76a8916647efb64
|
||||
U drh
|
||||
Z c87a787fc483b6eb7052d881e8ec7a13
|
||||
Z 81655c913c3efc0b9200f9ede46569c5
|
||||
# Remove this line to create a well-formed Fossil manifest.
|
||||
|
||||
+2
-2
@@ -1,2 +1,2 @@
|
||||
branch trunk
|
||||
tag trunk
|
||||
branch wal2
|
||||
tag wal2
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
c7839f7a1749b38f8a36c06d93a7b59095e91ce753e8dd020de273ca8f73a239
|
||||
d8cf1a62aff38de008f9b826c4846b15e37c89dc0f8bb412b79349da4d1580b0
|
||||
|
||||
+5
-5
@@ -3329,10 +3329,10 @@ static int lockBtree(BtShared *pBt){
|
||||
goto page1_init_failed;
|
||||
}
|
||||
#else
|
||||
if( page1[18]>2 ){
|
||||
if( page1[18]>3 ){
|
||||
pBt->btsFlags |= BTS_READ_ONLY;
|
||||
}
|
||||
if( page1[19]>2 ){
|
||||
if( page1[19]>3 ){
|
||||
goto page1_init_failed;
|
||||
}
|
||||
|
||||
@@ -3344,9 +3344,9 @@ static int lockBtree(BtShared *pBt){
|
||||
** may not be the latest version - there may be a newer one in the log
|
||||
** file.
|
||||
*/
|
||||
if( page1[19]==2 && (pBt->btsFlags & BTS_NO_WAL)==0 ){
|
||||
if( page1[19]>=2 && (pBt->btsFlags & BTS_NO_WAL)==0 ){
|
||||
int isOpen = 0;
|
||||
rc = sqlite3PagerOpenWal(pBt->pPager, &isOpen);
|
||||
rc = sqlite3PagerOpenWal(pBt->pPager, (page1[19]==3), &isOpen);
|
||||
if( rc!=SQLITE_OK ){
|
||||
goto page1_init_failed;
|
||||
}else{
|
||||
@@ -11510,7 +11510,7 @@ int sqlite3BtreeSetVersion(Btree *pBtree, int iVersion){
|
||||
BtShared *pBt = pBtree->pBt;
|
||||
int rc; /* Return code */
|
||||
|
||||
assert( iVersion==1 || iVersion==2 );
|
||||
assert( iVersion==1 || iVersion==2 || iVersion==3 );
|
||||
|
||||
/* If setting the version fields to 1, do not automatically open the
|
||||
** WAL connection, even if the version fields are currently set to 2.
|
||||
|
||||
+28
-10
@@ -932,6 +932,7 @@ static int assert_pager_state(Pager *p){
|
||||
assert( isOpen(p->jfd)
|
||||
|| p->journalMode==PAGER_JOURNALMODE_OFF
|
||||
|| p->journalMode==PAGER_JOURNALMODE_WAL
|
||||
|| p->journalMode==PAGER_JOURNALMODE_WAL2
|
||||
);
|
||||
}
|
||||
assert( pPager->dbOrigSize==pPager->dbFileSize );
|
||||
@@ -946,6 +947,7 @@ static int assert_pager_state(Pager *p){
|
||||
assert( isOpen(p->jfd)
|
||||
|| p->journalMode==PAGER_JOURNALMODE_OFF
|
||||
|| p->journalMode==PAGER_JOURNALMODE_WAL
|
||||
|| p->journalMode==PAGER_JOURNALMODE_WAL2
|
||||
|| (sqlite3OsDeviceCharacteristics(p->fd)&SQLITE_IOCAP_BATCH_ATOMIC)
|
||||
);
|
||||
assert( pPager->dbOrigSize<=pPager->dbHintSize );
|
||||
@@ -958,6 +960,7 @@ static int assert_pager_state(Pager *p){
|
||||
assert( isOpen(p->jfd)
|
||||
|| p->journalMode==PAGER_JOURNALMODE_OFF
|
||||
|| p->journalMode==PAGER_JOURNALMODE_WAL
|
||||
|| p->journalMode==PAGER_JOURNALMODE_WAL2
|
||||
|| (sqlite3OsDeviceCharacteristics(p->fd)&SQLITE_IOCAP_BATCH_ATOMIC)
|
||||
);
|
||||
break;
|
||||
@@ -2103,6 +2106,7 @@ static int pager_end_transaction(Pager *pPager, int hasSuper, int bCommit){
|
||||
assert( pPager->journalMode==PAGER_JOURNALMODE_DELETE
|
||||
|| pPager->journalMode==PAGER_JOURNALMODE_MEMORY
|
||||
|| pPager->journalMode==PAGER_JOURNALMODE_WAL
|
||||
|| pPager->journalMode==PAGER_JOURNALMODE_WAL2
|
||||
);
|
||||
sqlite3OsClose(pPager->jfd);
|
||||
if( bDelete ){
|
||||
@@ -3261,6 +3265,10 @@ static int pagerBeginReadTransaction(Pager *pPager){
|
||||
if( rc!=SQLITE_OK || changed ){
|
||||
pager_reset(pPager);
|
||||
if( USEFETCH(pPager) ) sqlite3OsUnfetch(pPager->fd, 0, 0);
|
||||
assert( pPager->journalMode==PAGER_JOURNALMODE_WAL
|
||||
|| pPager->journalMode==PAGER_JOURNALMODE_WAL2
|
||||
);
|
||||
pPager->journalMode = sqlite3WalJournalMode(pPager->pWal);
|
||||
}
|
||||
|
||||
return rc;
|
||||
@@ -3356,9 +3364,9 @@ static int pagerOpenWalIfPresent(Pager *pPager){
|
||||
rc = sqlite3OsDelete(pPager->pVfs, pPager->zWal, 0);
|
||||
}else{
|
||||
testcase( sqlite3PcachePagecount(pPager->pPCache)==0 );
|
||||
rc = sqlite3PagerOpenWal(pPager, 0);
|
||||
rc = sqlite3PagerOpenWal(pPager, 0, 0);
|
||||
}
|
||||
}else if( pPager->journalMode==PAGER_JOURNALMODE_WAL ){
|
||||
}else if( pPager->journalMode>=PAGER_JOURNALMODE_WAL ){
|
||||
pPager->journalMode = PAGER_JOURNALMODE_DELETE;
|
||||
}
|
||||
}
|
||||
@@ -4879,6 +4887,7 @@ int sqlite3PagerOpen(
|
||||
(u64)nPathname + 8 + 1 + /* Journal filename */
|
||||
#ifndef SQLITE_OMIT_WAL
|
||||
(u64)nPathname + 4 + 1 + /* WAL filename */
|
||||
nPathname + 5 + 1 + /* Second WAL filename */
|
||||
#endif
|
||||
3 /* Terminator */
|
||||
);
|
||||
@@ -4931,6 +4940,8 @@ int sqlite3PagerOpen(
|
||||
sqlite3FileSuffix3(zFilename, pPager->zWal);
|
||||
pPtr = (u8*)(pPager->zWal + sqlite3Strlen30(pPager->zWal)+1);
|
||||
#endif
|
||||
memcpy(pPtr, zPathname, nPathname); pPtr += nPathname;
|
||||
memcpy(pPtr, "-wal2", 5); pPtr += 5 + 1;
|
||||
}else{
|
||||
pPager->zWal = 0;
|
||||
}
|
||||
@@ -7367,7 +7378,8 @@ int sqlite3PagerSetJournalMode(Pager *pPager, int eMode){
|
||||
|| eMode==PAGER_JOURNALMODE_OFF /* 2 */
|
||||
|| eMode==PAGER_JOURNALMODE_TRUNCATE /* 3 */
|
||||
|| eMode==PAGER_JOURNALMODE_MEMORY /* 4 */
|
||||
|| eMode==PAGER_JOURNALMODE_WAL /* 5 */ );
|
||||
|| eMode==PAGER_JOURNALMODE_WAL /* 5 */
|
||||
|| eMode==PAGER_JOURNALMODE_WAL2 /* 6 */ );
|
||||
|
||||
/* This routine is only called from the OP_JournalMode opcode, and
|
||||
** the logic there will never allow a temporary file to be changed
|
||||
@@ -7401,9 +7413,12 @@ int sqlite3PagerSetJournalMode(Pager *pPager, int eMode){
|
||||
assert( (PAGER_JOURNALMODE_MEMORY & 5)==4 );
|
||||
assert( (PAGER_JOURNALMODE_OFF & 5)==0 );
|
||||
assert( (PAGER_JOURNALMODE_WAL & 5)==5 );
|
||||
assert( (PAGER_JOURNALMODE_WAL2 & 5)==4 );
|
||||
|
||||
assert( isOpen(pPager->fd) || pPager->exclusiveMode );
|
||||
if( !pPager->exclusiveMode && (eOld & 5)==1 && (eMode & 1)==0 ){
|
||||
if( !pPager->exclusiveMode && (eOld & 5)==1 && (eMode & 1)==0
|
||||
&& eMode!=PAGER_JOURNALMODE_WAL2 /* TODO: fix this if possible */
|
||||
){
|
||||
/* In this case we would like to delete the journal file. If it is
|
||||
** not possible, then that is not a problem. Deleting the journal file
|
||||
** here is an optimization only.
|
||||
@@ -7578,7 +7593,7 @@ static int pagerExclusiveLock(Pager *pPager){
|
||||
** lock on the database file and use heap-memory to store the wal-index
|
||||
** in. Otherwise, use the normal shared-memory.
|
||||
*/
|
||||
static int pagerOpenWal(Pager *pPager){
|
||||
static int pagerOpenWal(Pager *pPager, int bWal2){
|
||||
int rc = SQLITE_OK;
|
||||
|
||||
assert( pPager->pWal==0 && pPager->tempFile==0 );
|
||||
@@ -7599,7 +7614,7 @@ static int pagerOpenWal(Pager *pPager){
|
||||
if( rc==SQLITE_OK ){
|
||||
rc = sqlite3WalOpen(pPager->pVfs,
|
||||
pPager->fd, pPager->zWal, pPager->exclusiveMode,
|
||||
pPager->journalSizeLimit, &pPager->pWal
|
||||
pPager->journalSizeLimit, bWal2, &pPager->pWal
|
||||
);
|
||||
#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
|
||||
if( rc==SQLITE_OK ){
|
||||
@@ -7630,6 +7645,7 @@ static int pagerOpenWal(Pager *pPager){
|
||||
*/
|
||||
int sqlite3PagerOpenWal(
|
||||
Pager *pPager, /* Pager object */
|
||||
int bWal2, /* Open in wal2 mode if not already open */
|
||||
int *pbOpen /* OUT: Set to true if call is a no-op */
|
||||
){
|
||||
int rc = SQLITE_OK; /* Return code */
|
||||
@@ -7646,9 +7662,9 @@ int sqlite3PagerOpenWal(
|
||||
/* Close any rollback journal previously open */
|
||||
sqlite3OsClose(pPager->jfd);
|
||||
|
||||
rc = pagerOpenWal(pPager);
|
||||
rc = pagerOpenWal(pPager, bWal2);
|
||||
if( rc==SQLITE_OK ){
|
||||
pPager->journalMode = PAGER_JOURNALMODE_WAL;
|
||||
pPager->journalMode = bWal2?PAGER_JOURNALMODE_WAL2:PAGER_JOURNALMODE_WAL;
|
||||
pPager->eState = PAGER_OPEN;
|
||||
}
|
||||
}else{
|
||||
@@ -7670,7 +7686,9 @@ int sqlite3PagerOpenWal(
|
||||
int sqlite3PagerCloseWal(Pager *pPager, sqlite3 *db){
|
||||
int rc = SQLITE_OK;
|
||||
|
||||
assert( pPager->journalMode==PAGER_JOURNALMODE_WAL );
|
||||
assert( pPager->journalMode==PAGER_JOURNALMODE_WAL
|
||||
|| pPager->journalMode==PAGER_JOURNALMODE_WAL2
|
||||
);
|
||||
|
||||
/* If the log file is not already open, but does exist in the file-system,
|
||||
** it may need to be checkpointed before the connection can switch to
|
||||
@@ -7685,7 +7703,7 @@ int sqlite3PagerCloseWal(Pager *pPager, sqlite3 *db){
|
||||
);
|
||||
}
|
||||
if( rc==SQLITE_OK && logexists ){
|
||||
rc = pagerOpenWal(pPager);
|
||||
rc = pagerOpenWal(pPager, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -82,8 +82,9 @@ typedef struct PgHdr DbPage;
|
||||
#define PAGER_JOURNALMODE_TRUNCATE 3 /* Commit by truncating journal */
|
||||
#define PAGER_JOURNALMODE_MEMORY 4 /* In-memory journal file */
|
||||
#define PAGER_JOURNALMODE_WAL 5 /* Use write-ahead logging */
|
||||
#define PAGER_JOURNALMODE_WAL2 6 /* Use write-ahead logging mode 2 */
|
||||
|
||||
#define isWalMode(x) ((x)==PAGER_JOURNALMODE_WAL)
|
||||
#define isWalMode(x) ((x)==PAGER_JOURNALMODE_WAL || (x)==PAGER_JOURNALMODE_WAL2)
|
||||
|
||||
/*
|
||||
** The argument to this macro is a file descriptor (type sqlite3_file*).
|
||||
@@ -191,7 +192,7 @@ int sqlite3PagerSharedLock(Pager *pPager);
|
||||
int sqlite3PagerCheckpoint(Pager *pPager, sqlite3*, int, int*, int*);
|
||||
int sqlite3PagerWalSupported(Pager *pPager);
|
||||
int sqlite3PagerWalCallback(Pager *pPager);
|
||||
int sqlite3PagerOpenWal(Pager *pPager, int *pisOpen);
|
||||
int sqlite3PagerOpenWal(Pager *pPager, int, int *pisOpen);
|
||||
int sqlite3PagerCloseWal(Pager *pPager, sqlite3*);
|
||||
# ifdef SQLITE_ENABLE_SNAPSHOT
|
||||
int sqlite3PagerSnapshotGet(Pager*, sqlite3_snapshot **ppSnapshot);
|
||||
|
||||
+2
-1
@@ -290,7 +290,7 @@ const char *sqlite3JournalModename(int eMode){
|
||||
static char * const azModeName[] = {
|
||||
"delete", "persist", "off", "truncate", "memory"
|
||||
#ifndef SQLITE_OMIT_WAL
|
||||
, "wal"
|
||||
, "wal", "wal2"
|
||||
#endif
|
||||
};
|
||||
assert( PAGER_JOURNALMODE_DELETE==0 );
|
||||
@@ -299,6 +299,7 @@ const char *sqlite3JournalModename(int eMode){
|
||||
assert( PAGER_JOURNALMODE_TRUNCATE==3 );
|
||||
assert( PAGER_JOURNALMODE_MEMORY==4 );
|
||||
assert( PAGER_JOURNALMODE_WAL==5 );
|
||||
assert( PAGER_JOURNALMODE_WAL2==6 );
|
||||
assert( eMode>=0 && eMode<=ArraySize(azModeName) );
|
||||
|
||||
if( eMode==ArraySize(azModeName) ) return 0;
|
||||
|
||||
@@ -90,6 +90,7 @@ const char *sqlite3TestInit(Tcl_Interp *interp){
|
||||
extern int Fts5tcl_Init(Tcl_Interp *);
|
||||
extern int SqliteRbu_Init(Tcl_Interp*);
|
||||
extern int Sqlitetesttcl_Init(Tcl_Interp*);
|
||||
extern int Bgckpt_Init(Tcl_Interp*);
|
||||
#if defined(SQLITE_ENABLE_FTS3) || defined(SQLITE_ENABLE_FTS4)
|
||||
extern int Sqlitetestfts3_Init(Tcl_Interp *interp);
|
||||
#endif
|
||||
@@ -159,6 +160,8 @@ const char *sqlite3TestInit(Tcl_Interp *interp){
|
||||
Fts5tcl_Init(interp);
|
||||
SqliteRbu_Init(interp);
|
||||
Sqlitetesttcl_Init(interp);
|
||||
Bgckpt_Init(interp);
|
||||
|
||||
|
||||
#if defined(SQLITE_ENABLE_FTS3) || defined(SQLITE_ENABLE_FTS4)
|
||||
Sqlitetestfts3_Init(interp);
|
||||
|
||||
+19
-6
@@ -8124,6 +8124,7 @@ case OP_JournalMode: { /* out2 */
|
||||
|| eNew==PAGER_JOURNALMODE_OFF
|
||||
|| eNew==PAGER_JOURNALMODE_MEMORY
|
||||
|| eNew==PAGER_JOURNALMODE_WAL
|
||||
|| eNew==PAGER_JOURNALMODE_WAL2
|
||||
|| eNew==PAGER_JOURNALMODE_QUERY
|
||||
);
|
||||
assert( pOp->p1>=0 && pOp->p1<db->nDb );
|
||||
@@ -8142,16 +8143,25 @@ case OP_JournalMode: { /* out2 */
|
||||
/* Do not allow a transition to journal_mode=WAL for a database
|
||||
** in temporary storage or if the VFS does not support shared memory
|
||||
*/
|
||||
if( eNew==PAGER_JOURNALMODE_WAL
|
||||
if( isWalMode(eNew)
|
||||
&& (sqlite3Strlen30(zFilename)==0 /* Temp file */
|
||||
|| !sqlite3PagerWalSupported(pPager)) /* No shared-memory support */
|
||||
){
|
||||
eNew = eOld;
|
||||
}
|
||||
|
||||
if( (eNew!=eOld)
|
||||
&& (eOld==PAGER_JOURNALMODE_WAL || eNew==PAGER_JOURNALMODE_WAL)
|
||||
){
|
||||
if( eNew!=eOld && (isWalMode(eNew) || isWalMode(eOld)) ){
|
||||
|
||||
/* Prevent changing directly to wal2 from wal mode. And vice versa. */
|
||||
if( isWalMode(eNew) && isWalMode(eOld) ){
|
||||
rc = SQLITE_ERROR;
|
||||
sqlite3VdbeError(p, "cannot change from %s to %s mode",
|
||||
sqlite3JournalModename(eOld), sqlite3JournalModename(eNew)
|
||||
);
|
||||
goto abort_due_to_error;
|
||||
}
|
||||
|
||||
/* Prevent switching into or out of wal/wal2 mode mid-transaction */
|
||||
if( !db->autoCommit || db->nVdbeRead>1 ){
|
||||
rc = SQLITE_ERROR;
|
||||
sqlite3VdbeError(p,
|
||||
@@ -8161,7 +8171,7 @@ case OP_JournalMode: { /* out2 */
|
||||
goto abort_due_to_error;
|
||||
}else{
|
||||
|
||||
if( eOld==PAGER_JOURNALMODE_WAL ){
|
||||
if( isWalMode(eOld) ){
|
||||
/* If leaving WAL mode, close the log file. If successful, the call
|
||||
** to PagerCloseWal() checkpoints and deletes the write-ahead-log
|
||||
** file. An EXCLUSIVE lock may still be held on the database file
|
||||
@@ -8182,7 +8192,10 @@ case OP_JournalMode: { /* out2 */
|
||||
*/
|
||||
assert( sqlite3BtreeTxnState(pBt)!=SQLITE_TXN_WRITE );
|
||||
if( rc==SQLITE_OK ){
|
||||
rc = sqlite3BtreeSetVersion(pBt, (eNew==PAGER_JOURNALMODE_WAL ? 2 : 1));
|
||||
/* 1==rollback, 2==wal, 3==wal2 */
|
||||
rc = sqlite3BtreeSetVersion(pBt,
|
||||
1 + isWalMode(eNew) + (eNew==PAGER_JOURNALMODE_WAL2)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -2966,7 +2966,8 @@ static int vdbeCommit(sqlite3 *db, Vdbe *p){
|
||||
/* OFF */ 0,
|
||||
/* TRUNCATE */ 1,
|
||||
/* MEMORY */ 0,
|
||||
/* WAL */ 0
|
||||
/* WAL */ 0,
|
||||
/* WAL2 */ 0
|
||||
};
|
||||
Pager *pPager; /* Pager associated with pBt */
|
||||
needXcommit = 1;
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#define CKPT_SYNC_FLAGS(X) (((X)>>2)&0x03)
|
||||
|
||||
#ifdef SQLITE_OMIT_WAL
|
||||
# define sqlite3WalOpen(x,y,z) 0
|
||||
# define sqlite3WalOpen(w,x,y,z) 0
|
||||
# define sqlite3WalLimit(x,y)
|
||||
# define sqlite3WalClose(v,w,x,y,z) 0
|
||||
# define sqlite3WalBeginReadTransaction(y,z) 0
|
||||
@@ -45,6 +45,7 @@
|
||||
# define sqlite3WalFramesize(z) 0
|
||||
# define sqlite3WalFindFrame(x,y,z) 0
|
||||
# define sqlite3WalFile(x) 0
|
||||
# define sqlite3WalJournalMode(x) 0
|
||||
# undef SQLITE_USE_SEH
|
||||
#else
|
||||
|
||||
@@ -56,7 +57,7 @@
|
||||
typedef struct Wal Wal;
|
||||
|
||||
/* Open and close a connection to a write-ahead log. */
|
||||
int sqlite3WalOpen(sqlite3_vfs*, sqlite3_file*, const char *, int, i64, Wal**);
|
||||
int sqlite3WalOpen(sqlite3_vfs*, sqlite3_file*, const char *,int,i64,int,Wal**);
|
||||
int sqlite3WalClose(Wal *pWal, sqlite3*, int sync_flags, int, u8 *);
|
||||
|
||||
/* Set the limiting size of a WAL file. */
|
||||
@@ -147,6 +148,9 @@ int sqlite3WalFramesize(Wal *pWal);
|
||||
/* Return the sqlite3_file object for the WAL file */
|
||||
sqlite3_file *sqlite3WalFile(Wal *pWal);
|
||||
|
||||
/* Return the journal mode (WAL or WAL2) used by this Wal object. */
|
||||
int sqlite3WalJournalMode(Wal *pWal);
|
||||
|
||||
#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
|
||||
int sqlite3WalWriteLock(Wal *pWal, int bLock);
|
||||
void sqlite3WalDb(Wal *pWal, sqlite3 *db);
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ db close
|
||||
forcecopy test.db test.db-template
|
||||
|
||||
set unreadable_version 02
|
||||
ifcapable wal { set unreadable_version 03 }
|
||||
ifcapable wal { set unreadable_version 04 }
|
||||
do_test corruptA-2.1 {
|
||||
forcecopy test.db-template test.db
|
||||
hexio_write test.db 19 $unreadable_version ;# the read format number
|
||||
|
||||
+29
-9
@@ -465,18 +465,21 @@ lappend ::testsuitelist xxx
|
||||
test_suite "coverage-wal" -description {
|
||||
Coverage tests for file wal.c.
|
||||
} -files {
|
||||
wal.test wal2.test wal3.test wal4.test wal5.test
|
||||
wal2big.test wal2recover.test wal2rewrite.test
|
||||
wal2simple.test wal2snapshot.test wal2.test
|
||||
wal3.test wal4.test wal5.test
|
||||
wal64k.test wal6.test wal7.test wal8.test wal9.test
|
||||
walbak.test walbig.test walblock.test walcksum.test walcrash2.test
|
||||
walcrash3.test walcrash4.test walcrash.test walfault.test walhook.test
|
||||
walmode.test walnoshm.test waloverwrite.test walpersist.test
|
||||
walprotocol2.test walprotocol.test walro2.test walrofault.test
|
||||
walro.test walshared.test walslow.test walvfs.test
|
||||
walfault2.test
|
||||
nockpt.test
|
||||
|
||||
walbak.test walbig.test walblock.test walcksum.test
|
||||
walfault.test walhook.test walmode.test walnoshm.test
|
||||
waloverwrite.test walpersist.test walprotocol2.test
|
||||
walprotocol.test walro2.test walrofault.test walro.test
|
||||
walshared.test walslow.test wal.test
|
||||
wal2savepoint.test wal2lock.test wal2recover2.test
|
||||
walvfs.test walfault2.test nockpt.test
|
||||
snapshot2.test snapshot3.test snapshot4.test
|
||||
snapshot_fault.test snapshot.test snapshot_up.test
|
||||
walcrash2.test walcrash3.test walcrash4.test walcrash.test
|
||||
wal2fault.test
|
||||
}
|
||||
|
||||
test_suite "coverage-pager" -description {
|
||||
@@ -1033,6 +1036,23 @@ test_suite "wal" -description {
|
||||
fts3c.test fts3d.test fts3e.test fts3query.test
|
||||
}
|
||||
|
||||
test_suite "wal2" -description {
|
||||
Run tests with journal_mode=WAL2
|
||||
} -initialize {
|
||||
set ::G(savepoint6_iterations) 100
|
||||
} -shutdown {
|
||||
unset -nocomplain ::G(savepoint6_iterations)
|
||||
} -files {
|
||||
savepoint.test savepoint2.test savepoint6.test
|
||||
trans.test avtrans.test
|
||||
|
||||
fts3aa.test fts3ab.test fts3ac.test fts3ad.test
|
||||
fts3ae.test fts3af.test fts3ag.test fts3ah.test
|
||||
fts3ai.test fts3aj.test fts3ak.test fts3al.test
|
||||
fts3am.test fts3an.test fts3ao.test fts3b.test
|
||||
fts3c.test fts3d.test fts3e.test fts3query.test
|
||||
}
|
||||
|
||||
test_suite "rtree" -description {
|
||||
All R-tree related tests. Provides coverage of source file rtree.c.
|
||||
} -files [glob -nocomplain $::testdir/../ext/rtree/*.test]
|
||||
|
||||
+3
-3
@@ -41,7 +41,7 @@ do_test rdonly-1.1.1 {
|
||||
sqlite3_db_readonly db main
|
||||
} {0}
|
||||
|
||||
# Changes the write version from 1 to 3. Verify that the database
|
||||
# Changes the write version from 1 to 4. Verify that the database
|
||||
# can be read but not written.
|
||||
#
|
||||
do_test rdonly-1.2 {
|
||||
@@ -49,7 +49,7 @@ do_test rdonly-1.2 {
|
||||
hexio_get_int [hexio_read test.db 18 1]
|
||||
} 1
|
||||
do_test rdonly-1.3 {
|
||||
hexio_write test.db 18 03
|
||||
hexio_write test.db 18 04
|
||||
sqlite3 db test.db
|
||||
execsql {
|
||||
SELECT * FROM t1;
|
||||
@@ -83,7 +83,7 @@ do_test rdonly-1.5 {
|
||||
# the database is read-only until after it is locked.
|
||||
#
|
||||
set ro_version 02
|
||||
ifcapable wal { set ro_version 03 }
|
||||
ifcapable wal { set ro_version 04 }
|
||||
do_test rdonly-1.6 {
|
||||
hexio_write test.db 18 $ro_version ; # write-version
|
||||
hexio_write test.db 24 11223344 ; # change-counter
|
||||
|
||||
+3
-1
@@ -30,6 +30,7 @@ do_test savepoint-1.1 {
|
||||
RELEASE sp1;
|
||||
}
|
||||
} {}
|
||||
wal_check_journal_mode savepoint-1.1
|
||||
do_test savepoint-1.2 {
|
||||
execsql {
|
||||
SAVEPOINT sp1;
|
||||
@@ -807,7 +808,8 @@ do_test savepoint-11.6 {
|
||||
integrity_check savepoint-11.7
|
||||
do_test savepoint-11.8 {
|
||||
execsql { ROLLBACK }
|
||||
execsql { PRAGMA wal_checkpoint }
|
||||
db close
|
||||
sqlite3 db test.db
|
||||
file size test.db
|
||||
} {8192}
|
||||
|
||||
|
||||
+20
-4
@@ -553,6 +553,7 @@ proc reset_db {} {
|
||||
forcedelete test.db
|
||||
forcedelete test.db-journal
|
||||
forcedelete test.db-wal
|
||||
forcedelete test.db-wal2
|
||||
sqlite3 db ./test.db
|
||||
set ::DB [sqlite3_connection_pointer db]
|
||||
if {[info exists ::SETUP_SQL]} {
|
||||
@@ -2306,17 +2307,32 @@ proc drop_all_indexes {{db db}} {
|
||||
# Returns true if this test should be run in WAL mode. False otherwise.
|
||||
#
|
||||
proc wal_is_wal_mode {} {
|
||||
expr {[permutation] eq "wal"}
|
||||
if {[permutation] eq "wal"} { return 1 }
|
||||
if {[permutation] eq "wal2"} { return 2 }
|
||||
return 0
|
||||
}
|
||||
proc wal_set_journal_mode {{db db}} {
|
||||
if { [wal_is_wal_mode] } {
|
||||
$db eval "PRAGMA journal_mode = WAL"
|
||||
switch -- [wal_is_wal_mode] {
|
||||
0 {
|
||||
}
|
||||
|
||||
1 {
|
||||
$db eval "PRAGMA journal_mode = WAL"
|
||||
}
|
||||
|
||||
2 {
|
||||
$db eval "PRAGMA journal_mode = WAL2"
|
||||
}
|
||||
}
|
||||
}
|
||||
proc wal_check_journal_mode {testname {db db}} {
|
||||
if { [wal_is_wal_mode] } {
|
||||
$db eval { SELECT * FROM sqlite_master }
|
||||
do_test $testname [list $db eval "PRAGMA main.journal_mode"] {wal}
|
||||
set expected "wal"
|
||||
if {[wal_is_wal_mode]==2} {
|
||||
set expected "wal2"
|
||||
}
|
||||
do_test $testname [list $db eval "PRAGMA main.journal_mode"] $expected
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -282,11 +282,11 @@ ifcapable wal {
|
||||
INSERT INTO t2 VALUES('x', 'y');
|
||||
}
|
||||
lsort [array names ::T1]
|
||||
} {test.db1 test.db1-journal test.db1-wal}
|
||||
} {test.db1 test.db1-journal test.db1-wal test.db1-wal2}
|
||||
|
||||
do_test 5.1.2 {
|
||||
lsort [array names ::T2]
|
||||
} {test.db2 test.db2-journal test.db2-wal}
|
||||
} {test.db2 test.db2-journal test.db2-wal test.db2-wal2}
|
||||
db close
|
||||
|
||||
tvfs1 delete
|
||||
|
||||
+6
-6
@@ -1175,7 +1175,7 @@ foreach {tn pgsz works} {
|
||||
9 32768 1
|
||||
10 65536 1
|
||||
11 131072 0
|
||||
11 1016 0
|
||||
12 1016 0
|
||||
} {
|
||||
|
||||
if {$::SQLITE_MAX_PAGE_SIZE < $pgsz} {
|
||||
@@ -1185,14 +1185,14 @@ foreach {tn pgsz works} {
|
||||
for {set pg 1} {$pg <= 3} {incr pg} {
|
||||
forcecopy testX.db test.db
|
||||
forcedelete test.db-wal
|
||||
|
||||
|
||||
# Check that the database now exists and consists of three pages. And
|
||||
# that there is no associated wal file.
|
||||
#
|
||||
do_test wal-18.2.$tn.$pg.1 { file exists test.db-wal } 0
|
||||
do_test wal-18.2.$tn.$pg.2 { file exists test.db } 1
|
||||
do_test wal-18.2.$tn.$pg.3 { file size test.db } [expr 1024*3]
|
||||
|
||||
|
||||
do_test wal-18.2.$tn.$pg.4 {
|
||||
|
||||
# Create a wal file that contains a single frame (database page
|
||||
@@ -1224,16 +1224,16 @@ foreach {tn pgsz works} {
|
||||
puts -nonewline $fd $framehdr
|
||||
puts -nonewline $fd $framebody
|
||||
close $fd
|
||||
|
||||
|
||||
file size test.db-wal
|
||||
} [wal_file_size 1 $pgsz]
|
||||
|
||||
|
||||
do_test wal-18.2.$tn.$pg.5 {
|
||||
sqlite3 db test.db
|
||||
set rc [catch { db one {PRAGMA integrity_check} } msg]
|
||||
expr { $rc!=0 || $msg!="ok" }
|
||||
} $works
|
||||
|
||||
|
||||
db close
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
# 2017 September 19
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
# TESTRUNNER: slow
|
||||
#
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing the operation of the library in
|
||||
# "PRAGMA journal_mode=WAL2" mode.
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
source $testdir/lock_common.tcl
|
||||
source $testdir/malloc_common.tcl
|
||||
source $testdir/wal_common.tcl
|
||||
|
||||
set testprefix wal2big
|
||||
ifcapable !wal {finish_test ; return }
|
||||
|
||||
do_execsql_test 1.0 {
|
||||
CREATE TABLE t1(a, b, c);
|
||||
CREATE INDEX t1a ON t1(a);
|
||||
CREATE INDEX t1b ON t1(b);
|
||||
CREATE INDEX t1c ON t1(c);
|
||||
PRAGMA journal_mode = wal2;
|
||||
PRAGMA journal_size_limit = 10000000;
|
||||
|
||||
WITH s(i) AS (
|
||||
SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<200000
|
||||
)
|
||||
INSERT INTO t1 SELECT random(), random(), random() FROM s;
|
||||
} {wal2 10000000}
|
||||
|
||||
do_execsql_test 1.1 {
|
||||
WITH s(i) AS (
|
||||
SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<200000
|
||||
)
|
||||
INSERT INTO t1 SELECT random(), random(), random() FROM s;
|
||||
}
|
||||
|
||||
do_test 1.2 {
|
||||
list [expr [file size test.db-wal]>10000000] \
|
||||
[expr [file size test.db-wal2]>10000000]
|
||||
} {1 1}
|
||||
|
||||
do_test 1.3 {
|
||||
sqlite3 db2 test.db
|
||||
execsql {
|
||||
SELECT count(*) FROM t1;
|
||||
PRAGMA integrity_check;
|
||||
} db2
|
||||
} {400000 ok}
|
||||
|
||||
do_test 1.4 {
|
||||
db2 close
|
||||
forcecopy test.db test.db2
|
||||
forcecopy test.db-wal test.db2-wal
|
||||
forcecopy test.db-wal2 test.db2-wal2
|
||||
sqlite3 db2 test.db2
|
||||
execsql {
|
||||
SELECT count(*) FROM t1;
|
||||
PRAGMA integrity_check;
|
||||
}
|
||||
} {400000 ok}
|
||||
|
||||
finish_test
|
||||
@@ -0,0 +1,52 @@
|
||||
# 2010 May 03
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing the operation of the library in
|
||||
# "PRAGMA journal_mode=WAL" mode.
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
source $testdir/malloc_common.tcl
|
||||
source $testdir/lock_common.tcl
|
||||
|
||||
ifcapable !wal {finish_test ; return }
|
||||
set testprefix wal2fault
|
||||
|
||||
do_execsql_test 1.0 {
|
||||
CREATE TABLE t1(x,y);
|
||||
PRAGMA journal_mode = wal2;
|
||||
WITH s(i) AS ( SELECT 100 UNION ALL SELECT i-1 FROM s WHERE (i-1)>0 )
|
||||
INSERT INTO t1 SELECT i, randomblob(i) FROM s;
|
||||
WITH s(i) AS ( SELECT 100 UNION ALL SELECT i-1 FROM s WHERE (i-1)>0 )
|
||||
INSERT INTO t1 SELECT i, randomblob(i) FROM s;
|
||||
} {wal2}
|
||||
|
||||
do_test 1.1 {
|
||||
expr [file size test.db-wal]>10000
|
||||
} {1}
|
||||
faultsim_save_and_close
|
||||
|
||||
do_faultsim_test 1 -prep {
|
||||
faultsim_restore_and_reopen
|
||||
execsql {
|
||||
PRAGMA journal_size_limit = 10000;
|
||||
SELECT count(*) FROM sqlite_master;
|
||||
}
|
||||
} -body {
|
||||
execsql {
|
||||
INSERT INTO t1 VALUES(1, 2);
|
||||
}
|
||||
} -test {
|
||||
faultsim_test_result {0 {}}
|
||||
}
|
||||
|
||||
finish_test
|
||||
@@ -0,0 +1,106 @@
|
||||
# 2018 December 15
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing the operation of the library in
|
||||
# "PRAGMA journal_mode=WAL2" mode.
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
source $testdir/lock_common.tcl
|
||||
source $testdir/malloc_common.tcl
|
||||
source $testdir/wal_common.tcl
|
||||
|
||||
set testprefix wal2lock
|
||||
ifcapable !wal {finish_test ; return }
|
||||
|
||||
db close
|
||||
testvfs tvfs
|
||||
sqlite3 db test.db -vfs tvfs
|
||||
|
||||
do_execsql_test 1.0 {
|
||||
PRAGMA journal_mode = wal2;
|
||||
CREATE TABLE y1(y, yy);
|
||||
CREATE INDEX y1y ON y1(y);
|
||||
CREATE INDEX y1yy ON y1(yy);
|
||||
INSERT INTO y1 VALUES(1, 2), (3, 4), (5, 6);
|
||||
} {wal2}
|
||||
|
||||
tvfs script vfs_callback
|
||||
tvfs filter xShmLock
|
||||
|
||||
set ::lock [list]
|
||||
proc vfs_callback {func file name lock} {
|
||||
lappend ::lock $lock
|
||||
return SQLITE_OK
|
||||
}
|
||||
|
||||
do_execsql_test 1.1.1 {
|
||||
SELECT * FROM y1
|
||||
} {1 2 3 4 5 6}
|
||||
do_test 1.1.2 {
|
||||
set ::lock
|
||||
} {{4 1 lock shared} {4 1 unlock shared}}
|
||||
|
||||
set ::bFirst 1
|
||||
proc vfs_callback {func file name lock} {
|
||||
if {$::bFirst} {
|
||||
set ::bFirst 0
|
||||
return SQLITE_BUSY
|
||||
}
|
||||
return SQLITE_OK
|
||||
}
|
||||
do_execsql_test 1.2 {
|
||||
SELECT * FROM y1
|
||||
} {1 2 3 4 5 6}
|
||||
|
||||
set ::bFirst 1
|
||||
proc vfs_callback {func file name lock} {
|
||||
if {$::bFirst} {
|
||||
set ::bFirst 0
|
||||
return SQLITE_IOERR
|
||||
}
|
||||
return SQLITE_OK
|
||||
}
|
||||
do_catchsql_test 1.3 {
|
||||
SELECT * FROM y1
|
||||
} {1 {disk I/O error}}
|
||||
|
||||
puts "# Warning: This next test case causes SQLite to call xSleep(1) 100 times."
|
||||
puts "# Normally this equates to a delay of roughly 10 seconds, but if SQLite"
|
||||
puts "# is built on unix without HAVE_USLEEP defined, it may be much longer."
|
||||
proc vfs_callback {func file name lock} { return SQLITE_BUSY }
|
||||
do_catchsql_test 1.4 {
|
||||
SELECT * FROM y1
|
||||
} {1 {locking protocol}}
|
||||
proc vfs_callback {func file name lock} { return SQLITE_OK }
|
||||
|
||||
sqlite3 db2 test.db -vfs tvfs
|
||||
set ::bFirst 1
|
||||
|
||||
proc vfs_callback {func file name lock} {
|
||||
if {$::bFirst} {
|
||||
set ::bFirst 0
|
||||
db2 eval { INSERT INTO y1 VALUES(7, 8) }
|
||||
}
|
||||
}
|
||||
|
||||
do_execsql_test 1.5.1 {
|
||||
SELECT * FROM y1
|
||||
} {1 2 3 4 5 6 7 8}
|
||||
do_execsql_test 1.5.2 {
|
||||
SELECT * FROM y1
|
||||
} {1 2 3 4 5 6 7 8}
|
||||
|
||||
db close
|
||||
db2 close
|
||||
tvfs delete
|
||||
finish_test
|
||||
@@ -0,0 +1,81 @@
|
||||
# 2017 September 19
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing the operation of the library in
|
||||
# "PRAGMA journal_mode=WAL2" mode.
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
source $testdir/lock_common.tcl
|
||||
source $testdir/malloc_common.tcl
|
||||
source $testdir/wal_common.tcl
|
||||
|
||||
set testprefix wal2openclose
|
||||
ifcapable !wal {finish_test ; return }
|
||||
|
||||
do_execsql_test 1.0 {
|
||||
CREATE TABLE t1(a, b, c);
|
||||
PRAGMA journal_mode = wal2;
|
||||
PRAGMA wal_autocheckpoint = 0;
|
||||
PRAGMA journal_size_limit = 75000;
|
||||
} {wal2 0 75000}
|
||||
|
||||
do_test 1.1 {
|
||||
for {set ii 1} {$ii <= 200} {incr ii} {
|
||||
execsql {
|
||||
INSERT INTO t1 VALUES($ii, $ii, $ii);
|
||||
}
|
||||
}
|
||||
expr ([file size test.db-wal2] - 75000) > 30000
|
||||
} {1}
|
||||
|
||||
do_test 1.2 {
|
||||
db close
|
||||
list [file exists test.db-wal] [file exists test.db-wal2]
|
||||
} {0 0}
|
||||
|
||||
sqlite3 db test.db
|
||||
do_execsql_test 1.3 {
|
||||
SELECT sum(c) FROM t1
|
||||
} {20100}
|
||||
db close
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
reset_db
|
||||
do_execsql_test 2.0 {
|
||||
CREATE TABLE t1(a, b, c);
|
||||
PRAGMA journal_mode = wal2;
|
||||
INSERT INTO t1 VALUES(1, 2, 3);
|
||||
} {wal2}
|
||||
db_save_and_close
|
||||
|
||||
db_restore_and_reopen
|
||||
do_execsql_test 2.1 {
|
||||
SELECT * FROM t1;
|
||||
} {1 2 3}
|
||||
|
||||
do_test 2.2 {
|
||||
sqlite3 db2 test.db
|
||||
db2 eval {INSERT INTO t1 VALUES(4, 5, 6)}
|
||||
db2 close
|
||||
} {}
|
||||
|
||||
breakpoint
|
||||
db close
|
||||
sqlite3 db test.db
|
||||
do_execsql_test 2.2 {
|
||||
SELECT * FROM t1;
|
||||
} {1 2 3 4 5 6}
|
||||
|
||||
|
||||
|
||||
finish_test
|
||||
@@ -0,0 +1,271 @@
|
||||
# 2018 December 13
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing the operation of the library in
|
||||
# "PRAGMA journal_mode=WAL2" mode.
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
source $testdir/lock_common.tcl
|
||||
source $testdir/malloc_common.tcl
|
||||
source $testdir/wal_common.tcl
|
||||
|
||||
set testprefix wal2recover
|
||||
ifcapable !wal {finish_test ; return }
|
||||
|
||||
proc db_copy {from to} {
|
||||
forcecopy $from $to
|
||||
forcecopy ${from}-wal ${to}-wal
|
||||
forcecopy ${from}-wal2 ${to}-wal2
|
||||
}
|
||||
|
||||
do_execsql_test 1.0 {
|
||||
CREATE TABLE t1(a, b, c);
|
||||
CREATE INDEX t1a ON t1(a);
|
||||
CREATE INDEX t1b ON t1(b);
|
||||
CREATE INDEX t1c ON t1(c);
|
||||
PRAGMA journal_mode = wal2;
|
||||
PRAGMA journal_size_limit = 15000;
|
||||
PRAGMA wal_autocheckpoint = 0;
|
||||
} {wal2 15000 0}
|
||||
|
||||
do_test 1.1 {
|
||||
for {set i 1} {$i <= 1000} {incr i} {
|
||||
execsql { INSERT INTO t1 VALUES(random(), random(), random()) }
|
||||
db_copy test.db test.db2
|
||||
sqlite3 db2 test.db
|
||||
set res [execsql {
|
||||
SELECT count(*) FROM t1;
|
||||
PRAGMA integrity_check;
|
||||
} db2]
|
||||
db2 close
|
||||
if {$res != [list $i ok]} {
|
||||
error "failure on iteration $i"
|
||||
}
|
||||
}
|
||||
set {} {}
|
||||
} {}
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
reset_db
|
||||
do_execsql_test 2.0 {
|
||||
CREATE TABLE t1(x UNIQUE);
|
||||
CREATE TABLE t2(x UNIQUE);
|
||||
PRAGMA journal_mode = wal2;
|
||||
PRAGMA journal_size_limit = 10000;
|
||||
PRAGMA wal_autocheckpoint = 0;
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES(randomblob(4000));
|
||||
INSERT INTO t1 VALUES(randomblob(4000));
|
||||
INSERT INTO t1 VALUES(randomblob(4000));
|
||||
COMMIT;
|
||||
BEGIN;
|
||||
INSERT INTO t2 VALUES(randomblob(4000));
|
||||
INSERT INTO t2 VALUES(randomblob(4000));
|
||||
INSERT INTO t2 VALUES(randomblob(4000));
|
||||
COMMIT;
|
||||
} {wal2 10000 0}
|
||||
do_test 2.0.1 {
|
||||
list [file size test.db] [file size test.db-wal] [file size test.db-wal2]
|
||||
} {5120 28328 28328}
|
||||
|
||||
# Test recovery with both wal files intact.
|
||||
#
|
||||
do_test 2.1 {
|
||||
db_copy test.db test.db2
|
||||
sqlite3 db2 test.db2
|
||||
execsql {
|
||||
SELECT count(*) FROM t1;
|
||||
SELECT count(*) FROM t2;
|
||||
PRAGMA integrity_check;
|
||||
} db2
|
||||
} {3 3 ok}
|
||||
|
||||
do_test 2.2 {
|
||||
db2 close
|
||||
db_copy test.db test.db2
|
||||
hexio_write test.db2-wal 16 12345678
|
||||
sqlite3 db2 test.db2
|
||||
execsql {
|
||||
SELECT count(*) FROM t1;
|
||||
SELECT count(*) FROM t2;
|
||||
} db2
|
||||
} {0 3}
|
||||
|
||||
do_test 2.3 {
|
||||
db2 close
|
||||
db_copy test.db test.db2
|
||||
hexio_write test.db2-wal2 16 12345678
|
||||
sqlite3 db2 test.db2
|
||||
execsql {
|
||||
SELECT count(*) FROM t1;
|
||||
SELECT count(*) FROM t2;
|
||||
PRAGMA integrity_check;
|
||||
} db2
|
||||
} {3 0 ok}
|
||||
|
||||
do_test 2.4 {
|
||||
db2 close
|
||||
db_copy test.db test.db2
|
||||
forcecopy test.db-wal test.db2-wal2
|
||||
sqlite3 db2 test.db2
|
||||
execsql {
|
||||
SELECT count(*) FROM t1;
|
||||
SELECT count(*) FROM t2;
|
||||
PRAGMA integrity_check;
|
||||
} db2
|
||||
} {3 0 ok}
|
||||
|
||||
do_test 2.5 {
|
||||
db2 close
|
||||
db_copy test.db test.db2
|
||||
forcecopy test.db-wal test.db2-wal2
|
||||
forcecopy test.db-wal2 test.db2-wal
|
||||
sqlite3 db2 test.db2
|
||||
execsql {
|
||||
SELECT count(*) FROM t1;
|
||||
SELECT count(*) FROM t2;
|
||||
PRAGMA integrity_check;
|
||||
} db2
|
||||
} {3 3 ok}
|
||||
|
||||
do_test 2.6 {
|
||||
db2 close
|
||||
db_copy test.db test.db2
|
||||
forcecopy test.db-wal test.db2-wal2
|
||||
close [open test.db-wal w]
|
||||
sqlite3 db2 test.db2
|
||||
execsql {
|
||||
SELECT count(*) FROM t1;
|
||||
SELECT count(*) FROM t2;
|
||||
PRAGMA integrity_check;
|
||||
} db2
|
||||
} {3 0 ok}
|
||||
|
||||
do_test 2.7 {
|
||||
db2 close
|
||||
db_copy test.db test.db2
|
||||
forcedelete test.db2-wal
|
||||
sqlite3 db2 test.db2
|
||||
execsql {
|
||||
SELECT count(*) FROM t1;
|
||||
SELECT count(*) FROM t2;
|
||||
PRAGMA integrity_check;
|
||||
} db2
|
||||
} {0 0 ok}
|
||||
db2 close
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
reset_db
|
||||
do_execsql_test 3.0 {
|
||||
CREATE TABLE t1(a TEXT, b TEXT, c TEXT);
|
||||
CREATE INDEX t1a ON t1(a);
|
||||
CREATE INDEX t1b ON t1(b);
|
||||
CREATE INDEX t1c ON t1(c);
|
||||
PRAGMA journal_mode = wal2;
|
||||
PRAGMA journal_size_limit = 10000;
|
||||
PRAGMA wal_autocheckpoint = 0;
|
||||
PRAGMA cache_size = 5;
|
||||
} {wal2 10000 0}
|
||||
|
||||
do_execsql_test 3.1 {
|
||||
WITH s(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM s where i < 200)
|
||||
INSERT INTO t1 SELECT i, i, i FROM s;
|
||||
|
||||
INSERT INTO t1 VALUES(201, 201, 201);
|
||||
} {}
|
||||
|
||||
do_test 3.2 {
|
||||
list [file size test.db] [file size test.db-wal] [file size test.db-wal2]
|
||||
} {5120 15752 4224}
|
||||
|
||||
do_test 3.3 {
|
||||
forcecopy test.db test.db2
|
||||
forcecopy test.db-wal test.db2-wal
|
||||
forcecopy test.db-wal2 test.db2-wal2
|
||||
sqlite3 db2 test.db2
|
||||
execsql {
|
||||
PRAGMA journal_size_limit = 10000;
|
||||
PRAGMA wal_autocheckpoint = 0;
|
||||
PRAGMA cache_size = 5;
|
||||
BEGIN;
|
||||
WITH s(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM s where i < 200)
|
||||
INSERT INTO t1 SELECT i, i, i FROM s;
|
||||
} db2
|
||||
list [file size test.db2] [file size test.db2-wal] [file size test.db2-wal2]
|
||||
} {5120 15752 23088}
|
||||
|
||||
|
||||
if {$tcl_platform(platform)!="windows"} {
|
||||
# These cannot be run under windows, as the *-shm file may not be read
|
||||
# while it is locked by the database connection.
|
||||
do_test 3.4 {
|
||||
set fd [open test.db2-shm]
|
||||
fconfigure $fd -translation binary
|
||||
set data [read $fd]
|
||||
close $fd
|
||||
|
||||
set fd [open test.db-shm w]
|
||||
fconfigure $fd -translation binary
|
||||
puts -nonewline $fd $data
|
||||
close $fd
|
||||
|
||||
execsql {
|
||||
WITH s(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM s where i < 10)
|
||||
INSERT INTO t1 SELECT i, i, i FROM s;
|
||||
SELECT count(*) FROM t1;
|
||||
PRAGMA integrity_check;
|
||||
}
|
||||
} {211 ok}
|
||||
|
||||
do_test 3.5 {
|
||||
list [file size test.db] [file size test.db-wal] [file size test.db-wal2]
|
||||
} {5120 15752 18896}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
reset_db
|
||||
do_execsql_test 4.0 {
|
||||
PRAGMA journal_mode = wal2;
|
||||
CREATE TABLE xyz(x, y, z);
|
||||
INSERT INTO xyz VALUES('x', 'y', 'z');
|
||||
} {wal2}
|
||||
db close
|
||||
do_test 4.1 {
|
||||
close [open test.db-wal w]
|
||||
file mkdir test.db-wal2
|
||||
sqlite3 db test.db
|
||||
catchsql { SELECT * FROM xyz }
|
||||
} {1 {unable to open database file}}
|
||||
db close
|
||||
file delete test.db-wal2
|
||||
db2 close
|
||||
|
||||
do_test 4.2 {
|
||||
sqlite3 db test.db
|
||||
execsql {
|
||||
INSERT INTO xyz VALUES('a', 'b', 'c');
|
||||
}
|
||||
forcecopy test.db test.db2
|
||||
forcecopy test.db-wal test.db2-wal
|
||||
forcedelete test.db2-wal2
|
||||
file mkdir test.db2-wal2
|
||||
sqlite3 db2 test.db2
|
||||
catchsql { SELECT * FROM xyz } db2
|
||||
} {1 {unable to open database file}}
|
||||
db2 close
|
||||
file delete test.db2-wal2
|
||||
|
||||
|
||||
finish_test
|
||||
@@ -0,0 +1,273 @@
|
||||
# 2018 December 13
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing the operation of the library in
|
||||
# "PRAGMA journal_mode=WAL2" mode.
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
source $testdir/lock_common.tcl
|
||||
source $testdir/malloc_common.tcl
|
||||
source $testdir/wal_common.tcl
|
||||
|
||||
set testprefix wal2recover2
|
||||
ifcapable !wal {finish_test ; return }
|
||||
|
||||
do_execsql_test 1.0 {
|
||||
CREATE TABLE t1(x);
|
||||
CREATE TABLE t2(x);
|
||||
WITH s(i) AS ( VALUES(1) UNION ALL SELECT i+1 FROM s WHERE i<1500 )
|
||||
INSERT INTO t1 SELECT i FROM s;
|
||||
WITH s(i) AS ( VALUES(1) UNION ALL SELECT i+1 FROM s WHERE i<1500 )
|
||||
INSERT INTO t2 SELECT i FROM s;
|
||||
|
||||
PRAGMA journal_mode = wal2;
|
||||
PRAGMA journal_size_limit = 10000;
|
||||
} {wal2 10000}
|
||||
|
||||
set ::L 1125750
|
||||
set ::M 1126500
|
||||
set ::H 1127250
|
||||
|
||||
do_execsql_test 1.1 {
|
||||
UPDATE t1 SET x=x+1;
|
||||
UPDATE t2 SET x=x+1 WHERE rowid<=750;
|
||||
|
||||
SELECT sum(x) FROM t1;
|
||||
SELECT sum(x) FROM t2;
|
||||
} [list $H $M]
|
||||
|
||||
do_test 1.2 {
|
||||
list [file size test.db] [file size test.db-wal] [file size test.db-wal2]
|
||||
} {31744 14704 7368}
|
||||
|
||||
proc cksum {zIn data} {
|
||||
if {[string length $zIn]==0} {
|
||||
set s0 0
|
||||
set s1 0
|
||||
} else {
|
||||
set s0 [hexio_get_int [string range $zIn 0 7]]
|
||||
set s1 [hexio_get_int [string range $zIn 8 15]]
|
||||
}
|
||||
set n [expr [string length $data] / 8]
|
||||
|
||||
for {set i 0} {$i < $n} {incr i 2} {
|
||||
set x0 [hexio_get_int -l [string range $data [expr $i*8] [expr $i*8+7]]]
|
||||
set x1 [hexio_get_int -l [string range $data [expr $i*8+8] [expr $i*8+8+7]]]
|
||||
|
||||
set s0 [expr ($s0 + $x0 + $s1) & 0xFFFFFFFF]
|
||||
set s1 [expr ($s1 + $x1 + $s0) & 0xFFFFFFFF]
|
||||
}
|
||||
|
||||
return "[hexio_render_int32 $s0][hexio_render_int32 $s1]"
|
||||
}
|
||||
|
||||
proc fix_wal_cksums {file} {
|
||||
# Fix the checksum on the wal header.
|
||||
set data [hexio_read $file 0 32]
|
||||
set cksum [cksum {} [string range $data 0 47]]
|
||||
set salt [hexio_read $file 16 8]
|
||||
hexio_write $file 24 $cksum
|
||||
|
||||
# Fix the checksums for all pages in the wal file.
|
||||
set pgsz [hexio_get_int [hexio_read $file 8 4]]
|
||||
set sz [file size $file]
|
||||
for {set off 32} {$off < $sz} {incr off [expr $pgsz+24]} {
|
||||
set e [hexio_read $file $off 8]
|
||||
set cksum [cksum $cksum $e]
|
||||
|
||||
set p [hexio_read $file [expr $off+24] $pgsz]
|
||||
set cksum [cksum $cksum $p]
|
||||
|
||||
hexio_write $file [expr $off+8] $salt
|
||||
hexio_write $file [expr $off+16] $cksum
|
||||
}
|
||||
}
|
||||
|
||||
proc wal_incr_hdrfield {file field} {
|
||||
switch -- $field {
|
||||
nCkpt { set offset 12 }
|
||||
salt0 { set offset 16 }
|
||||
salt1 { set offset 20 }
|
||||
default {
|
||||
error "unknown field $field - should be \"nCkpt\", \"salt0\" or \"salt1\""
|
||||
}
|
||||
}
|
||||
|
||||
# Increment the value in the wal header.
|
||||
set v [hexio_get_int [hexio_read $file $offset 4]]
|
||||
incr v
|
||||
hexio_write $file $offset [hexio_render_int32 $v]
|
||||
|
||||
# Fix various checksums
|
||||
fix_wal_cksums $file
|
||||
}
|
||||
|
||||
proc wal_set_nckpt {file val} {
|
||||
# Increment the value in the wal header.
|
||||
hexio_write $file 12 [hexio_render_int32 $val]
|
||||
|
||||
# Fix various checksums
|
||||
fix_wal_cksums $file
|
||||
}
|
||||
|
||||
proc wal_set_follow {file prevfile} {
|
||||
set pgsz [hexio_get_int [hexio_read $prevfile 8 4]]
|
||||
set sz [file size $prevfile]
|
||||
set cksum [hexio_read $prevfile [expr $sz-$pgsz-8] 8]
|
||||
|
||||
hexio_write $file 16 $cksum
|
||||
fix_wal_cksums $file
|
||||
}
|
||||
|
||||
foreach {tn file field} {
|
||||
1 test.db2-wal salt0
|
||||
2 test.db2-wal salt1
|
||||
3 test.db2-wal nCkpt
|
||||
4 test.db2-wal2 salt0
|
||||
5 test.db2-wal2 salt1
|
||||
6 test.db2-wal2 nCkpt
|
||||
} {
|
||||
do_test 1.3.$tn {
|
||||
forcecopy test.db test.db2
|
||||
forcecopy test.db-wal test.db2-wal
|
||||
forcecopy test.db-wal2 test.db2-wal2
|
||||
wal_incr_hdrfield $file $field
|
||||
sqlite3 db2 test.db2
|
||||
execsql {
|
||||
SELECT sum(x) FROM t1;
|
||||
SELECT sum(x) FROM t2;
|
||||
} db2
|
||||
} [list $H $L]
|
||||
db2 close
|
||||
}
|
||||
|
||||
do_test 1.4 {
|
||||
forcecopy test.db test.db2
|
||||
forcecopy test.db-wal2 test.db2-wal
|
||||
forcedelete test.db2-wal2
|
||||
sqlite3 db2 test.db2
|
||||
execsql {
|
||||
SELECT sum(x) FROM t1;
|
||||
SELECT sum(x) FROM t2;
|
||||
} db2
|
||||
} [list $L $M]
|
||||
|
||||
do_test 1.5 {
|
||||
db2 close
|
||||
forcecopy test.db test.db2
|
||||
forcecopy test.db-wal2 test.db2-wal
|
||||
forcecopy test.db-wal test.db2-wal2
|
||||
sqlite3 db2 test.db2
|
||||
execsql {
|
||||
SELECT sum(x) FROM t1;
|
||||
SELECT sum(x) FROM t2;
|
||||
} db2
|
||||
} [list $H $M]
|
||||
|
||||
db2 close
|
||||
foreach {tn file field} {
|
||||
1 test.db2-wal salt0
|
||||
2 test.db2-wal salt1
|
||||
3 test.db2-wal2 salt0
|
||||
4 test.db2-wal2 salt1
|
||||
} {
|
||||
do_test 1.6.$tn {
|
||||
forcecopy test.db test.db2
|
||||
forcecopy test.db-wal2 test.db2-wal
|
||||
forcecopy test.db-wal test.db2-wal2
|
||||
wal_incr_hdrfield $file $field
|
||||
sqlite3 db2 test.db2
|
||||
execsql {
|
||||
SELECT sum(x) FROM t1;
|
||||
SELECT sum(x) FROM t2;
|
||||
} db2
|
||||
} [list $H $L]
|
||||
db2 close
|
||||
}
|
||||
|
||||
foreach {tn nCkpt1 nCkpt2 res} [list \
|
||||
1 2 1 "$H $M" \
|
||||
2 2 2 "$L $M" \
|
||||
3 3 1 "$H $L" \
|
||||
4 15 14 "$H $M" \
|
||||
5 0 15 "$H $M" \
|
||||
6 1 15 "$L $M" \
|
||||
] {
|
||||
do_test 1.7.$tn {
|
||||
forcecopy test.db test.db2
|
||||
forcecopy test.db-wal2 test.db2-wal
|
||||
forcecopy test.db-wal test.db2-wal2
|
||||
|
||||
wal_set_nckpt test.db2-wal2 $nCkpt2
|
||||
wal_set_nckpt test.db2-wal $nCkpt1
|
||||
wal_set_follow test.db2-wal test.db2-wal2
|
||||
|
||||
|
||||
sqlite3 db2 test.db2
|
||||
execsql {
|
||||
SELECT sum(x) FROM t1;
|
||||
SELECT sum(x) FROM t2;
|
||||
} db2
|
||||
} $res
|
||||
db2 close
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
reset_db
|
||||
do_execsql_test 1.8.1 {
|
||||
PRAGMA autovacuum = 0;
|
||||
PRAGMA page_size = 4096;
|
||||
CREATE TABLE t1(x);
|
||||
CREATE TABLE t2(x);
|
||||
WITH s(i) AS ( VALUES(1) UNION ALL SELECT i+1 FROM s WHERE i<1500 )
|
||||
INSERT INTO t1 SELECT i FROM s;
|
||||
WITH s(i) AS ( VALUES(1) UNION ALL SELECT i+1 FROM s WHERE i<1500 )
|
||||
INSERT INTO t2 SELECT i FROM s;
|
||||
|
||||
PRAGMA journal_mode = wal2;
|
||||
PRAGMA journal_size_limit = 10000;
|
||||
|
||||
WITH s(i) AS ( VALUES(1) UNION ALL SELECT i+1 FROM s WHERE i<1500 )
|
||||
INSERT INTO t2 SELECT i FROM s;
|
||||
} {wal2 10000}
|
||||
|
||||
do_test 1.8.2 {
|
||||
list [file size test.db-wal] [file size test.db-wal2]
|
||||
} {24752 0}
|
||||
|
||||
do_execsql_test 1.8.3 { PRAGMA user_version = 123 }
|
||||
do_test 1.8.4 {
|
||||
list [file size test.db-wal] [file size test.db-wal2]
|
||||
} {24752 4152}
|
||||
|
||||
do_test 1.8.5 {
|
||||
hexio_write test.db-wal2 [expr 56+16] 0400
|
||||
fix_wal_cksums test.db-wal2
|
||||
} {}
|
||||
|
||||
ifcapable oversize_cell_check {
|
||||
set msg {database disk image is malformed}
|
||||
} else {
|
||||
set msg {malformed database schema (?)}
|
||||
}
|
||||
|
||||
do_test 1.8.6 {
|
||||
forcecopy test.db test.db2
|
||||
forcecopy test.db-wal test.db2-wal
|
||||
forcecopy test.db-wal2 test.db2-wal2
|
||||
sqlite3 db2 test.db2
|
||||
catchsql { SELECT * FROM sqlite_master } db2
|
||||
} [list 1 $msg]
|
||||
db2 close
|
||||
|
||||
finish_test
|
||||
@@ -0,0 +1,52 @@
|
||||
# 2022 June 28
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing the operation of the library in
|
||||
# "PRAGMA journal_mode=WAL2" mode.
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
source $testdir/lock_common.tcl
|
||||
source $testdir/malloc_common.tcl
|
||||
source $testdir/wal_common.tcl
|
||||
|
||||
set testprefix wal2recover3
|
||||
ifcapable !wal {finish_test ; return }
|
||||
|
||||
do_execsql_test 1.0 {
|
||||
CREATE TABLE t1(x);
|
||||
CREATE TABLE t2(x);
|
||||
PRAGMA journal_mode = wal2;
|
||||
PRAGMA wal_autocheckpoint = 0;
|
||||
PRAGMA journal_size_limit = 10000;
|
||||
} {wal2 0 10000}
|
||||
|
||||
do_execsql_test 1.1 {
|
||||
WITH s(i) AS ( VALUES(1) UNION ALL SELECT i+1 FROM s WHERE i<1500 )
|
||||
INSERT INTO t1 SELECT i FROM s;
|
||||
WITH s(i) AS ( VALUES(1) UNION ALL SELECT i+1 FROM s WHERE i<1500 )
|
||||
INSERT INTO t2 SELECT i FROM s;
|
||||
}
|
||||
|
||||
db_save_and_close
|
||||
set fd [open sv_test.db-wal2 r+]
|
||||
seek $fd 4000
|
||||
puts -nonewline $fd 0
|
||||
close $fd
|
||||
|
||||
db_restore_and_reopen
|
||||
do_execsql_test 1.2 {
|
||||
SELECT sql FROM sqlite_schema;
|
||||
} {{CREATE TABLE t1(x)} {CREATE TABLE t2(x)}}
|
||||
|
||||
finish_test
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
# 2017 September 19
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing the operation of the library in
|
||||
# "PRAGMA journal_mode=WAL2" mode.
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
source $testdir/lock_common.tcl
|
||||
source $testdir/malloc_common.tcl
|
||||
source $testdir/wal_common.tcl
|
||||
|
||||
set testprefix wal2rewrite
|
||||
ifcapable !wal {finish_test ; return }
|
||||
|
||||
proc filesize {filename} {
|
||||
if {[file exists $filename]} {
|
||||
return [file size $filename]
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
foreach {tn jrnlmode} {
|
||||
1 wal
|
||||
2 wal2
|
||||
} {
|
||||
reset_db
|
||||
execsql "PRAGMA journal_mode = $jrnlmode"
|
||||
do_execsql_test $tn.1 {
|
||||
PRAGMA journal_size_limit = 10000;
|
||||
PRAGMA cache_size = 5;
|
||||
PRAGMA wal_autocheckpoint = 10;
|
||||
|
||||
CREATE TABLE t1(a INTEGER PRIMARY KEY, b INTEGER, c BLOB);
|
||||
CREATE INDEX t1b ON t1(b);
|
||||
CREATE INDEX t1c ON t1(c);
|
||||
|
||||
WITH s(i) AS (
|
||||
SELECT 1 UNION SELECT i+1 FROM s WHERE i<10
|
||||
)
|
||||
INSERT INTO t1 SELECT i, i, randomblob(800) FROM s;
|
||||
} {10000 10}
|
||||
|
||||
for {set i 0} {$i < 4} {incr i} {
|
||||
do_execsql_test $tn.$i.1 {
|
||||
UPDATE t1 SET c=randomblob(800) WHERE (b%10)==5 AND ($i%2)
|
||||
}
|
||||
do_execsql_test $tn.$i.2 {
|
||||
BEGIN;
|
||||
UPDATE t1 SET b=b+10, c=randomblob(800);
|
||||
UPDATE t1 SET b=b+10, c=randomblob(800);
|
||||
UPDATE t1 SET b=b+10, c=randomblob(800);
|
||||
UPDATE t1 SET b=b+10, c=randomblob(800);
|
||||
UPDATE t1 SET b=b+10, c=randomblob(800);
|
||||
UPDATE t1 SET b=b+10, c=randomblob(800);
|
||||
UPDATE t1 SET b=b+10, c=randomblob(800);
|
||||
UPDATE t1 SET b=b+10, c=randomblob(800);
|
||||
UPDATE t1 SET b=b+10, c=randomblob(800);
|
||||
UPDATE t1 SET b=b+10, c=randomblob(800);
|
||||
}
|
||||
execsql COMMIT
|
||||
|
||||
do_test $tn.$i.3 { expr [filesize test.db-wal] < 100000 } 1
|
||||
do_test $tn.$i.4 { expr [filesize test.db-wal2] < 100000 } 1
|
||||
|
||||
set sum [db eval {SELECT sum(b), md5sum(c) FROM t1}]
|
||||
|
||||
do_test $tn.$i.5 {
|
||||
foreach f [glob -nocomplain test.db2*] {forcedelete $f}
|
||||
foreach f [glob -nocomplain test.db*] {
|
||||
forcecopy $f [string map {test.db test.db2} $f]
|
||||
}
|
||||
|
||||
sqlite3 db2 test.db2
|
||||
db2 eval {SELECT sum(b), md5sum(c) FROM t1}
|
||||
} $sum
|
||||
db2 close
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
finish_test
|
||||
@@ -0,0 +1,62 @@
|
||||
# 2017 September 19
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing the operation of the library in
|
||||
# "PRAGMA journal_mode=WAL2" mode.
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
source $testdir/lock_common.tcl
|
||||
source $testdir/malloc_common.tcl
|
||||
source $testdir/wal_common.tcl
|
||||
|
||||
set testprefix wal2rollback
|
||||
ifcapable !wal {finish_test ; return }
|
||||
|
||||
do_execsql_test 1.0 {
|
||||
CREATE TABLE t1(a, b, c);
|
||||
CREATE TABLE t2(a, b, c);
|
||||
CREATE INDEX i1 ON t1(a);
|
||||
CREATE INDEX i2 ON t1(b);
|
||||
PRAGMA journal_mode = wal2;
|
||||
PRAGMA cache_size = 5;
|
||||
PRAGMA journal_size_limit = 10000;
|
||||
WITH s(i) AS (
|
||||
SELECT 1 UNION ALL SELECT i+1 FROM s LIMIT 1000
|
||||
)
|
||||
INSERT INTO t1 SELECT i, i, randomblob(200) FROM s;
|
||||
} {wal2 10000}
|
||||
|
||||
do_test 1.1 {
|
||||
expr [file size test.db-wal] > 10000
|
||||
} 1
|
||||
|
||||
do_test 1.2 {
|
||||
execsql {
|
||||
BEGIN;
|
||||
UPDATE t1 SET b=b+1;
|
||||
INSERT INTO t2 VALUES(1,2,3);
|
||||
}
|
||||
expr [file size test.db-wal2] > 10000
|
||||
} {1}
|
||||
|
||||
breakpoint
|
||||
do_execsql_test 1.3 {
|
||||
ROLLBACK;
|
||||
SELECT * FROM t2;
|
||||
SELECT count(*) FROM t1 WHERE a=b;
|
||||
PRAGMA integrity_check;
|
||||
} {1000 ok}
|
||||
|
||||
|
||||
|
||||
finish_test
|
||||
@@ -0,0 +1,73 @@
|
||||
# 2018 December 13
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing the operation of the library in
|
||||
# "PRAGMA journal_mode=WAL2" mode.
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
source $testdir/lock_common.tcl
|
||||
source $testdir/malloc_common.tcl
|
||||
source $testdir/wal_common.tcl
|
||||
|
||||
set testprefix wal2savepoint
|
||||
ifcapable !wal {finish_test ; return }
|
||||
|
||||
reset_prng_state
|
||||
do_execsql_test 1.0 {
|
||||
CREATE TABLE t1(a, b, c);
|
||||
CREATE INDEX t1a ON t1(a);
|
||||
CREATE INDEX t1b ON t1(b);
|
||||
CREATE INDEX t1c ON t1(c);
|
||||
PRAGMA journal_mode = wal2;
|
||||
PRAGMA journal_size_limit = 15000;
|
||||
PRAGMA wal_autocheckpoint = 0;
|
||||
PRAGMA cache_size = 5;
|
||||
} {wal2 15000 0}
|
||||
|
||||
do_execsql_test 1.1 {
|
||||
WITH s(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM s where i < 200)
|
||||
INSERT INTO t1 SELECT random(), random(), random() FROM s;
|
||||
} {}
|
||||
|
||||
do_test 1.2 {
|
||||
list [file size test.db] [file size test.db-wal] [file size test.db-wal2]
|
||||
} {5120 23088 0}
|
||||
|
||||
do_execsql_test 1.3 {
|
||||
BEGIN;
|
||||
SAVEPOINT abc;
|
||||
WITH s(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM s where i < 100)
|
||||
INSERT INTO t1 SELECT random(), random(), random() FROM s;
|
||||
ROLLBACK TO abc;
|
||||
WITH s(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM s where i < 10)
|
||||
INSERT INTO t1 SELECT random(), random(), random() FROM s;
|
||||
COMMIT;
|
||||
SELECT count(*) FROM t1;
|
||||
PRAGMA integrity_check;
|
||||
} {210 ok}
|
||||
|
||||
do_execsql_test 1.4 {
|
||||
BEGIN;
|
||||
SAVEPOINT abc;
|
||||
WITH s(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM s where i < 100)
|
||||
INSERT INTO t1 SELECT random(), random(), random() FROM s;
|
||||
ROLLBACK TO abc;
|
||||
WITH s(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM s where i < 10)
|
||||
INSERT INTO t1 SELECT random(), random(), random() FROM s;
|
||||
COMMIT;
|
||||
SELECT count(*) FROM t1;
|
||||
PRAGMA integrity_check;
|
||||
} {220 ok}
|
||||
|
||||
|
||||
finish_test
|
||||
@@ -0,0 +1,543 @@
|
||||
# 2017 September 19
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing the operation of the library in
|
||||
# "PRAGMA journal_mode=WAL2" mode.
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
source $testdir/lock_common.tcl
|
||||
source $testdir/malloc_common.tcl
|
||||
source $testdir/wal_common.tcl
|
||||
|
||||
set testprefix wal2simple
|
||||
ifcapable !wal {finish_test ; return }
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# The following tests verify that a client can switch in and out of wal
|
||||
# and wal2 mode. But that it is not possible to change directly from wal
|
||||
# to wal2, or from wal2 to wal mode.
|
||||
#
|
||||
do_execsql_test 1.1.0 {
|
||||
PRAGMA journal_mode = wal2
|
||||
} {wal2}
|
||||
execsql { SELECT * FROM sqlite_master}
|
||||
do_execsql_test 1.x {
|
||||
PRAGMA journal_mode;
|
||||
PRAGMA main.journal_mode;
|
||||
} {wal2 wal2}
|
||||
db close
|
||||
do_test 1.1.1 { file size test.db } {1024}
|
||||
do_test 1.1.2 { hexio_read test.db 18 2 } 0303
|
||||
|
||||
sqlite3 db test.db
|
||||
do_execsql_test 1.2.0 {
|
||||
SELECT * FROM sqlite_master;
|
||||
PRAGMA journal_mode = delete;
|
||||
} {delete}
|
||||
db close
|
||||
do_test 1.2.1 { file size test.db } {1024}
|
||||
do_test 1.2.2 { hexio_read test.db 18 2 } 0101
|
||||
|
||||
sqlite3 db test.db
|
||||
do_execsql_test 1.3.0 {
|
||||
SELECT * FROM sqlite_master;
|
||||
PRAGMA journal_mode = wal;
|
||||
} {wal}
|
||||
db close
|
||||
do_test 1.3.1 { file size test.db } {1024}
|
||||
do_test 1.3.2 { hexio_read test.db 18 2 } 0202
|
||||
|
||||
sqlite3 db test.db
|
||||
do_catchsql_test 1.4.0 {
|
||||
PRAGMA journal_mode = wal2;
|
||||
} {1 {cannot change from wal to wal2 mode}}
|
||||
do_execsql_test 1.4.1 {
|
||||
PRAGMA journal_mode = wal;
|
||||
PRAGMA journal_mode = delete;
|
||||
PRAGMA journal_mode = wal2;
|
||||
PRAGMA journal_mode = wal2;
|
||||
} {wal delete wal2 wal2}
|
||||
do_catchsql_test 1.4.2 {
|
||||
PRAGMA journal_mode = wal;
|
||||
} {1 {cannot change from wal2 to wal mode}}
|
||||
db close
|
||||
do_test 1.4.3 { hexio_read test.db 18 2 } 0303
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Test that recovery in wal2 mode works.
|
||||
#
|
||||
forcedelete test.db test.db-wal test.db-wal2
|
||||
reset_db
|
||||
do_execsql_test 2.0 {
|
||||
CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
|
||||
PRAGMA journal_mode = wal2;
|
||||
PRAGMA journal_size_limit = 5000;
|
||||
} {wal2 5000}
|
||||
|
||||
proc wal_hook {DB nm nFrame} { $DB eval { PRAGMA wal_checkpoint } }
|
||||
db wal_hook {wal_hook db}
|
||||
|
||||
for {set i 1} {$i <= 200} {incr i} {
|
||||
execsql { INSERT INTO t1 VALUES(NULL, randomblob(100)) }
|
||||
set res [db eval { SELECT sum(a), md5sum(b) FROM t1 }]
|
||||
|
||||
do_test 2.1.$i {
|
||||
foreach f [glob -nocomplain test.db2*] { forcedelete $f }
|
||||
forcecopy test.db test.db2
|
||||
forcecopy test.db-wal test.db2-wal
|
||||
forcecopy test.db-wal2 test.db2-wal2
|
||||
|
||||
sqlite3 db2 test.db2
|
||||
db2 eval { SELECT sum(a), md5sum(b) FROM t1 }
|
||||
} $res
|
||||
|
||||
db2 close
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
reset_db
|
||||
do_execsql_test 3.0 {
|
||||
CREATE TABLE t1(x BLOB, y INTEGER PRIMARY KEY);
|
||||
CREATE INDEX i1 ON t1(x);
|
||||
PRAGMA cache_size = 5;
|
||||
PRAGMA journal_mode = wal2;
|
||||
} {wal2}
|
||||
|
||||
do_test 3.1 {
|
||||
execsql BEGIN
|
||||
for {set i 1} {$i < 1000} {incr i} {
|
||||
execsql { INSERT INTO t1 VALUES(randomblob(800), $i) }
|
||||
}
|
||||
execsql COMMIT
|
||||
} {}
|
||||
|
||||
do_execsql_test 3.2 {
|
||||
PRAGMA integrity_check;
|
||||
} {ok}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
catch { db close }
|
||||
foreach f [glob -nocomplain test.db*] { forcedelete $f }
|
||||
reset_db
|
||||
do_execsql_test 4.0 {
|
||||
CREATE TABLE t1(x, y);
|
||||
PRAGMA journal_mode = wal2;
|
||||
} {wal2}
|
||||
|
||||
do_execsql_test 4.1 {
|
||||
SELECT * FROM t1;
|
||||
} {}
|
||||
|
||||
do_execsql_test 4.2 {
|
||||
INSERT INTO t1 VALUES(1, 2);
|
||||
} {}
|
||||
|
||||
do_execsql_test 4.3 {
|
||||
SELECT * FROM t1;
|
||||
} {1 2}
|
||||
|
||||
do_test 4.4 {
|
||||
sqlite3 db2 test.db
|
||||
execsql { SELECT * FROM t1 } db2
|
||||
} {1 2}
|
||||
|
||||
do_test 4.5 {
|
||||
lsort [glob test.db*]
|
||||
} {test.db test.db-shm test.db-wal test.db-wal2}
|
||||
|
||||
do_test 4.6 {
|
||||
db close
|
||||
db2 close
|
||||
sqlite3 db test.db
|
||||
execsql { SELECT * FROM t1 }
|
||||
} {1 2}
|
||||
|
||||
do_execsql_test 4.7 {
|
||||
PRAGMA journal_size_limit = 4000;
|
||||
INSERT INTO t1 VALUES(3, 4);
|
||||
INSERT INTO t1 VALUES(5, 6);
|
||||
INSERT INTO t1 VALUES(7, 8);
|
||||
INSERT INTO t1 VALUES(9, 10);
|
||||
INSERT INTO t1 VALUES(11, 12);
|
||||
INSERT INTO t1 VALUES(13, 14);
|
||||
INSERT INTO t1 VALUES(15, 16);
|
||||
INSERT INTO t1 VALUES(17, 18);
|
||||
SELECT * FROM t1;
|
||||
} {4000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18}
|
||||
|
||||
do_test 4.8 {
|
||||
sqlite3 db2 test.db
|
||||
execsql { SELECT * FROM t1 } db2
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18}
|
||||
|
||||
do_test 4.9 {
|
||||
db close
|
||||
db2 close
|
||||
lsort [glob test.db*]
|
||||
} {test.db}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
reset_db
|
||||
do_execsql_test 5.0 {
|
||||
CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c);
|
||||
CREATE INDEX i1 ON t1(b, c);
|
||||
PRAGMA journal_mode = wal2;
|
||||
PRAGMA journal_size_limit = 4000;
|
||||
} {wal2 4000}
|
||||
|
||||
proc wal_hook {DB nm nFrame} {
|
||||
$DB eval { PRAGMA wal_checkpoint }
|
||||
}
|
||||
db wal_hook [list wal_hook db]
|
||||
|
||||
|
||||
foreach js {4000 8000 12000} {
|
||||
foreach NROW [list 100 200 300 400 500 600 1000] {
|
||||
do_test 5.$js.$NROW.1 {
|
||||
db eval "DELETE FROM t1"
|
||||
db eval "PRAGMA journal_size_limit = $js"
|
||||
set nTotal 0
|
||||
for {set i 0} {$i < $NROW} {incr i} {
|
||||
db eval { INSERT INTO t1 VALUES($i, $i, randomblob(abs(random()%50))) }
|
||||
incr nTotal $i
|
||||
}
|
||||
set {} {}
|
||||
} {}
|
||||
|
||||
do_test 5.$js.$NROW.2 {
|
||||
sqlite3 db2 test.db
|
||||
db2 eval {
|
||||
PRAGMA integrity_check;
|
||||
SELECT count(*), sum(b) FROM t1;
|
||||
}
|
||||
} [list ok $NROW $nTotal]
|
||||
|
||||
db2 close
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
reset_db
|
||||
do_execsql_test 6.0 {
|
||||
CREATE TABLE tx(x);
|
||||
PRAGMA journal_mode = wal2;
|
||||
PRAGMA journal_size_limit = 3500;
|
||||
} {wal2 3500}
|
||||
|
||||
do_test 6.1 {
|
||||
for {set i 0} {$i < 10} {incr i} {
|
||||
execsql "CREATE TABLE t$i (x);"
|
||||
}
|
||||
} {}
|
||||
|
||||
do_test 6.2.1 {
|
||||
foreach f [glob -nocomplain test.db2*] { forcedelete $f }
|
||||
forcecopy test.db-wal2 test.db2-wal2
|
||||
sqlite3 db2 test.db2
|
||||
db2 eval { SELECT * FROM sqlite_master }
|
||||
} {}
|
||||
do_test 6.2.2 {
|
||||
db2 eval {
|
||||
PRAGMA journal_mode = wal2;
|
||||
SELECT * FROM sqlite_master;
|
||||
}
|
||||
} {wal2}
|
||||
|
||||
do_test 6.3.1 {
|
||||
db2 close
|
||||
foreach f [glob -nocomplain test.db2*] { forcedelete $f }
|
||||
forcecopy test.db-wal2 test.db2-wal2
|
||||
forcecopy test.db test.db2
|
||||
sqlite3 db2 test.db2
|
||||
db2 eval { SELECT * FROM sqlite_master }
|
||||
} {table tx tx 2 {CREATE TABLE tx(x)}}
|
||||
do_test 6.3.2 {
|
||||
db2 eval {
|
||||
PRAGMA journal_mode = wal2;
|
||||
SELECT * FROM sqlite_master;
|
||||
}
|
||||
} {wal2 table tx tx 2 {CREATE TABLE tx(x)}}
|
||||
|
||||
do_test 6.4.1 {
|
||||
db2 close
|
||||
foreach f [glob -nocomplain test.db2*] { forcedelete $f }
|
||||
forcecopy test.db-wal2 test.db2-wal2
|
||||
forcecopy test.db-wal test.db2-wal
|
||||
sqlite3 db2 test.db2
|
||||
db2 eval { SELECT * FROM sqlite_master }
|
||||
} {}
|
||||
do_test 6.4.2 {
|
||||
db2 eval {
|
||||
PRAGMA journal_mode = wal2;
|
||||
SELECT * FROM sqlite_master;
|
||||
}
|
||||
} {wal2}
|
||||
db2 close
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
reset_db
|
||||
sqlite3 db2 test.db
|
||||
do_execsql_test 7.0 {
|
||||
PRAGMA journal_size_limit = 10000;
|
||||
PRAGMA journal_mode = wal2;
|
||||
PRAGMA wal_autocheckpoint = 0;
|
||||
BEGIN;
|
||||
CREATE TABLE t1(a);
|
||||
INSERT INTO t1 VALUES( randomblob(8000) );
|
||||
COMMIT;
|
||||
} {10000 wal2 0}
|
||||
|
||||
do_test 7.1 {
|
||||
list [file size test.db-wal] [file size test.db-wal2]
|
||||
} {9464 0}
|
||||
|
||||
# Connection db2 is holding a PART1 lock.
|
||||
#
|
||||
# 7.2.2: Test that the PART1 does not prevent db from switching to the
|
||||
# other wal file.
|
||||
#
|
||||
# 7.2.3: Test that the PART1 does prevent a checkpoint of test.db-wal.
|
||||
#
|
||||
# 7.2.4: Test that after the PART1 is released the checkpoint is possible.
|
||||
#
|
||||
do_test 7.2.1 {
|
||||
execsql {
|
||||
BEGIN;
|
||||
SELECT count(*) FROM t1;
|
||||
} db2
|
||||
} {1}
|
||||
do_test 7.2.2 {
|
||||
execsql {
|
||||
INSERT INTO t1 VALUES( randomblob(800) );
|
||||
INSERT INTO t1 VALUES( randomblob(800) );
|
||||
}
|
||||
list [file size test.db-wal] [file size test.db-wal2] [file size test.db]
|
||||
} {13656 3176 1024}
|
||||
do_test 7.2.3 {
|
||||
execsql { PRAGMA wal_checkpoint }
|
||||
list [file size test.db-wal] [file size test.db-wal2] [file size test.db]
|
||||
} {13656 3176 1024}
|
||||
do_test 7.2.4 {
|
||||
execsql { END } db2
|
||||
execsql { PRAGMA wal_checkpoint }
|
||||
list [file size test.db-wal] [file size test.db-wal2] [file size test.db]
|
||||
} {13656 3176 11264}
|
||||
|
||||
# Connection db2 is holding a PART2_FULL1 lock.
|
||||
#
|
||||
# 7.3.2: Test that the lock does not prevent checkpointing.
|
||||
#
|
||||
# 7.3.3: Test that the lock does prevent the writer from overwriting
|
||||
# test.db-wal.
|
||||
#
|
||||
# 7.3.4: Test that after the PART2_FULL1 is released the writer can
|
||||
# switch wal files and overwrite test.db-wal
|
||||
#
|
||||
db close
|
||||
db2 close
|
||||
sqlite3 db test.db
|
||||
sqlite3 db2 test.db
|
||||
do_test 7.3.1 {
|
||||
execsql {
|
||||
PRAGMA wal_autocheckpoint = 0;
|
||||
PRAGMA journal_size_limit = 10000;
|
||||
INSERT INTO t1 VALUES(randomblob(10000));
|
||||
INSERT INTO t1 VALUES(randomblob(500));
|
||||
}
|
||||
execsql {
|
||||
BEGIN;
|
||||
SELECT count(*) FROM t1;
|
||||
} db2
|
||||
list [file size test.db-wal] [file size test.db-wal2] [file size test.db]
|
||||
} {12608 3176 12288}
|
||||
do_test 7.3.2 {
|
||||
execsql { PRAGMA wal_checkpoint }
|
||||
list [file size test.db-wal] [file size test.db-wal2] [file size test.db]
|
||||
} {12608 3176 22528}
|
||||
do_test 7.3.3 {
|
||||
execsql {
|
||||
INSERT INTO t1 VALUES(randomblob(10000));
|
||||
INSERT INTO t1 VALUES(randomblob(500));
|
||||
}
|
||||
list [file size test.db-wal] [file size test.db-wal2] [file size test.db]
|
||||
} {12608 18896 22528}
|
||||
do_test 7.3.4 {
|
||||
execsql END db2
|
||||
execsql { INSERT INTO t1 VALUES(randomblob(5000)); }
|
||||
list [file size test.db-wal] [file size test.db-wal2] [file size test.db]
|
||||
} {12608 18896 22528}
|
||||
|
||||
# Connection db2 is holding a PART2 lock.
|
||||
#
|
||||
# 7.4.2: Test that the lock does not prevent writer switching to test.db-wal.
|
||||
#
|
||||
# 7.3.3: Test that the lock does prevent checkpointing of test.db-wal2.
|
||||
#
|
||||
# 7.3.4: Test that after the PART2 is released test.db-wal2 can be
|
||||
# checkpointed.
|
||||
#
|
||||
db close
|
||||
db2 close
|
||||
breakpoint
|
||||
sqlite3 db test.db
|
||||
sqlite3 db2 test.db
|
||||
do_test 7.4.1 {
|
||||
execsql {
|
||||
PRAGMA wal_autocheckpoint = 0;
|
||||
PRAGMA journal_size_limit = 10000;
|
||||
INSERT INTO t1 VALUES(randomblob(10000));
|
||||
INSERT INTO t1 VALUES(randomblob(10000));
|
||||
PRAGMA wal_checkpoint;
|
||||
}
|
||||
execsql {
|
||||
BEGIN;
|
||||
SELECT count(*) FROM t1;
|
||||
} db2
|
||||
list [file size test.db-wal] [file size test.db-wal2] [file size test.db]
|
||||
} {12608 12608 50176}
|
||||
do_test 7.4.2 {
|
||||
execsql {
|
||||
INSERT INTO t1 VALUES(randomblob(5000));
|
||||
}
|
||||
list [file size test.db-wal] [file size test.db-wal2] [file size test.db]
|
||||
} {12608 12608 50176}
|
||||
do_test 7.4.3 {
|
||||
execsql { PRAGMA wal_checkpoint }
|
||||
list [file size test.db-wal] [file size test.db-wal2] [file size test.db]
|
||||
} {12608 12608 50176}
|
||||
do_test 7.4.4 {
|
||||
execsql END db2
|
||||
execsql { PRAGMA wal_checkpoint }
|
||||
list [file size test.db-wal] [file size test.db-wal2] [file size test.db]
|
||||
} {12608 12608 60416}
|
||||
|
||||
# Connection db2 is holding a PART1_FULL2 lock.
|
||||
#
|
||||
# 7.5.2: Test that the lock does not prevent a checkpoint of test.db-wal2.
|
||||
#
|
||||
# 7.5.3: Test that the lock does prevent the writer from overwriting
|
||||
# test.db-wal2.
|
||||
#
|
||||
# 7.5.4: Test that after the PART1_FULL2 lock is released, the writer
|
||||
# can switch to test.db-wal2.
|
||||
#
|
||||
db close
|
||||
db2 close
|
||||
sqlite3 db test.db
|
||||
sqlite3 db2 test.db
|
||||
do_test 7.5.1 {
|
||||
execsql {
|
||||
PRAGMA wal_autocheckpoint = 0;
|
||||
PRAGMA journal_size_limit = 10000;
|
||||
INSERT INTO t1 VALUES(randomblob(10000));
|
||||
INSERT INTO t1 VALUES(randomblob(10000));
|
||||
PRAGMA wal_checkpoint;
|
||||
INSERT INTO t1 VALUES(randomblob(5000));
|
||||
}
|
||||
execsql {
|
||||
BEGIN;
|
||||
SELECT count(*) FROM t1;
|
||||
} db2
|
||||
list [file size test.db-wal] [file size test.db-wal2] [file size test.db]
|
||||
} {12608 12608 76800}
|
||||
do_test 7.5.2 {
|
||||
execsql { PRAGMA wal_checkpoint }
|
||||
list [file size test.db-wal] [file size test.db-wal2] [file size test.db]
|
||||
} {12608 12608 87040}
|
||||
do_test 7.5.3.1 {
|
||||
execsql { INSERT INTO t1 VALUES(randomblob(5000)) }
|
||||
list [file size test.db-wal] [file size test.db-wal2] [file size test.db]
|
||||
} {14704 12608 87040}
|
||||
do_test 7.5.3.2 {
|
||||
execsql { INSERT INTO t1 VALUES(randomblob(5000)) }
|
||||
list [file size test.db-wal] [file size test.db-wal2] [file size test.db]
|
||||
} {22040 12608 87040}
|
||||
do_test 7.5.4 {
|
||||
execsql END db2
|
||||
execsql { INSERT INTO t1 VALUES(randomblob(5000)) }
|
||||
list [file size test.db-wal] [file size test.db-wal2] [file size test.db]
|
||||
} {22040 12608 87040}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
reset_db
|
||||
do_execsql_test 8.0 {
|
||||
PRAGMA journal_size_limit = 10000;
|
||||
PRAGMA journal_mode = wal2;
|
||||
CREATE TABLE t1(x);
|
||||
INSERT INTO t1 VALUES( hex( randomblob(5000) ) );
|
||||
INSERT INTO t1 VALUES( hex( randomblob(5000) ) );
|
||||
INSERT INTO t1 VALUES( hex( randomblob(5000) ) );
|
||||
INSERT INTO t1 VALUES( hex( randomblob(5000) ) );
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES( hex( randomblob(5000) ) );
|
||||
} {10000 wal2}
|
||||
|
||||
sqlite3 db2 test.db
|
||||
do_execsql_test -db db2 8.1 {
|
||||
PRAGMA wal_checkpoint;
|
||||
} {0 50 13}
|
||||
|
||||
do_execsql_test 8.2 {
|
||||
COMMIT;
|
||||
}
|
||||
|
||||
db2 close
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
reset_db
|
||||
do_execsql_test 9.0 {
|
||||
PRAGMA journal_size_limit = 10000;
|
||||
PRAGMA journal_mode = wal2;
|
||||
CREATE TABLE t1(x);
|
||||
INSERT INTO t1 VALUES( hex( randomblob(5000) ) );
|
||||
INSERT INTO t1 VALUES( hex( randomblob(5000) ) );
|
||||
INSERT INTO t1 VALUES( hex( randomblob(5000) ) );
|
||||
INSERT INTO t1 VALUES( hex( randomblob(5000) ) );
|
||||
} {10000 wal2}
|
||||
|
||||
do_execsql_test 9.1 {
|
||||
PRAGMA wal_checkpoint;
|
||||
} {0 50 13}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Check that it is possible to do a non-PASSIVE checkpoint on a wal2
|
||||
# db without blocking writers.
|
||||
#
|
||||
reset_db
|
||||
do_execsql_test 10.0 {
|
||||
PRAGMA journal_size_limit = 10000;
|
||||
PRAGMA journal_mode = wal2;
|
||||
CREATE TABLE t1(x);
|
||||
INSERT INTO t1 VALUES( hex( randomblob(5000) ) );
|
||||
INSERT INTO t1 VALUES( hex( randomblob(5000) ) );
|
||||
INSERT INTO t1 VALUES( hex( randomblob(5000) ) );
|
||||
INSERT INTO t1 VALUES( hex( randomblob(5000) ) );
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES( hex( randomblob(5000) ) );
|
||||
} {10000 wal2}
|
||||
|
||||
sqlite3 db2 test.db
|
||||
do_execsql_test -db db2 10.1 {
|
||||
PRAGMA wal_checkpoint = FULL;
|
||||
} {0 50 13}
|
||||
|
||||
do_execsql_test 10.2 {
|
||||
COMMIT;
|
||||
}
|
||||
|
||||
finish_test
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
# 2018 December 5
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing the operation of the library in
|
||||
# "PRAGMA journal_mode=WAL2" mode.
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
|
||||
set testprefix wal2snapshot
|
||||
ifcapable !wal {finish_test ; return }
|
||||
ifcapable !snapshot {finish_test; return}
|
||||
|
||||
foreach {tn mode} {1 wal 2 wal2} {
|
||||
reset_db
|
||||
do_execsql_test $tn.1 "PRAGMA journal_mode = $mode" $mode
|
||||
|
||||
do_execsql_test $tn.2 {
|
||||
CREATE TABLE t1(a, b);
|
||||
INSERT INTO t1 VALUES(1, 2);
|
||||
INSERT INTO t1 VALUES(3, 4);
|
||||
BEGIN;
|
||||
}
|
||||
|
||||
# Check that sqlite3_snapshot_get() is an error for a wal2 db.
|
||||
#
|
||||
if {$tn==1} {
|
||||
do_test 1.3 {
|
||||
set S [sqlite3_snapshot_get db main]
|
||||
sqlite3_snapshot_free $S
|
||||
} {}
|
||||
} else {
|
||||
do_test 2.3 {
|
||||
list [catch { sqlite3_snapshot_get db main } msg] $msg
|
||||
} {1 SQLITE_ERROR}
|
||||
}
|
||||
|
||||
# Check that sqlite3_snapshot_recover() is an error for a wal2 db.
|
||||
#
|
||||
do_execsql_test $tn.4 COMMIT
|
||||
if {$tn==1} {
|
||||
do_test 1.5 {
|
||||
sqlite3_snapshot_recover db main
|
||||
} {}
|
||||
} else {
|
||||
do_test 2.5 {
|
||||
list [catch { sqlite3_snapshot_recover db main } msg] $msg
|
||||
} {1 SQLITE_ERROR}
|
||||
}
|
||||
|
||||
# Check that sqlite3_snapshot_open() is an error for a wal2 db.
|
||||
#
|
||||
if {$tn==1} {
|
||||
do_test 1.6 {
|
||||
execsql BEGIN
|
||||
set SNAPSHOT [sqlite3_snapshot_get_blob db main]
|
||||
sqlite3_snapshot_open_blob db main $SNAPSHOT
|
||||
execsql COMMIT
|
||||
} {}
|
||||
} else {
|
||||
do_test 2.6.1 {
|
||||
execsql BEGIN
|
||||
set res [
|
||||
list [catch { sqlite3_snapshot_open_blob db main $SNAPSHOT } msg] $msg
|
||||
]
|
||||
execsql COMMIT
|
||||
set res
|
||||
} {1 SQLITE_ERROR}
|
||||
do_test 2.6.2 {
|
||||
execsql BEGIN
|
||||
execsql {SELECT * FROM sqlite_master}
|
||||
set res [
|
||||
list [catch { sqlite3_snapshot_open_blob db main $SNAPSHOT } msg] $msg
|
||||
]
|
||||
execsql COMMIT
|
||||
set res
|
||||
} {1 SQLITE_ERROR}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
finish_test
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ proc lock_callback {method filename handle lock} {
|
||||
db2 eval { INSERT INTO x VALUES('x') }
|
||||
}
|
||||
}
|
||||
db timeout 10
|
||||
db timeout 1100
|
||||
do_catchsql_test 2.4 {
|
||||
BEGIN EXCLUSIVE;
|
||||
} {0 {}}
|
||||
|
||||
@@ -395,6 +395,8 @@ set options(THREADSAFE) {
|
||||
#endif
|
||||
}
|
||||
|
||||
set options(WAL2) { "WAL2", }
|
||||
|
||||
proc trim_name {in} {
|
||||
set ret $in
|
||||
if {[string range $in 0 6]=="SQLITE_"} {
|
||||
|
||||
+2
-10
@@ -83,19 +83,11 @@ int main(int argc, char const * const * argv){
|
||||
printf("{\"libVersion\": \"%s\", "
|
||||
"\"libVersionNumber\": %d, "
|
||||
"\"sourceId\": \"%s\","
|
||||
"\"downloadVersion\": %d,"
|
||||
"\"scm\":{ "
|
||||
"\"sha3-256\": \"%s\","
|
||||
"\"branch\": \"" SQLITE_SCM_BRANCH "\","
|
||||
"\"tags\": \"" SQLITE_SCM_TAGS "\","
|
||||
"\"datetime\": \"" SQLITE_SCM_DATETIME "\""
|
||||
"}"
|
||||
"}"/*missing newline is intentional*/,
|
||||
"\"downloadVersion\": %d}"/*missing newline is intentional*/,
|
||||
SQLITE_VERSION,
|
||||
SQLITE_VERSION_NUMBER,
|
||||
SQLITE_SOURCE_ID,
|
||||
dlVersion,
|
||||
SQLITE_SOURCE_ID+20);
|
||||
dlVersion);
|
||||
}else{
|
||||
if(fQuote) printf("%c", '"');
|
||||
if( fVersion ){
|
||||
|
||||
Reference in New Issue
Block a user