From a7f659740056f81291498f4a27a0b4ac4e9b0e86 Mon Sep 17 00:00:00 2001 From: dan Date: Mon, 2 Nov 2015 18:32:00 +0000 Subject: [PATCH 01/32] Add the "--jobs N" option to the releasetest.tcl script to allow tests to be run in parallel by N processes. N defaults to 1. FossilOrigin-Name: 3d29f912cb7c6ee3e4903b1b14dd7ae82e4d02b1 --- manifest | 17 ++-- manifest.uuid | 2 +- test/releasetest.tcl | 197 ++++++++++++++++++++++++++++++++++--------- 3 files changed, 169 insertions(+), 47 deletions(-) diff --git a/manifest b/manifest index fc7f03f6bc..6edacc5fa7 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C If\sa\stable-constraint\sPRIMARY\sKEY\slists\sa\ssingle\scolumn\sin\ssingle-quotes\sand\nthat\scolumn\shas\stype\sINTEGER,\sthen\smake\sthat\scolumn\san\sinteger\sprimary\skey,\nfor\shistorical\scompatibility.\s\sFix\sfor\sticket\s[ac661962a2aeab3c331]. -D 2015-11-01T21:19:13.044 +C Add\sthe\s"--jobs\sN"\soption\sto\sthe\sreleasetest.tcl\sscript\sto\sallow\stests\sto\sbe\srun\sin\sparallel\sby\sN\sprocesses.\sN\sdefaults\sto\s1. +D 2015-11-02T18:32:00.281 F Makefile.in 4469ed8b02a9934fea9503d791165367d19db2f7 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 702d3e98f3afc6587a78481257f3c4c900efc3a4 @@ -948,7 +948,7 @@ F test/rbu.test 168573d353cd0fd10196b87b0caa322c144ef736 F test/rdonly.test 64e2696c322e3538df0b1ed624e21f9a23ed9ff8 F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.tcl 67a82199e6ddee609211488bc04ed3f9ea3aa28a +F test/releasetest.tcl 27ce760f7ed8f9ccfc479b52380b5ab3b23df1d4 F test/resolver01.test f4022acafda7f4d40eca94dbf16bc5fc4ac30ceb F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14 @@ -1397,7 +1397,10 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 9f19420b0a79dff65fc3a9d548f4b3fc4955f9f9 -R 84796f7face623f0835cebd2cbfc3bf7 -U drh -Z 6a5992b91acc5a2e6d8856fb63b43984 +P db319a035feeb6f8fcd04f90fb10cd4b06e68184 +R 091ec514c497414ee77bdc2045b96916 +T *branch * mp-releasetest +T *sym-mp-releasetest * +T -sym-trunk * +U dan +Z 4ab3d2d6b9016bc691ec66f068d2b949 diff --git a/manifest.uuid b/manifest.uuid index d010074779..2bb524678c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -db319a035feeb6f8fcd04f90fb10cd4b06e68184 \ No newline at end of file +3d29f912cb7c6ee3e4903b1b14dd7ae82e4d02b1 \ No newline at end of file diff --git a/test/releasetest.tcl b/test/releasetest.tcl index 04c2419ace..e19b300820 100644 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -285,6 +285,9 @@ array set ::Platforms [strip_comments { ######################################################################### ######################################################################### +# Configuration verification: Check that each entry in the list of configs +# specified for each platforms exists. +# foreach {key value} [array get ::Platforms] { foreach {v t} $value { if {0==[info exists ::Configs($v)]} { @@ -386,7 +389,141 @@ proc count_tests_and_errors {logfile rcVar errmsgVar} { } } -proc run_test_suite {name testtarget config} { +#-------------------------------------------------------------------------- +# This command is invoked as the [main] routine for scripts run with the +# "--slave" option. +# +# For each test (i.e. "configure && make test" execution), the master +# process spawns a process with the --slave option. It writes two lines +# to the slaves stdin. The first contains a single boolean value - the +# value of ::TRACE to use in the slave script. The second line contains a +# list in the same format as each element of the list passed to the +# [run_all_test_suites] command in the master process. +# +# The slave then runs the "configure && make test" commands specified. It +# exits successfully if the tests passes, or with a non-zero error code +# otherwise. +# +proc run_slave_test {} { + # Read global vars configuration from stdin. + set V [gets stdin] + foreach {::TRACE} $V {} + + # Read the test-suite configuration from stdin. + set T [gets stdin] + foreach {title dir configOpts testtarget cflags opts} $T {} + + # Create and switch to the test directory. + trace_cmd file mkdir $dir + trace_cmd cd $dir + catch {file delete core} + catch {file delete test.log} + + # Run the "./configure && make" commands. + set rc 0 + set rc [catch [configureCommand $configOpts]] + if {!$rc} { + set rc [catch [makeCommand $testtarget $cflags $opts]] + } + + # Exis successfully if the test passed, or with a non-zero error code + # otherwise. + exit $rc +} + +# This command is invoked in the master process each time a slave +# file-descriptor is readable. +# +proc slave_fileevent {fd T tm1} { + global G + foreach {title dir configOpts testtarget cflags opts} $T {} + + if {[eof $fd]} { + fconfigure $fd -blocking 1 + set rc [catch { close $fd }] + + set errmsg {} + count_tests_and_errors [file join $dir test.log] rc errmsg + + if {!$::TRACE} { + set tm2 [clock seconds] + set hours [expr {($tm2-$tm1)/3600}] + set minutes [expr {(($tm2-$tm1)/60)%60}] + set seconds [expr {($tm2-$tm1)%60}] + set tm [format (%02d:%02d:%02d) $hours $minutes $seconds] + + if {$rc} { + set status FAIL + incr ::NERR + } else { + set status Ok + } + + set n [string length $title] + PUTS "finished: ${title}[string repeat . [expr {63-$n}]] $status $tm" + if {$errmsg!=""} {PUTS " $errmsg"} + flush stdout + } + + incr G(nJob) -1 + } else { + set line [gets $fd] + if {[string trim $line] != ""} { + puts "Trace : $title - \"$line\"" + } + } +} + +#-------------------------------------------------------------------------- +# The only argument passed to this function is a list of test-suites to +# run. Each "test-suite" is itself a list consisting of the following +# elements: +# +# * Test title (for display). +# * The name of the directory to run the test in. +# * The argument for [configureCommand] +# * The first argument for [makeCommand] +# * The second argument for [makeCommand] +# * The third argument for [makeCommand] +# +proc run_all_test_suites {alltests} { + global G + set tests $alltests + + set G(nJob) 0 + + while {[llength $tests]>0 || $G(nJob)>0} { + if {$G(nJob)>=$::JOBS || [llength $tests]==0} { + vwait G(nJob) + } + + if {[llength $tests]>0} { + set T [lindex $tests 0] + set tests [lrange $tests 1 end] + foreach {title dir configOpts testtarget cflags opts} $T {} + if {!$::TRACE} { + set n [string length $title] + PUTS "starting: ${title}" + flush stdout + } + + # Run the job. + # + set tm1 [clock seconds] + incr G(nJob) + set fd [open "|[info nameofexecutable] [info script] --slave" r+] + fconfigure $fd -blocking 0 + fileevent $fd readable [list slave_fileevent $fd $T $tm1] + puts $fd [list $::TRACE] + puts $fd [list {*}$T] + flush $fd + } + } +} + +proc add_test_suite {listvar name testtarget config} { + upvar $listvar alltests + # Tcl variable $opts is used to build up the value used to set the # OPTS Makefile variable. Variable $cflags holds the value for # CFLAGS. The makefile will pass OPTS to both gcc and lemon, but @@ -431,40 +568,7 @@ proc run_test_suite {name testtarget config} { append opts " -DSQLITE_OS_UNIX=1" } - if {!$::TRACE} { - set n [string length $title] - PUTS -nonewline "${title}[string repeat . [expr {63-$n}]]" - flush stdout - } - - set rc 0 - set tm1 [clock seconds] - set origdir [pwd] - trace_cmd file mkdir $dir - trace_cmd cd $dir - set errmsg {} - catch {file delete core} - set rc [catch [configureCommand $configOpts]] - if {!$rc} { - set rc [catch [makeCommand $testtarget $cflags $opts]] - count_tests_and_errors test.log rc errmsg - } - trace_cmd cd $origdir - set tm2 [clock seconds] - - if {!$::TRACE} { - set hours [expr {($tm2-$tm1)/3600}] - set minutes [expr {(($tm2-$tm1)/60)%60}] - set seconds [expr {($tm2-$tm1)%60}] - set tm [format (%02d:%02d:%02d) $hours $minutes $seconds] - if {$rc} { - PUTS " FAIL $tm" - incr ::NERR - } else { - PUTS " Ok $tm" - } - if {$errmsg!=""} {PUTS " $errmsg"} - } + lappend alltests [list $title $dir $configOpts $testtarget $cflags $opts] } # The following procedure returns the "configure" command to be exectued for @@ -507,9 +611,11 @@ proc trace_cmd {args} { if {$::TRACE} { PUTS $args } + set res "" if {!$::DRYRUN} { - uplevel 1 $args + set res [uplevel 1 $args] } + return $res } @@ -526,6 +632,7 @@ proc process_options {argv} { set ::DRYRUN 0 set ::EXEC exec set ::TRACE 0 + set ::JOBS 1 set ::WITHTCL {} set config {} set platform $::tcl_platform(os)-$::tcl_platform(machine) @@ -534,6 +641,11 @@ proc process_options {argv} { set x [lindex $argv $i] if {[regexp {^--[a-z]} $x]} {set x [string range $x 1 end]} switch -glob -- $x { + -slave { + run_slave_test + exit + } + -srcdir { incr i set ::SRCDIR [file normalize [lindex $argv $i]] @@ -544,6 +656,11 @@ proc process_options {argv} { set platform [lindex $argv $i] } + -jobs { + incr i + set ::JOBS [lindex $argv $i] + } + -quick { set ::QUICK 1 } @@ -689,7 +806,7 @@ proc main {argv} { set config_options [concat $::Configs($zConfig) $::EXTRACONFIG] incr NTEST - run_test_suite $zConfig $target $config_options + add_test_suite all $zConfig $target $config_options # If the configuration included the SQLITE_DEBUG option, then remove # it and run veryquick.test. If it did not include the SQLITE_DEBUG option @@ -703,16 +820,18 @@ proc main {argv} { if {$debug_idx < 0} { incr NTEST append config_options " -DSQLITE_DEBUG=1" - run_test_suite "${zConfig}_debug" $xtarget $config_options + add_test_suite all "${zConfig}_debug" $xtarget $config_options } else { incr NTEST regsub { *-DSQLITE_MEMDEBUG[^ ]* *} $config_options { } config_options regsub { *-DSQLITE_DEBUG[^ ]* *} $config_options { } config_options - run_test_suite "${zConfig}_ndebug" $xtarget $config_options + add_test_suite all "${zConfig}_ndebug" $xtarget $config_options } } } + run_all_test_suites $all + set elapsetime [expr {[clock seconds]-$STARTTIME}] set hr [expr {$elapsetime/3600}] set min [expr {($elapsetime/60)%60}] From 9525a86ba1c2539fcc5e7f0f66aada6c0d7afda4 Mon Sep 17 00:00:00 2001 From: dan Date: Mon, 2 Nov 2015 20:24:29 +0000 Subject: [PATCH 02/32] Fix releasetest.tcl so that output lines are less than 80 characters wide. FossilOrigin-Name: aef177fef049f9ffb0d138b947326dc0186b1f4f --- manifest | 15 ++++++--------- manifest.uuid | 2 +- test/releasetest.tcl | 2 +- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index 6edacc5fa7..618eceeab1 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\s"--jobs\sN"\soption\sto\sthe\sreleasetest.tcl\sscript\sto\sallow\stests\sto\sbe\srun\sin\sparallel\sby\sN\sprocesses.\sN\sdefaults\sto\s1. -D 2015-11-02T18:32:00.281 +C Fix\sreleasetest.tcl\sso\sthat\soutput\slines\sare\sless\sthan\s80\scharacters\swide. +D 2015-11-02T20:24:29.534 F Makefile.in 4469ed8b02a9934fea9503d791165367d19db2f7 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 702d3e98f3afc6587a78481257f3c4c900efc3a4 @@ -948,7 +948,7 @@ F test/rbu.test 168573d353cd0fd10196b87b0caa322c144ef736 F test/rdonly.test 64e2696c322e3538df0b1ed624e21f9a23ed9ff8 F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.tcl 27ce760f7ed8f9ccfc479b52380b5ab3b23df1d4 +F test/releasetest.tcl 3ab9971e63b86dd3601e15d7df5ab95ebcd59830 F test/resolver01.test f4022acafda7f4d40eca94dbf16bc5fc4ac30ceb F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14 @@ -1397,10 +1397,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P db319a035feeb6f8fcd04f90fb10cd4b06e68184 -R 091ec514c497414ee77bdc2045b96916 -T *branch * mp-releasetest -T *sym-mp-releasetest * -T -sym-trunk * +P 3d29f912cb7c6ee3e4903b1b14dd7ae82e4d02b1 +R 505a39a0f41499b686ed80eb068a99d4 U dan -Z 4ab3d2d6b9016bc691ec66f068d2b949 +Z 2e77fe00dc901cf4f51390d5b829205a diff --git a/manifest.uuid b/manifest.uuid index 2bb524678c..af60eda520 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3d29f912cb7c6ee3e4903b1b14dd7ae82e4d02b1 \ No newline at end of file +aef177fef049f9ffb0d138b947326dc0186b1f4f \ No newline at end of file diff --git a/test/releasetest.tcl b/test/releasetest.tcl index e19b300820..d81ef09e12 100644 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -460,7 +460,7 @@ proc slave_fileevent {fd T tm1} { } set n [string length $title] - PUTS "finished: ${title}[string repeat . [expr {63-$n}]] $status $tm" + PUTS "finished: ${title}[string repeat . [expr {53-$n}]] $status $tm" if {$errmsg!=""} {PUTS " $errmsg"} flush stdout } From e9e1505b3c6f3ff8861d9d20274ba7b1263ee72d Mon Sep 17 00:00:00 2001 From: dan Date: Mon, 2 Nov 2015 20:28:48 +0000 Subject: [PATCH 03/32] Fix releasetest.tcl so that it does not choke if a test fails so badly that there is no log file. Add the --jobs switch to the usage message. FossilOrigin-Name: 20e96f521fce12ffeb6be788e57bce88f287cff5 --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/releasetest.tcl | 9 ++++++++- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 618eceeab1..d94eb68db7 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sreleasetest.tcl\sso\sthat\soutput\slines\sare\sless\sthan\s80\scharacters\swide. -D 2015-11-02T20:24:29.534 +C Fix\sreleasetest.tcl\sso\sthat\sit\sdoes\snot\schoke\sif\sa\stest\sfails\sso\sbadly\sthat\sthere\sis\sno\slog\sfile.\sAdd\sthe\s--jobs\sswitch\sto\sthe\susage\smessage. +D 2015-11-02T20:28:48.981 F Makefile.in 4469ed8b02a9934fea9503d791165367d19db2f7 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 702d3e98f3afc6587a78481257f3c4c900efc3a4 @@ -948,7 +948,7 @@ F test/rbu.test 168573d353cd0fd10196b87b0caa322c144ef736 F test/rdonly.test 64e2696c322e3538df0b1ed624e21f9a23ed9ff8 F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.tcl 3ab9971e63b86dd3601e15d7df5ab95ebcd59830 +F test/releasetest.tcl 298556d91ee49375cf87c3c899483f50d4722a07 F test/resolver01.test f4022acafda7f4d40eca94dbf16bc5fc4ac30ceb F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14 @@ -1397,7 +1397,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 3d29f912cb7c6ee3e4903b1b14dd7ae82e4d02b1 -R 505a39a0f41499b686ed80eb068a99d4 +P aef177fef049f9ffb0d138b947326dc0186b1f4f +R 8b650d0156c14e56fe1cf3974aba955d U dan -Z 2e77fe00dc901cf4f51390d5b829205a +Z d28db9d91dacdee58d844fe7129a20ae diff --git a/manifest.uuid b/manifest.uuid index af60eda520..d5cc1bbeb0 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -aef177fef049f9ffb0d138b947326dc0186b1f4f \ No newline at end of file +20e96f521fce12ffeb6be788e57bce88f287cff5 \ No newline at end of file diff --git a/test/releasetest.tcl b/test/releasetest.tcl index d81ef09e12..b8e6c74156 100644 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -19,6 +19,7 @@ optional) are: --dryrun (Print what would have happened) --info (Show diagnostic info) --with-tcl=DIR (Use TCL build at DIR) + --jobs N (Use N processes - default 1) The default value for --srcdir is the parent of the directory holding this script. @@ -443,7 +444,13 @@ proc slave_fileevent {fd T tm1} { set rc [catch { close $fd }] set errmsg {} - count_tests_and_errors [file join $dir test.log] rc errmsg + set logfile [file join $dir test.log] + if {[file exists $logfile]} { + count_tests_and_errors [file join $dir test.log] rc errmsg + } elseif {$rc==0} { + set rc 1 + set errmsg "no test.log file..." + } if {!$::TRACE} { set tm2 [clock seconds] From d08a63ab6255f6ef9bb97eb2d49087234e317b9c Mon Sep 17 00:00:00 2001 From: dan Date: Mon, 2 Nov 2015 20:52:20 +0000 Subject: [PATCH 04/32] Fix the --dryrun option on the releasetest.tcl script. FossilOrigin-Name: e565e0261501e4c21e4ad3d12f9f5b24c761bf96 --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/releasetest.tcl | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index d94eb68db7..3f100a7b32 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sreleasetest.tcl\sso\sthat\sit\sdoes\snot\schoke\sif\sa\stest\sfails\sso\sbadly\sthat\sthere\sis\sno\slog\sfile.\sAdd\sthe\s--jobs\sswitch\sto\sthe\susage\smessage. -D 2015-11-02T20:28:48.981 +C Fix\sthe\s--dryrun\soption\son\sthe\sreleasetest.tcl\sscript. +D 2015-11-02T20:52:20.250 F Makefile.in 4469ed8b02a9934fea9503d791165367d19db2f7 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 702d3e98f3afc6587a78481257f3c4c900efc3a4 @@ -948,7 +948,7 @@ F test/rbu.test 168573d353cd0fd10196b87b0caa322c144ef736 F test/rdonly.test 64e2696c322e3538df0b1ed624e21f9a23ed9ff8 F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.tcl 298556d91ee49375cf87c3c899483f50d4722a07 +F test/releasetest.tcl 1012f41f1a5fefd6a62331332b97a9938e1c64cc F test/resolver01.test f4022acafda7f4d40eca94dbf16bc5fc4ac30ceb F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14 @@ -1397,7 +1397,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P aef177fef049f9ffb0d138b947326dc0186b1f4f -R 8b650d0156c14e56fe1cf3974aba955d +P 20e96f521fce12ffeb6be788e57bce88f287cff5 +R f117a4a5b3ef13cab54d6f985044aa83 U dan -Z d28db9d91dacdee58d844fe7129a20ae +Z a5ae3477937f7e46f7556e9e0025f641 diff --git a/manifest.uuid b/manifest.uuid index d5cc1bbeb0..f6c11f5fa7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -20e96f521fce12ffeb6be788e57bce88f287cff5 \ No newline at end of file +e565e0261501e4c21e4ad3d12f9f5b24c761bf96 \ No newline at end of file diff --git a/test/releasetest.tcl b/test/releasetest.tcl index b8e6c74156..c6d98a0116 100644 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -408,7 +408,7 @@ proc count_tests_and_errors {logfile rcVar errmsgVar} { proc run_slave_test {} { # Read global vars configuration from stdin. set V [gets stdin] - foreach {::TRACE} $V {} + foreach {::TRACE ::MSVC ::DRYRUN} $V {} # Read the test-suite configuration from stdin. set T [gets stdin] @@ -521,7 +521,7 @@ proc run_all_test_suites {alltests} { set fd [open "|[info nameofexecutable] [info script] --slave" r+] fconfigure $fd -blocking 0 fileevent $fd readable [list slave_fileevent $fd $T $tm1] - puts $fd [list $::TRACE] + puts $fd [list $::TRACE $::MSVC $::DRYRUN] puts $fd [list {*}$T] flush $fd } From 59189433ba8a2c4bc2fbf579ea0f67edb454578d Mon Sep 17 00:00:00 2001 From: mistachkin Date: Mon, 2 Nov 2015 21:05:56 +0000 Subject: [PATCH 05/32] Get things working better on Windows with MSVC. FossilOrigin-Name: 22cc3e6c8e7f7eed854f8a50138ccb9c79bb7a23 --- manifest | 14 +++++++------- manifest.uuid | 2 +- test/releasetest.tcl | 14 +++++++++++++- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 3f100a7b32..cb6c413e21 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sthe\s--dryrun\soption\son\sthe\sreleasetest.tcl\sscript. -D 2015-11-02T20:52:20.250 +C Get\sthings\sworking\sbetter\son\sWindows\swith\sMSVC. +D 2015-11-02T21:05:56.617 F Makefile.in 4469ed8b02a9934fea9503d791165367d19db2f7 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 702d3e98f3afc6587a78481257f3c4c900efc3a4 @@ -948,7 +948,7 @@ F test/rbu.test 168573d353cd0fd10196b87b0caa322c144ef736 F test/rdonly.test 64e2696c322e3538df0b1ed624e21f9a23ed9ff8 F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.tcl 1012f41f1a5fefd6a62331332b97a9938e1c64cc +F test/releasetest.tcl 39d6de145cc95e81a6a48cead3fa7825a01040d3 F test/resolver01.test f4022acafda7f4d40eca94dbf16bc5fc4ac30ceb F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14 @@ -1397,7 +1397,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 20e96f521fce12ffeb6be788e57bce88f287cff5 -R f117a4a5b3ef13cab54d6f985044aa83 -U dan -Z a5ae3477937f7e46f7556e9e0025f641 +P e565e0261501e4c21e4ad3d12f9f5b24c761bf96 +R 1187737c11e82a8337e5d517b5bc7406 +U mistachkin +Z 7eb3b356bb9807dcced0017ec4636c5d diff --git a/manifest.uuid b/manifest.uuid index f6c11f5fa7..aa6b9eb88c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e565e0261501e4c21e4ad3d12f9f5b24c761bf96 \ No newline at end of file +22cc3e6c8e7f7eed854f8a50138ccb9c79bb7a23 \ No newline at end of file diff --git a/test/releasetest.tcl b/test/releasetest.tcl index c6d98a0116..19867f8ff6 100644 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -424,7 +424,18 @@ proc run_slave_test {} { set rc 0 set rc [catch [configureCommand $configOpts]] if {!$rc} { + if {[info exists ::env(TCLSH_CMD)]} { + set savedEnv(TCLSH_CMD) $::env(TCLSH_CMD) + } else { + unset -nocomplain savedEnv(TCLSH_CMD) + } + set ::env(TCLSH_CMD) [file nativename [info nameofexecutable]] set rc [catch [makeCommand $testtarget $cflags $opts]] + if {[info exists savedEnv(TCLSH_CMD)]} { + set ::env(TCLSH_CMD) $savedEnv(TCLSH_CMD) + } else { + unset -nocomplain ::env(TCLSH_CMD) + } } # Exis successfully if the test passed, or with a non-zero error code @@ -518,7 +529,8 @@ proc run_all_test_suites {alltests} { # set tm1 [clock seconds] incr G(nJob) - set fd [open "|[info nameofexecutable] [info script] --slave" r+] + set script [file normalize [info script]] + set fd [open "|[info nameofexecutable] $script --slave" r+] fconfigure $fd -blocking 0 fileevent $fd readable [list slave_fileevent $fd $T $tm1] puts $fd [list $::TRACE $::MSVC $::DRYRUN] From 3e6d22ad4d3301541270caf76016df237a5baa2f Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 2 Nov 2015 23:21:17 +0000 Subject: [PATCH 06/32] Fix the backcompat.test module so that it does not try to compare against itself on windows. FossilOrigin-Name: f625bce8b7c2884a092c70675a9c6ce15c29937e --- manifest | 14 +++++++------- manifest.uuid | 2 +- test/bc_common.tcl | 4 +++- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index cb6c413e21..1b88902e77 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Get\sthings\sworking\sbetter\son\sWindows\swith\sMSVC. -D 2015-11-02T21:05:56.617 +C Fix\sthe\sbackcompat.test\smodule\sso\sthat\sit\sdoes\snot\stry\sto\scompare\sagainst\sitself\non\swindows. +D 2015-11-02T23:21:17.389 F Makefile.in 4469ed8b02a9934fea9503d791165367d19db2f7 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 702d3e98f3afc6587a78481257f3c4c900efc3a4 @@ -480,7 +480,7 @@ F test/backup_ioerr.test 4c3c7147cee85b024ecf6e150e090c32fdbb5135 F test/backup_malloc.test 7162d604ec2b4683c4b3799a48657fb8b5e2d450 F test/badutf.test d5360fc31f643d37a973ab0d8b4fb85799c3169f F test/badutf2.test f5bc7f2d280670ecd79b9cf4f0f1760c607fe51f -F test/bc_common.tcl 5c8689cc6d2fb44b7c0968ae4f85eb26d50022fa +F test/bc_common.tcl 3eda41ef9cda7d5f6c205462c96228b301da4191 F test/between.test 34d375fb5ce1ae283ffe82b6b233e9f38e84fc6c F test/bigfile.test aa74f4e5db51c8e54a1d9de9fa65d01d1eb20b59 F test/bigfile2.test 1b489a3a39ae90c7f027b79110d6b4e1dbc71bfc @@ -1397,7 +1397,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P e565e0261501e4c21e4ad3d12f9f5b24c761bf96 -R 1187737c11e82a8337e5d517b5bc7406 -U mistachkin -Z 7eb3b356bb9807dcced0017ec4636c5d +P 22cc3e6c8e7f7eed854f8a50138ccb9c79bb7a23 +R c5c631dd7ea4596095ad68ee5913e438 +U drh +Z 0cc762df2756575e67d282e298d9c9ef diff --git a/manifest.uuid b/manifest.uuid index aa6b9eb88c..824dd2391f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -22cc3e6c8e7f7eed854f8a50138ccb9c79bb7a23 \ No newline at end of file +f625bce8b7c2884a092c70675a9c6ce15c29937e \ No newline at end of file diff --git a/test/bc_common.tcl b/test/bc_common.tcl index eb9b6db9d3..78010dfa46 100644 --- a/test/bc_common.tcl +++ b/test/bc_common.tcl @@ -7,11 +7,13 @@ proc bc_find_binaries {zCaption} { # against. # set binaries [list] - set pattern "[file tail [info nameofexec]]?*" + set self [file tail [info nameofexec]] + set pattern "$self?*" if {$::tcl_platform(platform)=="windows"} { set pattern [string map {\.exe {}} $pattern] } foreach file [glob -nocomplain $pattern] { + if {$file==$self} continue if {[file executable $file] && [file isfile $file]} {lappend binaries $file} } From da9da5624af05ce9d2d8cedfdef27866b89fe519 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Mon, 2 Nov 2015 23:29:58 +0000 Subject: [PATCH 07/32] Attempt to centralize and simplify the MSVC handling. FossilOrigin-Name: 4ae96d6dde7fc0a913d7719ec498686f9a1e3b98 --- manifest | 17 ++++---- manifest.uuid | 2 +- test/releasetest.tcl | 97 ++++++++++++++++++++++++++++++-------------- 3 files changed, 78 insertions(+), 38 deletions(-) diff --git a/manifest b/manifest index 1b88902e77..0347e7e67c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sthe\sbackcompat.test\smodule\sso\sthat\sit\sdoes\snot\stry\sto\scompare\sagainst\sitself\non\swindows. -D 2015-11-02T23:21:17.389 +C Attempt\sto\scentralize\sand\ssimplify\sthe\sMSVC\shandling. +D 2015-11-02T23:29:58.179 F Makefile.in 4469ed8b02a9934fea9503d791165367d19db2f7 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 702d3e98f3afc6587a78481257f3c4c900efc3a4 @@ -948,7 +948,7 @@ F test/rbu.test 168573d353cd0fd10196b87b0caa322c144ef736 F test/rdonly.test 64e2696c322e3538df0b1ed624e21f9a23ed9ff8 F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.tcl 39d6de145cc95e81a6a48cead3fa7825a01040d3 +F test/releasetest.tcl 203d4ae4b5967f45aff3a702f5ceca0e374c2701 F test/resolver01.test f4022acafda7f4d40eca94dbf16bc5fc4ac30ceb F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14 @@ -1397,7 +1397,10 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 22cc3e6c8e7f7eed854f8a50138ccb9c79bb7a23 -R c5c631dd7ea4596095ad68ee5913e438 -U drh -Z 0cc762df2756575e67d282e298d9c9ef +P f625bce8b7c2884a092c70675a9c6ce15c29937e +R eb29c38bdfc8b6dd27ad862c284260aa +T *branch * msvcRefactor +T *sym-msvcRefactor * +T -sym-mp-releasetest * +U mistachkin +Z b0a92943833683434e791bb83f5a4e2b diff --git a/manifest.uuid b/manifest.uuid index 824dd2391f..c1778b7e5c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f625bce8b7c2884a092c70675a9c6ce15c29937e \ No newline at end of file +4ae96d6dde7fc0a913d7719ec498686f9a1e3b98 \ No newline at end of file diff --git a/test/releasetest.tcl b/test/releasetest.tcl index 19867f8ff6..dea09a6ebe 100644 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -286,7 +286,7 @@ array set ::Platforms [strip_comments { ######################################################################### ######################################################################### -# Configuration verification: Check that each entry in the list of configs +# Configuration verification: Check that each entry in the list of configs # specified for each platforms exists. # foreach {key value} [array get ::Platforms] { @@ -392,12 +392,12 @@ proc count_tests_and_errors {logfile rcVar errmsgVar} { #-------------------------------------------------------------------------- # This command is invoked as the [main] routine for scripts run with the -# "--slave" option. +# "--slave" option. # # For each test (i.e. "configure && make test" execution), the master # process spawns a process with the --slave option. It writes two lines -# to the slaves stdin. The first contains a single boolean value - the -# value of ::TRACE to use in the slave script. The second line contains a +# to the slaves stdin. The first contains a single boolean value - the +# value of ::TRACE to use in the slave script. The second line contains a # list in the same format as each element of the list passed to the # [run_all_test_suites] command in the master process. # @@ -412,7 +412,7 @@ proc run_slave_test {} { # Read the test-suite configuration from stdin. set T [gets stdin] - foreach {title dir configOpts testtarget cflags opts} $T {} + foreach {title dir configOpts testtarget makeOpts cflags opts} $T {} # Create and switch to the test directory. trace_cmd file mkdir $dir @@ -430,7 +430,7 @@ proc run_slave_test {} { unset -nocomplain savedEnv(TCLSH_CMD) } set ::env(TCLSH_CMD) [file nativename [info nameofexecutable]] - set rc [catch [makeCommand $testtarget $cflags $opts]] + set rc [catch [makeCommand $testtarget $makeOpts $cflags $opts]] if {[info exists savedEnv(TCLSH_CMD)]} { set ::env(TCLSH_CMD) $savedEnv(TCLSH_CMD) } else { @@ -443,12 +443,12 @@ proc run_slave_test {} { exit $rc } -# This command is invoked in the master process each time a slave +# This command is invoked in the master process each time a slave # file-descriptor is readable. # proc slave_fileevent {fd T tm1} { global G - foreach {title dir configOpts testtarget cflags opts} $T {} + foreach {title dir configOpts testtarget makeOpts cflags opts} $T {} if {[eof $fd]} { fconfigure $fd -blocking 1 @@ -503,7 +503,7 @@ proc slave_fileevent {fd T tm1} { # * The first argument for [makeCommand] # * The second argument for [makeCommand] # * The third argument for [makeCommand] -# +# proc run_all_test_suites {alltests} { global G set tests $alltests @@ -518,7 +518,7 @@ proc run_all_test_suites {alltests} { if {[llength $tests]>0} { set T [lindex $tests 0] set tests [lrange $tests 1 end] - foreach {title dir configOpts testtarget cflags opts} $T {} + foreach {title dir configOpts testtarget makeOpts cflags opts} $T {} if {!$::TRACE} { set n [string length $title] PUTS "starting: ${title}" @@ -548,6 +548,7 @@ proc add_test_suite {listvar name testtarget config} { # CFLAGS. The makefile will pass OPTS to both gcc and lemon, but # CFLAGS is only passed to gcc. # + set makeOpts "" set cflags [expr {$::MSVC ? "-Zi" : "-g"}] set opts "" set title ${name}($testtarget) @@ -560,34 +561,70 @@ proc add_test_suite {listvar name testtarget config} { } elseif {[regexp {^[A-Z]+=} $arg]} { lappend testtarget $arg } elseif {[regexp {^--(enable|disable)-} $arg]} { + if {$::MSVC} { + if {$arg eq "--disable-amalgamation"} { + lappend makeOpts USE_AMALGAMATION=0 + continue + } + if {$arg eq "--disable-shared"} { + lappend makeOpts USE_CRT_DLL=0 DYNAMIC_SHELL=0 + continue + } + if {$arg eq "--enable-fts5"} { + lappend opts -DSQLITE_ENABLE_FTS5 + continue + } + if {$arg eq "--enable-json1"} { + lappend opts -DSQLITE_ENABLE_JSON1 + continue + } + } lappend configOpts $arg } else { + if {$::MSVC} { + if {$arg eq "-g"} { + lappend cflags -Zi + continue + } + if {[regexp -- {^-O(\d+)$} $arg all level]} then { + lappend makeOpts OPTIMIZATIONS=$level + continue + } + } lappend cflags $arg } } - set cflags [join $cflags " "] - set opts [join $opts " "] - append opts " -DSQLITE_NO_SYNC=1" + # Disable sync to make testing faster. + # + lappend opts -DSQLITE_NO_SYNC=1 # Some configurations already set HAVE_USLEEP; in that case, skip it. # - if {![regexp { -DHAVE_USLEEP$} $opts] - && ![regexp { -DHAVE_USLEEP[ =]+} $opts]} { - append opts " -DHAVE_USLEEP=1" + if {[lsearch -regexp $opts {^-DHAVE_USLEEP(?:=|$)}]==-1} { + lappend opts -DHAVE_USLEEP=1 + } + + # Add the define for this platform. + # + if {$::tcl_platform(platform)=="windows"} { + lappend opts -DSQLITE_OS_WIN=1 + } else { + lappend opts -DSQLITE_OS_UNIX=1 } # Set the sub-directory to use. # set dir [string tolower [string map {- _ " " _} $name]] - if {$::tcl_platform(platform)=="windows"} { - append opts " -DSQLITE_OS_WIN=1" - } else { - append opts " -DSQLITE_OS_UNIX=1" - } + # Join option lists into strings, using space as delimiter. + # + set makeOpts [join $makeOpts " "] + set cflags [join $cflags " "] + set opts [join $opts " "] - lappend alltests [list $title $dir $configOpts $testtarget $cflags $opts] + lappend alltests [list \ + $title $dir $configOpts $testtarget $makeOpts $cflags $opts] } # The following procedure returns the "configure" command to be exectued for @@ -607,15 +644,19 @@ proc configureCommand {opts} { # The following procedure returns the "make" command to be executed for the # specified targets, compiler flags, and options. # -proc makeCommand { targets cflags opts } { +proc makeCommand { targets makeOpts cflags opts } { set result [list trace_cmd exec] if {$::MSVC} { set nmakeDir [file nativename $::SRCDIR] set nmakeFile [file join $nmakeDir Makefile.msc] - lappend result nmake /f $nmakeFile TOP=$nmakeDir clean + lappend result nmake /f $nmakeFile TOP=$nmakeDir } else { - lappend result make clean + lappend result make } + foreach makeOpt $makeOpts { + lappend result $makeOpt + } + lappend result clean foreach target $targets { lappend result $target } @@ -733,11 +774,7 @@ proc process_options {argv} { } -g { - if {$::MSVC} { - lappend ::EXTRACONFIG -Zi - } else { - lappend ::EXTRACONFIG [lindex $argv $i] - } + lappend ::EXTRACONFIG [lindex $argv $i] } -with-tcl=* { From 98fea32c83da3ac962b9e74911537b91a9f85d30 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Tue, 3 Nov 2015 02:47:11 +0000 Subject: [PATCH 08/32] Use the native name for the MSVC makefile as well. FossilOrigin-Name: e457c615647a5bacb32d7d1d9ddfcfb0c7d56e82 --- manifest | 15 ++++++--------- manifest.uuid | 2 +- test/releasetest.tcl | 2 +- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index 0347e7e67c..b37dc4bb87 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Attempt\sto\scentralize\sand\ssimplify\sthe\sMSVC\shandling. -D 2015-11-02T23:29:58.179 +C Use\sthe\snative\sname\sfor\sthe\sMSVC\smakefile\sas\swell. +D 2015-11-03T02:47:11.042 F Makefile.in 4469ed8b02a9934fea9503d791165367d19db2f7 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 702d3e98f3afc6587a78481257f3c4c900efc3a4 @@ -948,7 +948,7 @@ F test/rbu.test 168573d353cd0fd10196b87b0caa322c144ef736 F test/rdonly.test 64e2696c322e3538df0b1ed624e21f9a23ed9ff8 F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.tcl 203d4ae4b5967f45aff3a702f5ceca0e374c2701 +F test/releasetest.tcl bad82f39a04a0167a4f66e8e08b17b23f204af47 F test/resolver01.test f4022acafda7f4d40eca94dbf16bc5fc4ac30ceb F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14 @@ -1397,10 +1397,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P f625bce8b7c2884a092c70675a9c6ce15c29937e -R eb29c38bdfc8b6dd27ad862c284260aa -T *branch * msvcRefactor -T *sym-msvcRefactor * -T -sym-mp-releasetest * +P 4ae96d6dde7fc0a913d7719ec498686f9a1e3b98 +R 14492f88a18ae330845ea78da3703df0 U mistachkin -Z b0a92943833683434e791bb83f5a4e2b +Z 0806ab004061ebe41f0631a896122666 diff --git a/manifest.uuid b/manifest.uuid index c1778b7e5c..40cad1b83f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4ae96d6dde7fc0a913d7719ec498686f9a1e3b98 \ No newline at end of file +e457c615647a5bacb32d7d1d9ddfcfb0c7d56e82 \ No newline at end of file diff --git a/test/releasetest.tcl b/test/releasetest.tcl index dea09a6ebe..a4d379b4d9 100644 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -648,7 +648,7 @@ proc makeCommand { targets makeOpts cflags opts } { set result [list trace_cmd exec] if {$::MSVC} { set nmakeDir [file nativename $::SRCDIR] - set nmakeFile [file join $nmakeDir Makefile.msc] + set nmakeFile [file nativename [file join $nmakeDir Makefile.msc]] lappend result nmake /f $nmakeFile TOP=$nmakeDir } else { lappend result make From 7d3bfa2713eddfd3816e695be24c9c7e7d638341 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Tue, 3 Nov 2015 06:23:33 +0000 Subject: [PATCH 09/32] Further enhancement and a bit of cleanup. FossilOrigin-Name: 0d8b59783e0a84bc59661b3469e1ca1b1fa90c71 --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/releasetest.tcl | 5 ++++- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index b37dc4bb87..7f5cecce2f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Use\sthe\snative\sname\sfor\sthe\sMSVC\smakefile\sas\swell. -D 2015-11-03T02:47:11.042 +C Further\senhancement\sand\sa\sbit\sof\scleanup. +D 2015-11-03T06:23:33.220 F Makefile.in 4469ed8b02a9934fea9503d791165367d19db2f7 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 702d3e98f3afc6587a78481257f3c4c900efc3a4 @@ -948,7 +948,7 @@ F test/rbu.test 168573d353cd0fd10196b87b0caa322c144ef736 F test/rdonly.test 64e2696c322e3538df0b1ed624e21f9a23ed9ff8 F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.tcl bad82f39a04a0167a4f66e8e08b17b23f204af47 +F test/releasetest.tcl c4f9bc9ef7e4b52b5b0f4a4dc304f048f9f67500 F test/resolver01.test f4022acafda7f4d40eca94dbf16bc5fc4ac30ceb F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14 @@ -1397,7 +1397,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 4ae96d6dde7fc0a913d7719ec498686f9a1e3b98 -R 14492f88a18ae330845ea78da3703df0 +P e457c615647a5bacb32d7d1d9ddfcfb0c7d56e82 +R 12eec2478f572b441249fa0b7ba8f658 U mistachkin -Z 0806ab004061ebe41f0631a896122666 +Z 3f7ea4357401426e1a05712401cf1f9e diff --git a/manifest.uuid b/manifest.uuid index 40cad1b83f..480a279558 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e457c615647a5bacb32d7d1d9ddfcfb0c7d56e82 \ No newline at end of file +0d8b59783e0a84bc59661b3469e1ca1b1fa90c71 \ No newline at end of file diff --git a/test/releasetest.tcl b/test/releasetest.tcl index a4d379b4d9..5f7afa5d38 100644 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -578,6 +578,10 @@ proc add_test_suite {listvar name testtarget config} { lappend opts -DSQLITE_ENABLE_JSON1 continue } + if {$arg eq "--enable-shared"} { + lappend makeOpts USE_CRT_DLL=1 DYNAMIC_SHELL=1 + continue + } } lappend configOpts $arg } else { @@ -690,7 +694,6 @@ proc process_options {argv} { set ::MSVC 0 set ::BUILDONLY 0 set ::DRYRUN 0 - set ::EXEC exec set ::TRACE 0 set ::JOBS 1 set ::WITHTCL {} From 4380ff88878553ddffa61ca2223c28b9342ab2d0 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 3 Nov 2015 15:16:21 +0000 Subject: [PATCH 10/32] In the releasetest.tcl script, show the --jobs object on the command-line summary. Report the time of each "starting:" event. Do not show errors on a --dryrun. FossilOrigin-Name: b75107778f67a4c4f33b1c003af87ca57e98ae4b --- manifest | 13 ++++++------- manifest.uuid | 2 +- test/releasetest.tcl | 11 +++++++++-- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index 82a203af51..762b5f2883 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Update\sthe\sreleasetest.tcl\sscript\sso\sthat\sit\scan\srun\smultiple\stests\sin\s\nparallel\sin\sseparate\sprocesses. -D 2015-11-03T14:49:35.919 +C In\sthe\sreleasetest.tcl\sscript,\sshow\sthe\s--jobs\sobject\son\sthe\scommand-line\nsummary.\s\sReport\sthe\stime\sof\seach\s"starting:"\sevent.\s\sDo\snot\sshow\serrors\non\sa\s--dryrun. +D 2015-11-03T15:16:21.165 F Makefile.in 4469ed8b02a9934fea9503d791165367d19db2f7 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 702d3e98f3afc6587a78481257f3c4c900efc3a4 @@ -948,7 +948,7 @@ F test/rbu.test 168573d353cd0fd10196b87b0caa322c144ef736 F test/rdonly.test 64e2696c322e3538df0b1ed624e21f9a23ed9ff8 F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.tcl c4f9bc9ef7e4b52b5b0f4a4dc304f048f9f67500 +F test/releasetest.tcl 4cf5fb9983413480e05e0533e7a40f58954505cd F test/resolver01.test f4022acafda7f4d40eca94dbf16bc5fc4ac30ceb F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14 @@ -1398,8 +1398,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 6d5ce3ede4c7038c19a77268a5a7b9d5650933c2 0d8b59783e0a84bc59661b3469e1ca1b1fa90c71 -R 8a201b5bd814ee8b7a884b9405d8d10a -T +closed 0d8b59783e0a84bc59661b3469e1ca1b1fa90c71 +P e3de82919d6f7ef5c2c5ab9a932a480604856950 +R bd695900d7b0bfbc98b9334b6c220c39 U drh -Z b983fd166efa43546f60974df0033637 +Z e07f937ec3d5a7dc20fe2cacd9cefec0 diff --git a/manifest.uuid b/manifest.uuid index c3c83660e8..8242fd1a38 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e3de82919d6f7ef5c2c5ab9a932a480604856950 \ No newline at end of file +b75107778f67a4c4f33b1c003af87ca57e98ae4b \ No newline at end of file diff --git a/test/releasetest.tcl b/test/releasetest.tcl index 5f7afa5d38..91732468d7 100644 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -33,6 +33,12 @@ Every test begins with a fresh run of the configure script at the top of the SQLite source tree. } +# Return a timestamp of the form HH:MM:SS +# +proc now {} { + return [clock format [clock seconds] -format %H:%M:%S] +} + # Omit comments (text between # and \n) in a long multi-line string. # proc strip_comments {in} { @@ -458,7 +464,7 @@ proc slave_fileevent {fd T tm1} { set logfile [file join $dir test.log] if {[file exists $logfile]} { count_tests_and_errors [file join $dir test.log] rc errmsg - } elseif {$rc==0} { + } elseif {$rc==0 && !$::DRYRUN} { set rc 1 set errmsg "no test.log file..." } @@ -521,7 +527,7 @@ proc run_all_test_suites {alltests} { foreach {title dir configOpts testtarget makeOpts cflags opts} $T {} if {!$::TRACE} { set n [string length $title] - PUTS "starting: ${title}" + PUTS "starting: ${title} at [now]" flush stdout } @@ -828,6 +834,7 @@ proc process_options {argv} { 1 {PUTS -nonewline " --quick"} 2 {PUTS -nonewline " --veryquick"} } + if {$::JOBS>1} {PUTS -nonewline " --jobs $::JOBS"} PUTS "" } From 7f8a93d72c45f7b5c5acbab58b1a9dc8d07c0399 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 3 Nov 2015 15:39:29 +0000 Subject: [PATCH 11/32] In the releasetest.tcl script, add the --progress option to cause the start of each subprocess to be shown. Otherwise, revert to the old-style display. Improvements to the handling of the --buildonly option. FossilOrigin-Name: d969792f34c484bd055c933b1c2c5a99eb88b61b --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/releasetest.tcl | 38 +++++++++++++++++++++++++------------- 3 files changed, 32 insertions(+), 20 deletions(-) diff --git a/manifest b/manifest index 762b5f2883..b81c424881 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C In\sthe\sreleasetest.tcl\sscript,\sshow\sthe\s--jobs\sobject\son\sthe\scommand-line\nsummary.\s\sReport\sthe\stime\sof\seach\s"starting:"\sevent.\s\sDo\snot\sshow\serrors\non\sa\s--dryrun. -D 2015-11-03T15:16:21.165 +C In\sthe\sreleasetest.tcl\sscript,\sadd\sthe\s--progress\soption\sto\scause\sthe\sstart\nof\seach\ssubprocess\sto\sbe\sshown.\s\sOtherwise,\srevert\sto\sthe\sold-style\sdisplay.\nImprovements\sto\sthe\shandling\sof\sthe\s--buildonly\soption. +D 2015-11-03T15:39:29.385 F Makefile.in 4469ed8b02a9934fea9503d791165367d19db2f7 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 702d3e98f3afc6587a78481257f3c4c900efc3a4 @@ -948,7 +948,7 @@ F test/rbu.test 168573d353cd0fd10196b87b0caa322c144ef736 F test/rdonly.test 64e2696c322e3538df0b1ed624e21f9a23ed9ff8 F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.tcl 4cf5fb9983413480e05e0533e7a40f58954505cd +F test/releasetest.tcl 91014659efa3b3d9befba19d9af8be6345d14af2 F test/resolver01.test f4022acafda7f4d40eca94dbf16bc5fc4ac30ceb F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14 @@ -1398,7 +1398,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P e3de82919d6f7ef5c2c5ab9a932a480604856950 -R bd695900d7b0bfbc98b9334b6c220c39 +P b75107778f67a4c4f33b1c003af87ca57e98ae4b +R d01059a665fe222624fe97f190817272 U drh -Z e07f937ec3d5a7dc20fe2cacd9cefec0 +Z 40892742cfa381a82150cc6e1d9e3183 diff --git a/manifest.uuid b/manifest.uuid index 8242fd1a38..6895ea02ea 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b75107778f67a4c4f33b1c003af87ca57e98ae4b \ No newline at end of file +d969792f34c484bd055c933b1c2c5a99eb88b61b \ No newline at end of file diff --git a/test/releasetest.tcl b/test/releasetest.tcl index 91732468d7..730ace6cf9 100644 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -20,6 +20,7 @@ optional) are: --info (Show diagnostic info) --with-tcl=DIR (Use TCL build at DIR) --jobs N (Use N processes - default 1) + --progress (Show progress messages) The default value for --srcdir is the parent of the directory holding this script. @@ -382,9 +383,8 @@ proc count_tests_and_errors {logfile rcVar errmsgVar} { } close $fd if {$::BUILDONLY} { - if {$rc==0} { - set errmsg "Build complete" - } else { + incr ::NTESTCASE + if {$rc!=0} { set errmsg "Build failed" } } elseif {!$seen} { @@ -484,7 +484,11 @@ proc slave_fileevent {fd T tm1} { } set n [string length $title] - PUTS "finished: ${title}[string repeat . [expr {53-$n}]] $status $tm" + if {$::PROGRESS_MSGS} { + PUTS "finished: ${title}[string repeat . [expr {53-$n}]] $status $tm" + } else { + PUTS "${title}[string repeat . [expr {63-$n}]] $status $tm" + } if {$errmsg!=""} {PUTS " $errmsg"} flush stdout } @@ -525,7 +529,7 @@ proc run_all_test_suites {alltests} { set T [lindex $tests 0] set tests [lrange $tests 1 end] foreach {title dir configOpts testtarget makeOpts cflags opts} $T {} - if {!$::TRACE} { + if {$::PROGRESS_MSGS && !$::TRACE} { set n [string length $title] PUTS "starting: ${title} at [now]" flush stdout @@ -696,13 +700,14 @@ proc trace_cmd {args} { # proc process_options {argv} { set ::SRCDIR [file normalize [file dirname [file dirname $::argv0]]] - set ::QUICK 0 - set ::MSVC 0 - set ::BUILDONLY 0 - set ::DRYRUN 0 - set ::TRACE 0 - set ::JOBS 1 - set ::WITHTCL {} + set ::QUICK 0 + set ::MSVC 0 + set ::BUILDONLY 0 + set ::DRYRUN 0 + set ::TRACE 0 + set ::JOBS 1 + set ::PROGRESS_MSGS 0 + set ::WITHTCL {} set config {} set platform $::tcl_platform(os)-$::tcl_platform(machine) @@ -730,6 +735,10 @@ proc process_options {argv} { set ::JOBS [lindex $argv $i] } + -progress { + set ::PROGRESS_MSGS 1 + } + -quick { set ::QUICK 1 } @@ -827,6 +836,7 @@ proc process_options {argv} { PUTS "Running the following test configurations for $platform:" PUTS " [string trim $::CONFIGLIST]" PUTS -nonewline "Flags:" + if {$::PROGRESS_MSGS} {PUTS -nonewline " --progress"} if {$::DRYRUN} {PUTS -nonewline " --dryrun"} if {$::BUILDONLY} {PUTS -nonewline " --buildonly"} if {$::MSVC} {PUTS -nonewline " --msvc"} @@ -866,7 +876,9 @@ proc main {argv} { } if {$::BUILDONLY} { set target testfixture - if {$::MSVC} {append target .exe} + if {$::tcl_platform(platform)=="windows"} { + append target .exe + } } } set config_options [concat $::Configs($zConfig) $::EXTRACONFIG] From e3b63599a3ace4b89ae690f2d4377173a5e68302 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Tue, 3 Nov 2015 19:13:57 +0000 Subject: [PATCH 12/32] In 'e_uri.test', make sure all created test database files get deleted. FossilOrigin-Name: 40c4f4a65ef3ebda96e0de8bd791ce5ccb8d3ef5 --- manifest | 14 +++++++------- manifest.uuid | 2 +- test/e_uri.test | 2 ++ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index b81c424881..7aefc15925 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C In\sthe\sreleasetest.tcl\sscript,\sadd\sthe\s--progress\soption\sto\scause\sthe\sstart\nof\seach\ssubprocess\sto\sbe\sshown.\s\sOtherwise,\srevert\sto\sthe\sold-style\sdisplay.\nImprovements\sto\sthe\shandling\sof\sthe\s--buildonly\soption. -D 2015-11-03T15:39:29.385 +C In\s'e_uri.test',\smake\ssure\sall\screated\stest\sdatabase\sfiles\sget\sdeleted. +D 2015-11-03T19:13:57.588 F Makefile.in 4469ed8b02a9934fea9503d791165367d19db2f7 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 702d3e98f3afc6587a78481257f3c4c900efc3a4 @@ -601,7 +601,7 @@ F test/e_select.test 52692ff3849541e828ad4661fe3773a9b8711763 F test/e_select2.test aceb80ab927d46fba5ce7586ebabf23e2bb0604f F test/e_totalchanges.test b12ee5809d3e63aeb83238dd501a7bca7fd72c10 F test/e_update.test f46c2554d915c9197548681e8d8c33a267e84528 -F test/e_uri.test 5ae33760fb2039c61aa2d90886f1664664173585 +F test/e_uri.test eed3eb41b22d051a1164110dacdc778899126e14 F test/e_vacuum.test 5bfbdc21b65c0abf24398d0ba31dc88d93ca77a9 F test/e_wal.test ae9a593207a77d711443ee69ffe081fda9243625 F test/e_walauto.test 280714ddf14e1a47dcbc59d515cd0b026dfd5567 @@ -1398,7 +1398,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P b75107778f67a4c4f33b1c003af87ca57e98ae4b -R d01059a665fe222624fe97f190817272 -U drh -Z 40892742cfa381a82150cc6e1d9e3183 +P d969792f34c484bd055c933b1c2c5a99eb88b61b +R bc8a3308fa5f3a98dc8f44513a86745d +U mistachkin +Z 1ea9d597c8201ae93c5c79757fbc7595 diff --git a/manifest.uuid b/manifest.uuid index 6895ea02ea..7fcc970ed2 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d969792f34c484bd055c933b1c2c5a99eb88b61b \ No newline at end of file +40c4f4a65ef3ebda96e0de8bd791ce5ccb8d3ef5 \ No newline at end of file diff --git a/test/e_uri.test b/test/e_uri.test index d1590e4108..7a7f2559ec 100644 --- a/test/e_uri.test +++ b/test/e_uri.test @@ -26,7 +26,9 @@ proc parse_uri {uri} { set DB [sqlite3_open_v2 $uri { SQLITE_OPEN_READWRITE SQLITE_OPEN_CREATE SQLITE_OPEN_WAL } tvfs] + set fileName [sqlite3_db_filename $DB main] sqlite3_close $DB + forcedelete $fileName tvfs delete tvfs2 delete From 25b0c4094f9c8cc82040f8cb3a8a3a6d86789f98 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 3 Nov 2015 23:39:47 +0000 Subject: [PATCH 13/32] Increase the fuzzcheck timeout when running valgrind. FossilOrigin-Name: a5816877bdc7fae69ed83d1fc95c29bf390eb641 --- Makefile.in | 2 +- main.mk | 2 +- manifest | 16 ++++++++-------- manifest.uuid | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Makefile.in b/Makefile.in index fe4dc197b9..1ad64aa617 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1068,7 +1068,7 @@ fastfuzztest: fuzzcheck$(TEXE) $(FUZZDATA) ./fuzzcheck$(TEXE) --limit-mem 100M $(FUZZDATA) valgrindfuzz: fuzzcheck$(TEXT) $(FUZZDATA) - valgrind ./fuzzcheck$(TEXE) --cell-size-check --limit-mem 10M $(FUZZDATA) + valgrind ./fuzzcheck$(TEXE) --cell-size-check --limit-mem 10M --timeout 600 $(FUZZDATA) # Minimal testing that runs in less than 3 minutes # diff --git a/main.mk b/main.mk index a3e78d05e8..41bcb1c7e4 100644 --- a/main.mk +++ b/main.mk @@ -755,7 +755,7 @@ fastfuzztest: fuzzcheck$(EXE) $(FUZZDATA) ./fuzzcheck$(EXE) --limit-mem 100M $(FUZZDATA) valgrindfuzz: fuzzcheck$(EXE) $(FUZZDATA) - valgrind ./fuzzcheck$(EXE) --cell-size-check --limit-mem 10M $(FUZZDATA) + valgrind ./fuzzcheck$(EXE) --cell-size-check --limit-mem 10M --timeout 600 $(FUZZDATA) # A very quick test using only testfixture and omitting all the slower # tests. Designed to run in under 3 minutes on a workstation. diff --git a/manifest b/manifest index 7aefc15925..1c24f3ff3e 100644 --- a/manifest +++ b/manifest @@ -1,6 +1,6 @@ -C In\s'e_uri.test',\smake\ssure\sall\screated\stest\sdatabase\sfiles\sget\sdeleted. -D 2015-11-03T19:13:57.588 -F Makefile.in 4469ed8b02a9934fea9503d791165367d19db2f7 +C Increase\sthe\sfuzzcheck\stimeout\swhen\srunning\svalgrind. +D 2015-11-03T23:39:47.015 +F Makefile.in 3a705bb4bd12e194212ddbdbf068310d17153cdb F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 702d3e98f3afc6587a78481257f3c4c900efc3a4 F README.md 8ecc12493ff9f820cdea6520a9016001cb2e59b7 @@ -263,7 +263,7 @@ F ext/userauth/userauth.c 5fa3bdb492f481bbc1709fc83c91ebd13460c69e F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8 F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60 -F main.mk 47b879ad92fe896895dcfc1bbec5c119ee2aa690 +F main.mk ac9746f24334056c85775dbe6b7279b84a6941d7 F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83 F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 @@ -1398,7 +1398,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P d969792f34c484bd055c933b1c2c5a99eb88b61b -R bc8a3308fa5f3a98dc8f44513a86745d -U mistachkin -Z 1ea9d597c8201ae93c5c79757fbc7595 +P 40c4f4a65ef3ebda96e0de8bd791ce5ccb8d3ef5 +R dd632703962c77fc9d32d441840c19bf +U drh +Z 79cbe3a5a3a0d948dfe73ee60b9c239b diff --git a/manifest.uuid b/manifest.uuid index 7fcc970ed2..10ecb73da7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -40c4f4a65ef3ebda96e0de8bd791ce5ccb8d3ef5 \ No newline at end of file +a5816877bdc7fae69ed83d1fc95c29bf390eb641 \ No newline at end of file From 85979cd818dcc69a0614ea337a4b820c2b0e96bf Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 4 Nov 2015 13:03:36 +0000 Subject: [PATCH 14/32] Exclude cffault.test and symlink.test from the (incompatible) inmemory_journal permutation. FossilOrigin-Name: 4f16e9686d827311d069ac5856771db23bd610ff --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/permutations.test | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 1c24f3ff3e..7e80c7f4e7 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Increase\sthe\sfuzzcheck\stimeout\swhen\srunning\svalgrind. -D 2015-11-03T23:39:47.015 +C Exclude\scffault.test\sand\ssymlink.test\sfrom\sthe\s(incompatible)\sinmemory_journal\npermutation. +D 2015-11-04T13:03:36.598 F Makefile.in 3a705bb4bd12e194212ddbdbf068310d17153cdb F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 702d3e98f3afc6587a78481257f3c4c900efc3a4 @@ -928,7 +928,7 @@ F test/parser1.test 222b5cbf3e2e659fec1bf7d723488c8b9c94f1d0 F test/pcache.test c8acbedd3b6fd0f9a7ca887a83b11d24a007972b F test/pcache2.test af7f3deb1a819f77a6d0d81534e97d1cf62cd442 F test/percentile.test 4243af26b8f3f4555abe166f723715a1f74c77ff -F test/permutations.test ac3b00c299250cc087d4a527b5c75a0f8aef4e54 +F test/permutations.test 0be620cfc7309d72b0608b3f1cbadef1034417fa F test/pragma.test a44253f911e7d50127d4a08f927f47c861a4c772 F test/pragma2.test b5e2ce4c892afceb308c6ae6163a9099b2a0d8d7 F test/pragma3.test 6f849ccffeee7e496d2f2b5e74152306c0b8757c @@ -1398,7 +1398,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 40c4f4a65ef3ebda96e0de8bd791ce5ccb8d3ef5 -R dd632703962c77fc9d32d441840c19bf +P a5816877bdc7fae69ed83d1fc95c29bf390eb641 +R 9a7c6a9d73205d2500ddbad7f0038867 U drh -Z 79cbe3a5a3a0d948dfe73ee60b9c239b +Z 02be6118e54bfa48669e3dd2b1b8b91c diff --git a/manifest.uuid b/manifest.uuid index 10ecb73da7..fff6df1f41 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a5816877bdc7fae69ed83d1fc95c29bf390eb641 \ No newline at end of file +4f16e9686d827311d069ac5856771db23bd610ff \ No newline at end of file diff --git a/test/permutations.test b/test/permutations.test index c01dc22c55..9396f2ce4b 100644 --- a/test/permutations.test +++ b/test/permutations.test @@ -707,7 +707,7 @@ test_suite "inmemory_journal" -description { pragma journal_mode = 'memory' } -files [test_set $::allquicktests -exclude { # Exclude all tests that simulate IO errors. - autovacuum_ioerr2.test incrvacuum_ioerr.test ioerr.test + autovacuum_ioerr2.test cffault.test incrvacuum_ioerr.test ioerr.test ioerr.test ioerr2.test ioerr3.test ioerr4.test ioerr5.test vacuum3.test incrblob_err.test diskfull.test backup_ioerr.test e_fts3.test fts3cov.test fts3malloc.test fts3rnd.test @@ -723,7 +723,7 @@ test_suite "inmemory_journal" -description { corrupt5.test corruptA.test pageropt.test # Exclude stmt.test, which expects sub-journals to use temporary files. - stmt.test + stmt.test symlink.test zerodamage.test From 71258abf0df8293549e31632dd95db79214f30f4 Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 4 Nov 2015 16:34:58 +0000 Subject: [PATCH 15/32] In releasetest.tcl, run larger test first if --jobs is greater than 1. Run smaller tests cases first if --jobs is 1. FossilOrigin-Name: 3fece5d02a8790701d8f0af18db4b4db33986369 --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/releasetest.tcl | 20 ++++++++++++++------ 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/manifest b/manifest index 7e80c7f4e7..60ea716369 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Exclude\scffault.test\sand\ssymlink.test\sfrom\sthe\s(incompatible)\sinmemory_journal\npermutation. -D 2015-11-04T13:03:36.598 +C In\sreleasetest.tcl,\srun\slarger\stest\sfirst\sif\s--jobs\sis\sgreater\sthan\s1.\s\sRun\nsmaller\stests\scases\sfirst\sif\s--jobs\sis\s1. +D 2015-11-04T16:34:58.015 F Makefile.in 3a705bb4bd12e194212ddbdbf068310d17153cdb F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 702d3e98f3afc6587a78481257f3c4c900efc3a4 @@ -948,7 +948,7 @@ F test/rbu.test 168573d353cd0fd10196b87b0caa322c144ef736 F test/rdonly.test 64e2696c322e3538df0b1ed624e21f9a23ed9ff8 F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.tcl 91014659efa3b3d9befba19d9af8be6345d14af2 +F test/releasetest.tcl c12c4122a7b2ddec16b5f8fb9163f7a008886005 F test/resolver01.test f4022acafda7f4d40eca94dbf16bc5fc4ac30ceb F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14 @@ -1398,7 +1398,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P a5816877bdc7fae69ed83d1fc95c29bf390eb641 -R 9a7c6a9d73205d2500ddbad7f0038867 +P 4f16e9686d827311d069ac5856771db23bd610ff +R 98f8295aa06282e70a39acdf3a942e7d U drh -Z 02be6118e54bfa48669e3dd2b1b8b91c +Z 5331364b3b6f9338e5229c347e8468cf diff --git a/manifest.uuid b/manifest.uuid index fff6df1f41..5e5c1f3a3b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4f16e9686d827311d069ac5856771db23bd610ff \ No newline at end of file +3fece5d02a8790701d8f0af18db4b4db33986369 \ No newline at end of file diff --git a/test/releasetest.tcl b/test/releasetest.tcl index 730ace6cf9..c2fbd0acb3 100644 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -231,6 +231,7 @@ array set ::Configs [strip_comments { array set ::Platforms [strip_comments { Linux-x86_64 { "Check-Symbols" checksymbols + "Fast-One" fuzztest "Debug-One" "mptest test" "Have-Not" test "Secure-Delete" test @@ -241,10 +242,9 @@ array set ::Platforms [strip_comments { "No-lookaside" test "Devkit" test "Sanitize" {QUICKTEST_OMIT=func4.test,nan.test test} - "Fast-One" fuzztest - "Valgrind" valgrindtest - "Default" "threadtest fulltest" "Device-One" fulltest + "Default" "threadtest fulltest" + "Valgrind" valgrindtest } Linux-i686 { "Devkit" test @@ -265,12 +265,12 @@ array set ::Platforms [strip_comments { "OS-X" "threadtest fulltest" } "Windows NT-intel" { - "Default" "mptest fulltestonly" "Have-Not" test + "Default" "mptest fulltestonly" } "Windows NT-amd64" { - "Default" "mptest fulltestonly" "Have-Not" test + "Default" "mptest fulltestonly" } # The Failure-Detection platform runs various tests that deliberately @@ -831,7 +831,15 @@ proc process_options {argv} { if {[llength $config]==1} {lappend config fulltest} set ::CONFIGLIST $config } else { - set ::CONFIGLIST $::Platforms($platform) + if {$::JOBS>1} { + set ::CONFIGLIST {} + foreach {target zConfig} [lreverse $::Platforms($platform)] { + append ::CONFIGLIST [format " %-25s %s\n" \ + [list $zConfig] [list $target]] + } + } else { + set ::CONFIGLIST $::Platforms($platform) + } } PUTS "Running the following test configurations for $platform:" PUTS " [string trim $::CONFIGLIST]" From 9584f58cc27111a22e79fcc358d93b9a2e51e258 Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 4 Nov 2015 20:22:37 +0000 Subject: [PATCH 16/32] Rename the sqlite3PagerAcquire() function to sqlite3PagerGet(). The former macro called sqlite3PagerGet() has been removed. FossilOrigin-Name: 708253be34084b89987efe955c34557516171a3a --- manifest | 24 ++++++++++++------------ manifest.uuid | 2 +- src/backup.c | 9 ++++----- src/btree.c | 12 ++++++------ src/btreeInt.h | 2 +- src/dbstat.c | 6 +++--- src/pager.c | 14 +++++++------- src/pager.h | 5 ++--- src/test2.c | 2 +- 9 files changed, 37 insertions(+), 39 deletions(-) diff --git a/manifest b/manifest index 60ea716369..9cd40fae02 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C In\sreleasetest.tcl,\srun\slarger\stest\sfirst\sif\s--jobs\sis\sgreater\sthan\s1.\s\sRun\nsmaller\stests\scases\sfirst\sif\s--jobs\sis\s1. -D 2015-11-04T16:34:58.015 +C Rename\sthe\ssqlite3PagerAcquire()\sfunction\sto\ssqlite3PagerGet().\s\sThe\sformer\nmacro\scalled\ssqlite3PagerGet()\shas\sbeen\sremoved. +D 2015-11-04T20:22:37.219 F Makefile.in 3a705bb4bd12e194212ddbdbf068310d17153cdb F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 702d3e98f3afc6587a78481257f3c4c900efc3a4 @@ -279,18 +279,18 @@ F src/alter.c 9d649e46c780166e416fb11dbd23f8d49aab8267 F src/analyze.c 4c308880cf53c558070cb8513bdff4ffb1a38a77 F src/attach.c e944d0052b577703b9b83aac1638452ff42a8395 F src/auth.c b56c78ebe40a2110fd361379f7e8162d23f92240 -F src/backup.c c3a9c4209439b806c44cf30daf466955727bf46c +F src/backup.c 2869a76c03eb393ee795416e2387005553df72bc F src/bitvec.c d1f21d7d91690747881f03940584f4cc548c9d3d F src/btmutex.c 45a968cc85afed9b5e6cf55bf1f42f8d18107f79 -F src/btree.c 77343aac89c50bb5e06cbca3ace8c057c14de57c +F src/btree.c 692ca3e69ade4e86844899dd5f85b2220daf3d76 F src/btree.h b512723e4f27d7ba16b4b985cdecdb82c0f6d0c0 -F src/btreeInt.h 8177c9ab90d772d6d2c6c517e05bed774b7c92c0 +F src/btreeInt.h 3ab435ed27adea54d040584b0bcc488ee7db1e38 F src/build.c ca574d33ffb1763cfd2979383f4d507095bfbe19 F src/callback.c 7b44ce59674338ad48b0e84e7b72f935ea4f68b0 F src/complete.c addcd8160b081131005d5bc2d34adf20c1c5c92f F src/ctime.c 509ef9c64d1321f42448f111da86400b1799218a F src/date.c fb1c99172017dcc8e237339132c91a21a0788584 -F src/dbstat.c e637e7a7ff40ef32132a418c6fdf1cfb63aa27c7 +F src/dbstat.c ffd63fc8ba7541476ced189b95e95d7f2bc63f78 F src/delete.c c4c6fb9da78b946fcba2a6aac5b24bc5c15e752a F src/expr.c 0080c0f12806eca91e75a23a121a68918e9da357 F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb @@ -327,8 +327,8 @@ F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa F src/os_unix.c cf72e06e15839ebe7121e01d3eebf256c039b0ca F src/os_win.c 1716291e5ec2dbfc5a1fe0b32182030f1f7d8acf F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca -F src/pager.c 9c1eec0d88133484b165fa0b5284a411c24b964c -F src/pager.h 1c4fa826c330040c5659a384446c7cc6e8e4200c +F src/pager.c ed5cff11793b6a4146582aabb29ed8613a6cf89e +F src/pager.h 7fc069c07f3120ee466ff3d48a9d376974ebffa7 F src/parse.y 11078cd8e3af00f030505b6a86a06a4536cfdeaa F src/pcache.c 24be750c79272e0ca7b6e007bc94999700f3e5ef F src/pcache.h 9968603796240cdf83da7e7bef76edf90619cea9 @@ -351,7 +351,7 @@ F src/status.c 70912d7be68e9e2dbc4010c93d344af61d4c59ba F src/table.c 51b46b2a62d1b3a959633d593b89bab5e2c9155e F src/tclsqlite.c d9439b6a910985b7fff43ba6756bcef00de22649 F src/test1.c 9ac5cbfe3c859ab7518edc5109a2959d6bf7b059 -F src/test2.c 577961fe48961b2f2e5c8b56ee50c3f459d3359d +F src/test2.c 5586f43fcd9a1be0830793cf9d354082c261b25b F src/test3.c a8887dabbbee3059af338f20d290084a63ed1b0f F src/test4.c d168f83cc78d02e8d35567bb5630e40dcd85ac1e F src/test5.c 5a34feec76d9b3a86aab30fd4f6cc9c48cbab4c1 @@ -1398,7 +1398,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 4f16e9686d827311d069ac5856771db23bd610ff -R 98f8295aa06282e70a39acdf3a942e7d +P 3fece5d02a8790701d8f0af18db4b4db33986369 +R ed171729fbc3a46f9021f6d576752c27 U drh -Z 5331364b3b6f9338e5229c347e8468cf +Z bcdee87febad0b65031e24eb55987e22 diff --git a/manifest.uuid b/manifest.uuid index 5e5c1f3a3b..0601045f98 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3fece5d02a8790701d8f0af18db4b4db33986369 \ No newline at end of file +708253be34084b89987efe955c34557516171a3a \ No newline at end of file diff --git a/src/backup.c b/src/backup.c index 69e3c52822..1c282242d7 100644 --- a/src/backup.c +++ b/src/backup.c @@ -293,7 +293,7 @@ static int backupOnePage( DbPage *pDestPg = 0; Pgno iDest = (Pgno)(iOff/nDestPgsz)+1; if( iDest==PENDING_BYTE_PAGE(p->pDest->pBt) ) continue; - if( SQLITE_OK==(rc = sqlite3PagerGet(pDestPager, iDest, &pDestPg)) + if( SQLITE_OK==(rc = sqlite3PagerGet(pDestPager, iDest, &pDestPg, 0)) && SQLITE_OK==(rc = sqlite3PagerWrite(pDestPg)) ){ const u8 *zIn = &zSrcData[iOff%nSrcPgsz]; @@ -419,8 +419,7 @@ int sqlite3_backup_step(sqlite3_backup *p, int nPage){ const Pgno iSrcPg = p->iNext; /* Source page number */ if( iSrcPg!=PENDING_BYTE_PAGE(p->pSrc->pBt) ){ DbPage *pSrcPg; /* Source page object */ - rc = sqlite3PagerAcquire(pSrcPager, iSrcPg, &pSrcPg, - PAGER_GET_READONLY); + rc = sqlite3PagerGet(pSrcPager, iSrcPg, &pSrcPg,PAGER_GET_READONLY); if( rc==SQLITE_OK ){ rc = backupOnePage(p, iSrcPg, sqlite3PagerGetData(pSrcPg), 0); sqlite3PagerUnref(pSrcPg); @@ -520,7 +519,7 @@ int sqlite3_backup_step(sqlite3_backup *p, int nPage){ for(iPg=nDestTruncate; rc==SQLITE_OK && iPg<=(Pgno)nDstPage; iPg++){ if( iPg!=PENDING_BYTE_PAGE(p->pDest->pBt) ){ DbPage *pPg; - rc = sqlite3PagerGet(pDestPager, iPg, &pPg); + rc = sqlite3PagerGet(pDestPager, iPg, &pPg, 0); if( rc==SQLITE_OK ){ rc = sqlite3PagerWrite(pPg); sqlite3PagerUnref(pPg); @@ -540,7 +539,7 @@ int sqlite3_backup_step(sqlite3_backup *p, int nPage){ ){ PgHdr *pSrcPg = 0; const Pgno iSrcPg = (Pgno)((iOff/pgszSrc)+1); - rc = sqlite3PagerGet(pSrcPager, iSrcPg, &pSrcPg); + rc = sqlite3PagerGet(pSrcPager, iSrcPg, &pSrcPg, 0); if( rc==SQLITE_OK ){ u8 *zData = sqlite3PagerGetData(pSrcPg); rc = sqlite3OsWrite(pFile, zData, pgszSrc, iOff); diff --git a/src/btree.c b/src/btree.c index 8d183efb31..1db2a77b64 100644 --- a/src/btree.c +++ b/src/btree.c @@ -931,7 +931,7 @@ static void ptrmapPut(BtShared *pBt, Pgno key, u8 eType, Pgno parent, int *pRC){ return; } iPtrmap = PTRMAP_PAGENO(pBt, key); - rc = sqlite3PagerGet(pBt->pPager, iPtrmap, &pDbPage); + rc = sqlite3PagerGet(pBt->pPager, iPtrmap, &pDbPage, 0); if( rc!=SQLITE_OK ){ *pRC = rc; return; @@ -974,7 +974,7 @@ static int ptrmapGet(BtShared *pBt, Pgno key, u8 *pEType, Pgno *pPgno){ assert( sqlite3_mutex_held(pBt->mutex) ); iPtrmap = PTRMAP_PAGENO(pBt, key); - rc = sqlite3PagerGet(pBt->pPager, iPtrmap, &pDbPage); + rc = sqlite3PagerGet(pBt->pPager, iPtrmap, &pDbPage, 0); if( rc!=0 ){ return rc; } @@ -1931,7 +1931,7 @@ static int btreeGetPage( assert( flags==0 || flags==PAGER_GET_NOCONTENT || flags==PAGER_GET_READONLY ); assert( sqlite3_mutex_held(pBt->mutex) ); - rc = sqlite3PagerAcquire(pBt->pPager, pgno, (DbPage**)&pDbPage, flags); + rc = sqlite3PagerGet(pBt->pPager, pgno, (DbPage**)&pDbPage, flags); if( rc ) return rc; *ppPage = btreePageFromDbPage(pDbPage, pgno, pBt); return SQLITE_OK; @@ -1996,7 +1996,7 @@ static int getAndInitPage( rc = SQLITE_CORRUPT_BKPT; goto getAndInitPage_error; } - rc = sqlite3PagerAcquire(pBt->pPager, pgno, (DbPage**)&pDbPage, bReadOnly); + rc = sqlite3PagerGet(pBt->pPager, pgno, (DbPage**)&pDbPage, bReadOnly); if( rc ){ goto getAndInitPage_error; } @@ -4593,7 +4593,7 @@ static int accessPayload( { DbPage *pDbPage; - rc = sqlite3PagerAcquire(pBt->pPager, nextPage, &pDbPage, + rc = sqlite3PagerGet(pBt->pPager, nextPage, &pDbPage, ((eOp&0x01)==0 ? PAGER_GET_READONLY : 0) ); if( rc==SQLITE_OK ){ @@ -8909,7 +8909,7 @@ static void checkList( break; } if( checkRef(pCheck, iPage) ) break; - if( sqlite3PagerGet(pCheck->pPager, (Pgno)iPage, &pOvflPage) ){ + if( sqlite3PagerGet(pCheck->pPager, (Pgno)iPage, &pOvflPage, 0) ){ checkAppendMsg(pCheck, "failed to get page %d", iPage); break; } diff --git a/src/btreeInt.h b/src/btreeInt.h index e52130cc39..e43ff1210a 100644 --- a/src/btreeInt.h +++ b/src/btreeInt.h @@ -517,7 +517,7 @@ struct BtCursor { int skipNext; /* Prev() is noop if negative. Next() is noop if positive. ** Error code if eState==CURSOR_FAULT */ u8 curFlags; /* zero or more BTCF_* flags defined below */ - u8 curPagerFlags; /* Flags to send to sqlite3PagerAcquire() */ + u8 curPagerFlags; /* Flags to send to sqlite3PagerGet() */ u8 eState; /* One of the CURSOR_XXX constants (see below) */ u8 hints; /* As configured by CursorSetHints() */ /* All fields above are zeroed when the cursor is allocated. See diff --git a/src/dbstat.c b/src/dbstat.c index f43b14881f..ae55d6b803 100644 --- a/src/dbstat.c +++ b/src/dbstat.c @@ -386,7 +386,7 @@ static int statDecodePage(Btree *pBt, StatPage *p){ int rc; u32 iPrev = pCell->aOvfl[j-1]; DbPage *pPg = 0; - rc = sqlite3PagerGet(sqlite3BtreePager(pBt), iPrev, &pPg); + rc = sqlite3PagerGet(sqlite3BtreePager(pBt), iPrev, &pPg, 0); if( rc!=SQLITE_OK ){ assert( pPg==0 ); return rc; @@ -454,7 +454,7 @@ statNextRestart: pCsr->isEof = 1; return sqlite3_reset(pCsr->pStmt); } - rc = sqlite3PagerGet(pPager, iRoot, &pCsr->aPage[0].pPg); + rc = sqlite3PagerGet(pPager, iRoot, &pCsr->aPage[0].pPg, 0); pCsr->aPage[0].iPgno = iRoot; pCsr->aPage[0].iCell = 0; pCsr->aPage[0].zPath = z = sqlite3_mprintf("/"); @@ -514,7 +514,7 @@ statNextRestart: }else{ p[1].iPgno = p->aCell[p->iCell].iChildPg; } - rc = sqlite3PagerGet(pPager, p[1].iPgno, &p[1].pPg); + rc = sqlite3PagerGet(pPager, p[1].iPgno, &p[1].pPg, 0); p[1].iCell = 0; p[1].zPath = z = sqlite3_mprintf("%s%.3x/", p->zPath, p->iCell); p->iCell++; diff --git a/src/pager.c b/src/pager.c index 314f792aa0..b537e9e931 100644 --- a/src/pager.c +++ b/src/pager.c @@ -2333,7 +2333,7 @@ static int pager_playback_one_page( assert( isSavepnt ); assert( (pPager->doNotSpill & SPILLFLAG_ROLLBACK)==0 ); pPager->doNotSpill |= SPILLFLAG_ROLLBACK; - rc = sqlite3PagerAcquire(pPager, pgno, &pPg, 1); + rc = sqlite3PagerGet(pPager, pgno, &pPg, 1); assert( (pPager->doNotSpill & SPILLFLAG_ROLLBACK)!=0 ); pPager->doNotSpill &= ~SPILLFLAG_ROLLBACK; if( rc!=SQLITE_OK ) return rc; @@ -4969,7 +4969,7 @@ static int hasHotJournal(Pager *pPager, int *pExists){ /* ** This function is called to obtain a shared lock on the database file. -** It is illegal to call sqlite3PagerAcquire() until after this function +** It is illegal to call sqlite3PagerGet() until after this function ** has been successfully called. If a shared-lock is already held when ** this function is called, it is a no-op. ** @@ -5272,7 +5272,7 @@ static void pagerUnlockIfUnused(Pager *pPager){ ** Since Lookup() never goes to disk, it never has to deal with locks ** or journal files. */ -int sqlite3PagerAcquire( +int sqlite3PagerGet( Pager *pPager, /* The pager open on the database file */ Pgno pgno, /* Page number to fetch */ DbPage **ppPage, /* Write a pointer to the page here */ @@ -5858,7 +5858,7 @@ static SQLITE_NOINLINE int pagerWriteLargeSector(PgHdr *pPg){ PgHdr *pPage; if( pg==pPg->pgno || !sqlite3BitvecTest(pPager->pInJournal, pg) ){ if( pg!=PAGER_MJ_PGNO(pPager) ){ - rc = sqlite3PagerGet(pPager, pg, &pPage); + rc = sqlite3PagerGet(pPager, pg, &pPage, 0); if( rc==SQLITE_OK ){ rc = pager_write(pPage); if( pPage->flags&PGHDR_NEED_SYNC ){ @@ -6018,7 +6018,7 @@ static int pager_incr_changecounter(Pager *pPager, int isDirectMode){ assert( !pPager->tempFile && isOpen(pPager->fd) ); /* Open page 1 of the file for writing. */ - rc = sqlite3PagerGet(pPager, 1, &pPgHdr); + rc = sqlite3PagerGet(pPager, 1, &pPgHdr, 0); assert( pPgHdr==0 || rc==SQLITE_OK ); /* If page one was fetched successfully, and this function is not @@ -6173,7 +6173,7 @@ int sqlite3PagerCommitPhaseOne( if( pList==0 ){ /* Must have at least one page for the WAL commit flag. ** Ticket [2d1a5c67dfc2363e44f29d9bbd57f] 2011-05-18 */ - rc = sqlite3PagerGet(pPager, 1, &pPageOne); + rc = sqlite3PagerGet(pPager, 1, &pPageOne, 0); pList = pPageOne; pList->pDirty = 0; } @@ -6878,7 +6878,7 @@ int sqlite3PagerMovepage(Pager *pPager, DbPage *pPg, Pgno pgno, int isCommit){ ** the journal file twice, but that is not a problem. */ PgHdr *pPgHdr; - rc = sqlite3PagerGet(pPager, needSyncPgno, &pPgHdr); + rc = sqlite3PagerGet(pPager, needSyncPgno, &pPgHdr, 0); if( rc!=SQLITE_OK ){ if( needSyncPgno<=pPager->dbOrigSize ){ assert( pPager->pTmpSpace!=0 ); diff --git a/src/pager.h b/src/pager.h index 8e0e942efe..9d541dede9 100644 --- a/src/pager.h +++ b/src/pager.h @@ -79,7 +79,7 @@ typedef struct PgHdr DbPage; #define PAGER_JOURNALMODE_WAL 5 /* Use write-ahead logging */ /* -** Flags that make up the mask passed to sqlite3PagerAcquire(). +** Flags that make up the mask passed to sqlite3PagerGet(). */ #define PAGER_GET_NOCONTENT 0x01 /* Do not load data from disk */ #define PAGER_GET_READONLY 0x02 /* Read-only page is acceptable */ @@ -135,8 +135,7 @@ sqlite3_backup **sqlite3PagerBackupPtr(Pager*); int sqlite3PagerFlush(Pager*); /* Functions used to obtain and release page references. */ -int sqlite3PagerAcquire(Pager *pPager, Pgno pgno, DbPage **ppPage, int clrFlag); -#define sqlite3PagerGet(A,B,C) sqlite3PagerAcquire(A,B,C,0) +int sqlite3PagerGet(Pager *pPager, Pgno pgno, DbPage **ppPage, int clrFlag); DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno); void sqlite3PagerRef(DbPage*); void sqlite3PagerUnref(DbPage*); diff --git a/src/test2.c b/src/test2.c index 7192ddfffb..d16ba5016a 100644 --- a/src/test2.c +++ b/src/test2.c @@ -322,7 +322,7 @@ static int page_get( if( Tcl_GetInt(interp, argv[2], &pgno) ) return TCL_ERROR; rc = sqlite3PagerSharedLock(pPager); if( rc==SQLITE_OK ){ - rc = sqlite3PagerGet(pPager, pgno, &pPage); + rc = sqlite3PagerGet(pPager, pgno, &pPage, 0); } if( rc!=SQLITE_OK ){ Tcl_AppendResult(interp, sqlite3ErrName(rc), 0); From 8dd1c25388ee0e683f5a2a1e3f35491d4ff09869 Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 4 Nov 2015 22:31:02 +0000 Subject: [PATCH 17/32] Performance improvements in the getAndInitPage() routine of btree.c. FossilOrigin-Name: 2aa50f6f2029e3c91a4cb91224df8ec1194f215e --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/btree.c | 22 +++++++++++++--------- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/manifest b/manifest index 9cd40fae02..5f18b6c079 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Rename\sthe\ssqlite3PagerAcquire()\sfunction\sto\ssqlite3PagerGet().\s\sThe\sformer\nmacro\scalled\ssqlite3PagerGet()\shas\sbeen\sremoved. -D 2015-11-04T20:22:37.219 +C Performance\simprovements\sin\sthe\sgetAndInitPage()\sroutine\sof\sbtree.c. +D 2015-11-04T22:31:02.432 F Makefile.in 3a705bb4bd12e194212ddbdbf068310d17153cdb F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 702d3e98f3afc6587a78481257f3c4c900efc3a4 @@ -282,7 +282,7 @@ F src/auth.c b56c78ebe40a2110fd361379f7e8162d23f92240 F src/backup.c 2869a76c03eb393ee795416e2387005553df72bc F src/bitvec.c d1f21d7d91690747881f03940584f4cc548c9d3d F src/btmutex.c 45a968cc85afed9b5e6cf55bf1f42f8d18107f79 -F src/btree.c 692ca3e69ade4e86844899dd5f85b2220daf3d76 +F src/btree.c 080c3cb5440261dac7e9a03c45a948553338e1de F src/btree.h b512723e4f27d7ba16b4b985cdecdb82c0f6d0c0 F src/btreeInt.h 3ab435ed27adea54d040584b0bcc488ee7db1e38 F src/build.c ca574d33ffb1763cfd2979383f4d507095bfbe19 @@ -1398,7 +1398,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 3fece5d02a8790701d8f0af18db4b4db33986369 -R ed171729fbc3a46f9021f6d576752c27 +P 708253be34084b89987efe955c34557516171a3a +R 95c8020c01e129a733cf3a0e93c349e0 U drh -Z bcdee87febad0b65031e24eb55987e22 +Z 87f3216156230480787028b4d8a81ee0 diff --git a/manifest.uuid b/manifest.uuid index 0601045f98..c998de4c97 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -708253be34084b89987efe955c34557516171a3a \ No newline at end of file +2aa50f6f2029e3c91a4cb91224df8ec1194f215e \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index 1db2a77b64..c29463e9de 100644 --- a/src/btree.c +++ b/src/btree.c @@ -1901,11 +1901,14 @@ static void zeroPage(MemPage *pPage, int flags){ */ static MemPage *btreePageFromDbPage(DbPage *pDbPage, Pgno pgno, BtShared *pBt){ MemPage *pPage = (MemPage*)sqlite3PagerGetExtra(pDbPage); - pPage->aData = sqlite3PagerGetData(pDbPage); - pPage->pDbPage = pDbPage; - pPage->pBt = pBt; - pPage->pgno = pgno; - pPage->hdrOffset = pgno==1 ? 100 : 0; + if( pgno!=pPage->pgno ){ + pPage->aData = sqlite3PagerGetData(pDbPage); + pPage->pDbPage = pDbPage; + pPage->pBt = pBt; + pPage->pgno = pgno; + pPage->hdrOffset = pgno==1 ? 100 : 0; + } + assert( pPage->aData==sqlite3PagerGetData(pDbPage) ); return pPage; } @@ -2000,20 +2003,21 @@ static int getAndInitPage( if( rc ){ goto getAndInitPage_error; } - *ppPage = btreePageFromDbPage(pDbPage, pgno, pBt); + *ppPage = (MemPage*)sqlite3PagerGetExtra(pDbPage); if( (*ppPage)->isInit==0 ){ + btreePageFromDbPage(pDbPage, pgno, pBt); rc = btreeInitPage(*ppPage); if( rc!=SQLITE_OK ){ releasePage(*ppPage); goto getAndInitPage_error; } } + assert( (*ppPage)->pgno==pgno ); + assert( (*ppPage)->aData==sqlite3PagerGetData(pDbPage) ); /* If obtaining a child page for a cursor, we must verify that the page is ** compatible with the root page. */ - if( pCur - && ((*ppPage)->nCell<1 || (*ppPage)->intKey!=pCur->curIntKey) - ){ + if( pCur && ((*ppPage)->nCell<1 || (*ppPage)->intKey!=pCur->curIntKey) ){ rc = SQLITE_CORRUPT_BKPT; releasePage(*ppPage); goto getAndInitPage_error; From 63225522f956b325861e17500ea2411ad9c304a7 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Thu, 5 Nov 2015 03:26:36 +0000 Subject: [PATCH 18/32] Remove #pragma that was used to work around an obsolete issue with MSVC 2012. FossilOrigin-Name: b9b22fae69000ca506656f9cf847e713c6304b75 --- manifest | 17 ++++++++++------- manifest.uuid | 2 +- src/btree.c | 6 ------ 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/manifest b/manifest index 5f18b6c079..b5edfbbad8 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Performance\simprovements\sin\sthe\sgetAndInitPage()\sroutine\sof\sbtree.c. -D 2015-11-04T22:31:02.432 +C Remove\s#pragma\sthat\swas\sused\sto\swork\saround\san\sobsolete\sissue\swith\sMSVC\s2012. +D 2015-11-05T03:26:36.026 F Makefile.in 3a705bb4bd12e194212ddbdbf068310d17153cdb F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 702d3e98f3afc6587a78481257f3c4c900efc3a4 @@ -282,7 +282,7 @@ F src/auth.c b56c78ebe40a2110fd361379f7e8162d23f92240 F src/backup.c 2869a76c03eb393ee795416e2387005553df72bc F src/bitvec.c d1f21d7d91690747881f03940584f4cc548c9d3d F src/btmutex.c 45a968cc85afed9b5e6cf55bf1f42f8d18107f79 -F src/btree.c 080c3cb5440261dac7e9a03c45a948553338e1de +F src/btree.c 233c1536927b12d820cb0a19c657c59837f9334f F src/btree.h b512723e4f27d7ba16b4b985cdecdb82c0f6d0c0 F src/btreeInt.h 3ab435ed27adea54d040584b0bcc488ee7db1e38 F src/build.c ca574d33ffb1763cfd2979383f4d507095bfbe19 @@ -1398,7 +1398,10 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 708253be34084b89987efe955c34557516171a3a -R 95c8020c01e129a733cf3a0e93c349e0 -U drh -Z 87f3216156230480787028b4d8a81ee0 +P 2aa50f6f2029e3c91a4cb91224df8ec1194f215e +R 8f915e54b493516d25c62a2e6e65196c +T *branch * reoptimizeArm +T *sym-reoptimizeArm * +T -sym-trunk * +U mistachkin +Z fcf933a8c4c4c19e441c1b9f4ebd2411 diff --git a/manifest.uuid b/manifest.uuid index c998de4c97..45d53db359 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2aa50f6f2029e3c91a4cb91224df8ec1194f215e \ No newline at end of file +b9b22fae69000ca506656f9cf847e713c6304b75 \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index c29463e9de..5488d2010e 100644 --- a/src/btree.c +++ b/src/btree.c @@ -6964,9 +6964,6 @@ static void copyNodeContent(MemPage *pFrom, MemPage *pTo, int *pRC){ ** If aOvflSpace is set to a null pointer, this function returns ** SQLITE_NOMEM. */ -#if defined(_MSC_VER) && _MSC_VER >= 1700 && defined(_M_ARM) -#pragma optimize("", off) -#endif static int balance_nonroot( MemPage *pParent, /* Parent page of siblings being balanced */ int iParentIdx, /* Index of "the page" in pParent */ @@ -7712,9 +7709,6 @@ balance_cleanup: return rc; } -#if defined(_MSC_VER) && _MSC_VER >= 1700 && defined(_M_ARM) -#pragma optimize("", on) -#endif /* From d82211db56f53b2ddf0e62904f3c691d24bd2afb Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 5 Nov 2015 18:09:16 +0000 Subject: [PATCH 19/32] Add the 'hashsize' configuration option to fts5, for configuring the amount of memory allocated to the in-memory hash table while writing. FossilOrigin-Name: 445480095e6877cce8220b1c095f334bbb04c1c3 --- ext/fts5/fts5Int.h | 1 + ext/fts5/fts5_config.c | 14 ++++++++++++++ ext/fts5/fts5_index.c | 7 ++++--- ext/fts5/test/fts5simple.test | 16 +++++++++++++++- ext/fts5/tool/loadfts5.tcl | 16 ++++++++++++++++ manifest | 23 +++++++++++------------ manifest.uuid | 2 +- 7 files changed, 62 insertions(+), 17 deletions(-) diff --git a/ext/fts5/fts5Int.h b/ext/fts5/fts5Int.h index 8626962067..83a71723ff 100644 --- a/ext/fts5/fts5Int.h +++ b/ext/fts5/fts5Int.h @@ -160,6 +160,7 @@ struct Fts5Config { int pgsz; /* Approximate page size used in %_data */ int nAutomerge; /* 'automerge' setting */ int nCrisisMerge; /* Maximum allowed segments per level */ + int nHashSize; /* Bytes of memory for in-memory hash */ char *zRank; /* Name of rank function */ char *zRankArgs; /* Arguments to rank function */ diff --git a/ext/fts5/fts5_config.c b/ext/fts5/fts5_config.c index 2d8f7ac1a7..b566526e0e 100644 --- a/ext/fts5/fts5_config.c +++ b/ext/fts5/fts5_config.c @@ -20,6 +20,7 @@ #define FTS5_DEFAULT_PAGE_SIZE 4050 #define FTS5_DEFAULT_AUTOMERGE 4 #define FTS5_DEFAULT_CRISISMERGE 16 +#define FTS5_DEFAULT_HASHSIZE (1024*1024) /* Maximum allowed page size */ #define FTS5_MAX_PAGE_SIZE (128*1024) @@ -767,6 +768,18 @@ int sqlite3Fts5ConfigSetValue( } } + else if( 0==sqlite3_stricmp(zKey, "hashsize") ){ + int nHashSize = -1; + if( SQLITE_INTEGER==sqlite3_value_numeric_type(pVal) ){ + nHashSize = sqlite3_value_int(pVal); + } + if( nHashSize<=0 ){ + *pbBadkey = 1; + }else{ + pConfig->nHashSize = nHashSize; + } + } + else if( 0==sqlite3_stricmp(zKey, "automerge") ){ int nAutomerge = -1; if( SQLITE_INTEGER==sqlite3_value_numeric_type(pVal) ){ @@ -827,6 +840,7 @@ int sqlite3Fts5ConfigLoad(Fts5Config *pConfig, int iCookie){ pConfig->pgsz = FTS5_DEFAULT_PAGE_SIZE; pConfig->nAutomerge = FTS5_DEFAULT_AUTOMERGE; pConfig->nCrisisMerge = FTS5_DEFAULT_CRISISMERGE; + pConfig->nHashSize = FTS5_DEFAULT_HASHSIZE; zSql = sqlite3Fts5Mprintf(&rc, zSelect, pConfig->zDb, pConfig->zName); if( zSql ){ diff --git a/ext/fts5/fts5_index.c b/ext/fts5/fts5_index.c index b3f4372965..a91af1304a 100644 --- a/ext/fts5/fts5_index.c +++ b/ext/fts5/fts5_index.c @@ -288,7 +288,6 @@ struct Fts5Index { ** in-memory hash tables before they are flushed to disk. */ Fts5Hash *pHash; /* Hash table for in-memory data */ - int nMaxPendingData; /* Max pending data before flush to disk */ int nPendingData; /* Current bytes of pending data */ i64 iWriteRowid; /* Rowid for current doc being written */ int bDelete; /* Current write is a delete */ @@ -4448,12 +4447,15 @@ int sqlite3Fts5IndexBeginWrite(Fts5Index *p, int bDelete, i64 iRowid){ /* Allocate the hash table if it has not already been allocated */ if( p->pHash==0 ){ p->rc = sqlite3Fts5HashNew(&p->pHash, &p->nPendingData); + + /* Force the configuration to be loaded */ + fts5StructureRelease(fts5StructureRead(p)); } /* Flush the hash table to disk if required */ if( iRowidiWriteRowid || (iRowid==p->iWriteRowid && p->bDelete==0) - || (p->nPendingData > p->nMaxPendingData) + || (p->nPendingData > p->pConfig->nHashSize) ){ fts5IndexFlush(p); } @@ -4519,7 +4521,6 @@ int sqlite3Fts5IndexOpen( if( rc==SQLITE_OK ){ p->pConfig = pConfig; p->nWorkUnit = FTS5_WORK_UNIT; - p->nMaxPendingData = 1024*1024; p->zDataTbl = sqlite3Fts5Mprintf(&rc, "%s_data", pConfig->zName); if( p->zDataTbl && bCreate ){ rc = sqlite3Fts5CreateTable( diff --git a/ext/fts5/test/fts5simple.test b/ext/fts5/test/fts5simple.test index 952464fc54..458d018c34 100644 --- a/ext/fts5/test/fts5simple.test +++ b/ext/fts5/test/fts5simple.test @@ -18,7 +18,7 @@ ifcapable !fts5 { finish_test return } - + #------------------------------------------------------------------------- # set doc "x x [string repeat {y } 50]z z" @@ -322,5 +322,19 @@ do_execsql_test 13.3 { INSERT INTO xy(xy) VALUES('integrity-check'); } +#------------------------------------------------------------------------- +# +do_execsql_test 14.1 { + CREATE VIRTUAL TABLE ttt USING fts5(x); + BEGIN; + INSERT INTO ttt(rowid, x) VALUES(1, 'a b c'); + INSERT INTO ttt(rowid, x) VALUES(2, 'a b c'); + INSERT INTO ttt(rowid, x) VALUES(3, 'a b c'); + COMMIT; +} +do_test 14.2 { + fts5_level_segs ttt +} {1} + finish_test diff --git a/ext/fts5/tool/loadfts5.tcl b/ext/fts5/tool/loadfts5.tcl index 4bf89d7817..8606930ae1 100644 --- a/ext/fts5/tool/loadfts5.tcl +++ b/ext/fts5/tool/loadfts5.tcl @@ -48,6 +48,7 @@ proc usage {} { puts stderr " -crisismerge N (set the crisismerge parameter to N)" puts stderr " -prefix PREFIX (comma separated prefix= argument)" puts stderr " -trans N (commit after N inserts - 0 == never)" + puts stderr " -hashsize N (set the fts5 hashsize parameteger to N)" exit 1 } @@ -59,6 +60,7 @@ set O(automerge) -1 set O(crisismerge) -1 set O(prefix) "" set O(trans) 0 +set O(hashsize) -1 if {[llength $argv]<2} usage set nOpt [expr {[llength $argv]-2}] @@ -106,6 +108,11 @@ for {set i 0} {$i < $nOpt} {incr i} { set O(prefix) [lindex $argv $i] } + -hashsize { + if { [incr i]>=$nOpt } usage + set O(hashsize) [lindex $argv $i] + } + default { usage } @@ -126,6 +133,14 @@ db eval BEGIN db eval "CREATE VIRTUAL TABLE t1 USING $O(vtab) (path, content$O(tok)$pref)" db eval "INSERT INTO t1(t1, rank) VALUES('pgsz', 4050);" } + + if {$O(hashsize)>=0} { + catch { + db eval "INSERT INTO t1(t1, rank) VALUES('hashsize', $O(hashsize));" + } + } + + if {$O(automerge)>=0} { if {$O(vtab) == "fts5"} { db eval { INSERT INTO t1(t1, rank) VALUES('automerge', $O(automerge)) } @@ -141,6 +156,7 @@ db eval BEGIN } load_hierachy [lindex $argv end] db eval COMMIT +puts "" diff --git a/manifest b/manifest index 0e492fc335..28f79199d9 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\sa\s#pragma\sused\sto\swork\saround\san\sissues\swith\sMSVC\s2012\sthat\shas\sbeen\novercome\sbut\ssubsequent\schanges. -D 2015-11-05T11:47:48.838 +C Add\sthe\s'hashsize'\sconfiguration\soption\sto\sfts5,\sfor\sconfiguring\sthe\samount\sof\smemory\sallocated\sto\sthe\sin-memory\shash\stable\swhile\swriting. +D 2015-11-05T18:09:16.776 F Makefile.in 3a705bb4bd12e194212ddbdbf068310d17153cdb F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 702d3e98f3afc6587a78481257f3c4c900efc3a4 @@ -103,13 +103,13 @@ F ext/fts3/unicode/mkunicode.tcl 95cf7ec186e48d4985e433ff8a1c89090a774252 F ext/fts3/unicode/parseunicode.tcl da577d1384810fb4e2b209bf3313074353193e95 F ext/fts5/extract_api_docs.tcl a36e54ec777172ddd3f9a88daf593b00848368e0 F ext/fts5/fts5.h 8b9a13b309b180e9fb88ea5666c0d8d73c6102d9 -F ext/fts5/fts5Int.h 06594fd3e5a3c74da6df9141e165975dc0ea6ef4 +F ext/fts5/fts5Int.h acf968e43d57b6b1caf7554d34ec35d6ed3b4fe8 F ext/fts5/fts5_aux.c 1f384972d606375b8fa078319f25ab4b5feb1b35 F ext/fts5/fts5_buffer.c 1e49512a535045e621246dc7f4f65f3593fa0fc2 -F ext/fts5/fts5_config.c 88a77f5d5e4dfbb2355b8f6cc9969b7f02d94685 +F ext/fts5/fts5_config.c 81ec07cb644e33df4cd58d46990016b2ce7c175c F ext/fts5/fts5_expr.c 28b15c9ae296204bc0a2e5cf7a667d840a9d2900 F ext/fts5/fts5_hash.c a9d4c1efebc2a91d26ad7ebdfcbf2678ceac405f -F ext/fts5/fts5_index.c 356481ce027cc2ede8e462c316b578260cda29d2 +F ext/fts5/fts5_index.c 967d797282e4595f8671d152ed8ecf6cc7e640b5 F ext/fts5/fts5_main.c 39358d3d8f0d6ea3757c40e0ddcbb6bc435604c3 F ext/fts5/fts5_storage.c 9ea3d92178743758b6c54d9fe8836bbbdcc92e3b F ext/fts5/fts5_tcl.c 3bf445e66de32137d4693694ff7b1fd6074e32bd @@ -174,7 +174,7 @@ F ext/fts5/test/fts5rank.test 11dcebba31d822f7e99685b4ea2c2ae3ec0b16f1 F ext/fts5/test/fts5rebuild.test 03935f617ace91ed23a6099c7c74d905227ff29b F ext/fts5/test/fts5restart.test c17728fdea26e7d0f617d22ad5b4b2862b994c17 F ext/fts5/test/fts5rowid.test 400384798349d658eaf06aefa1e364957d5d4821 -F ext/fts5/test/fts5simple.test 41333e267c6145efc3620342af53dfe65d5676b7 +F ext/fts5/test/fts5simple.test ec1c6a6f51890ba864f866387794878ff2994de9 F ext/fts5/test/fts5synonym.test cf88c0a56d5ea9591e3939ef1f6e294f7f2d0671 F ext/fts5/test/fts5tokenizer.test ea4df698b35cc427ebf2ba22829d0e28386d8c89 F ext/fts5/test/fts5unicode.test fbef8d8a3b4b88470536cc57604a82ca52e51841 @@ -184,7 +184,7 @@ F ext/fts5/test/fts5unindexed.test e9539d5b78c677315e7ed8ea911d4fd25437c680 F ext/fts5/test/fts5version.test 978f59541d8cef7e8591f8be2115ec5ccb863e2e F ext/fts5/test/fts5vocab.test c88a5554d0409494da95ba647bbdb4879b2624b0 F ext/fts5/tool/fts5txt2db.tcl c374c4c4797e8cdfadabdfaeeb5412dcd6686e84 -F ext/fts5/tool/loadfts5.tcl 58e90407cc5c2b1770460119488fd7c0090d4dd3 +F ext/fts5/tool/loadfts5.tcl 84d6f1b11096e984259765874dae7d119e3cfb54 F ext/fts5/tool/mkfts5c.tcl d1c2a9ab8e0ec690a52316f33dd9b1d379942f45 F ext/fts5/tool/showfts5.tcl d54da0e067306663e2d5d523965ca487698e722c F ext/icu/README.txt d9fbbad0c2f647c3fdf715fc9fd64af53aedfc43 @@ -1398,8 +1398,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 2aa50f6f2029e3c91a4cb91224df8ec1194f215e b9b22fae69000ca506656f9cf847e713c6304b75 -R 8f915e54b493516d25c62a2e6e65196c -T +closed b9b22fae69000ca506656f9cf847e713c6304b75 -U drh -Z 3e3a650cde9c3d0b9f2c0083b06276a0 +P 8303e4cfed715464c710668c2bdc58a8e3d4cd9f +R 430b0b0a24aaa42e32648f0a371f94b9 +U dan +Z 6707a1116c6926e8f57d8eea48f7af2a diff --git a/manifest.uuid b/manifest.uuid index 9634a10be7..d4f47b12be 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -8303e4cfed715464c710668c2bdc58a8e3d4cd9f \ No newline at end of file +445480095e6877cce8220b1c095f334bbb04c1c3 \ No newline at end of file From 70528d7868e67752833c6bac7b34f4d5d652d130 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 5 Nov 2015 20:25:09 +0000 Subject: [PATCH 20/32] The top of an index equality loop normally starts with OP_SeekGE and OP_IdxGT. This check-in adds a flag to OP_SeekGE such that it fails immediately if the key is not equal, then jumps over the OP_IdxGT, saving a call to the key comparison functions. Consider this check-in a proof-of-concept. It needs improvement before going on trunk. Some tests fail, but only because they new use fewer key comparisons than expected (which is a good thing!). FossilOrigin-Name: 32e31b9bc8664afcd326a1ff3892d86dc5202474 --- main.mk | 2 +- manifest | 25 ++++++++++++++----------- manifest.uuid | 2 +- src/sqliteInt.h | 7 ++++--- src/vdbe.c | 7 +++++++ src/vdbeaux.c | 3 +++ src/wherecode.c | 9 +++++++++ 7 files changed, 39 insertions(+), 16 deletions(-) diff --git a/main.mk b/main.mk index 41bcb1c7e4..c7eab81a21 100644 --- a/main.mk +++ b/main.mk @@ -582,7 +582,7 @@ tclsqlite.o: $(TOP)/src/tclsqlite.c $(HDR) opcodes.c: opcodes.h $(TOP)/tool/mkopcodec.tcl tclsh $(TOP)/tool/mkopcodec.tcl opcodes.h >opcodes.c -opcodes.h: parse.h $(TOP)/src/vdbe.c $(TOP)/tool/mkopcodeh.tcl +opcodes.h: parse.h $(TOP)/tool/mkopcodeh.tcl cat parse.h $(TOP)/src/vdbe.c | \ tclsh $(TOP)/tool/mkopcodeh.tcl >opcodes.h diff --git a/manifest b/manifest index 28f79199d9..77a185034b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\s'hashsize'\sconfiguration\soption\sto\sfts5,\sfor\sconfiguring\sthe\samount\sof\smemory\sallocated\sto\sthe\sin-memory\shash\stable\swhile\swriting. -D 2015-11-05T18:09:16.776 +C The\stop\sof\san\sindex\sequality\sloop\snormally\sstarts\swith\sOP_SeekGE\sand\sOP_IdxGT.\nThis\scheck-in\sadds\sa\sflag\sto\sOP_SeekGE\ssuch\sthat\sit\sfails\simmediately\sif\nthe\skey\sis\snot\sequal,\sthen\sjumps\sover\sthe\sOP_IdxGT,\ssaving\sa\scall\sto\sthe\skey\ncomparison\sfunctions.\s\sConsider\sthis\scheck-in\sa\sproof-of-concept.\s\sIt\sneeds\s\nimprovement\sbefore\sgoing\son\strunk.\s\sSome\stests\sfail,\sbut\sonly\sbecause\sthey\nnew\suse\sfewer\skey\scomparisons\sthan\sexpected\s(which\sis\sa\sgood\sthing!). +D 2015-11-05T20:25:09.480 F Makefile.in 3a705bb4bd12e194212ddbdbf068310d17153cdb F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 702d3e98f3afc6587a78481257f3c4c900efc3a4 @@ -263,7 +263,7 @@ F ext/userauth/userauth.c 5fa3bdb492f481bbc1709fc83c91ebd13460c69e F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8 F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60 -F main.mk ac9746f24334056c85775dbe6b7279b84a6941d7 +F main.mk 9bc37f24f513c077ca9f15879f9358abc1875483 F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83 F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 @@ -345,7 +345,7 @@ F src/shell.c d25df04168d6ba5a4fa05bdbf859df667f9eb621 F src/sqlite.h.in 3cfc86c55e57c63d86b9e1e92869e2bfb162ca8e F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad F src/sqlite3ext.h 4b66e3e3435da4b4c8c83696d0349f0c503b3924 -F src/sqliteInt.h b1e72ffe282c91ae30a2bf403319126dbaebd556 +F src/sqliteInt.h 8769e43c68421bdd6b4b830290965c9303056c4f F src/sqliteLimit.h 216557999cb45f2e3578ed53ebefe228d779cb46 F src/status.c 70912d7be68e9e2dbc4010c93d344af61d4c59ba F src/table.c 51b46b2a62d1b3a959633d593b89bab5e2c9155e @@ -403,11 +403,11 @@ F src/update.c 40e51cd0883cb5bfd6abb7d8a7cd8aa47fab2945 F src/utf.c fc6b889ba0779b7722634cdeaa25f1930d93820c F src/util.c fc612367108b74573c5fd13a85d0a23027f438bd F src/vacuum.c 2ddd5cad2a7b9cef7f9e431b8c7771634c6b1701 -F src/vdbe.c dfbaae2570172c523bce14299021d352b8508f7f +F src/vdbe.c 1f9ef1ef7e48e1d5268036a18b7c9b5cded49879 F src/vdbe.h efb7a8c1459e31f3ea4377824c6a7e4cb5068637 F src/vdbeInt.h 33403622c6a8feaaac5f0f3f17f5d1bf6df42286 F src/vdbeapi.c 020681b943e77766b32ae1cddf86d7831b7374ca -F src/vdbeaux.c 717bc2ae9cc0b58ef398fff44bd9164bfd96772a +F src/vdbeaux.c 229c12a66944ce2cb86c3d6c935601b13da820c8 F src/vdbeblob.c 565fabd302f5fca3bdf3d56cac330483616a39b6 F src/vdbemem.c fdd1578e47bea61390d472de53c565781d81e045 F src/vdbesort.c 8b23930a1289526f6d2a3a9f2e965bcc963e4a68 @@ -419,7 +419,7 @@ F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4 F src/walker.c 2e14d17f592d176b6dc879c33fbdec4fbccaa2ba F src/where.c 6aceb72cc58dc06922a9e1604d559c8ca4c3e728 F src/whereInt.h 7892bb54cf9ca0ae5c7e6094491b94c9286dc647 -F src/wherecode.c 4c96182e7b25e4be54008dee2da5b9c2f8480b9b +F src/wherecode.c b45fe3878b0ea4962784d3072498ff63b233d958 F src/whereexpr.c e63244ca06c503e5f3c5b7f3c9aea0db826089ed F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 F test/affinity2.test a6d901b436328bd67a79b41bb0ac2663918fe3bd @@ -1398,7 +1398,10 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 8303e4cfed715464c710668c2bdc58a8e3d4cd9f -R 430b0b0a24aaa42e32648f0a371f94b9 -U dan -Z 6707a1116c6926e8f57d8eea48f7af2a +P 445480095e6877cce8220b1c095f334bbb04c1c3 +R 05aade661a6de043d2b7f27fd40fb41a +T *branch * seekeq-experiment +T *sym-seekeq-experiment * +T -sym-trunk * +U drh +Z 34383bd81ccfcce5590ebe9ba011f808 diff --git a/manifest.uuid b/manifest.uuid index d4f47b12be..83ba86fca9 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -445480095e6877cce8220b1c095f334bbb04c1c3 \ No newline at end of file +32e31b9bc8664afcd326a1ff3892d86dc5202474 \ No newline at end of file diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 96f43070c7..b86de1b2bd 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -1830,12 +1830,13 @@ struct KeyInfo { */ struct UnpackedRecord { KeyInfo *pKeyInfo; /* Collation and sort-order information */ + Mem *aMem; /* Values */ u16 nField; /* Number of entries in apMem[] */ i8 default_rc; /* Comparison result if keys are equal */ u8 errCode; /* Error detected by xRecordCompare (CORRUPT or NOMEM) */ - Mem *aMem; /* Values */ - int r1; /* Value to return if (lhs > rhs) */ - int r2; /* Value to return if (rhs < lhs) */ + i8 r1; /* Value to return if (lhs > rhs) */ + i8 r2; /* Value to return if (rhs < lhs) */ + u8 eqSeen; /* True if an equality comparison has been seen */ }; diff --git a/src/vdbe.c b/src/vdbe.c index c5508a2b26..6a4729a696 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -3691,11 +3691,13 @@ case OP_SeekGT: { /* jump, in3 */ #ifdef SQLITE_DEBUG if( sqlite3BtreeCursorHasHint(pC->pCursor, BTREE_SEEK_EQ) ){ assert( pOp->opcode==OP_SeekGE || pOp->opcode==OP_SeekLE ); +#if 0 assert( pOp[1].opcode==OP_IdxLT || pOp[1].opcode==OP_IdxGT ); assert( pOp[1].p1==pOp[0].p1 ); assert( pOp[1].p2==pOp[0].p2 ); assert( pOp[1].p3==pOp[0].p3 ); assert( pOp[1].p4.i==pOp[0].p4.i ); +#endif } #endif @@ -3772,10 +3774,14 @@ case OP_SeekGT: { /* jump, in3 */ { int i; for(i=0; ipCursor, &r, 0, 0, &res); if( rc!=SQLITE_OK ){ goto abort_due_to_error; } + if( (pOp->p5 & OPFLAG_SEEKEQ)!=0 && r.eqSeen==0 ){ + goto take_the_jump; + } } pC->deferredMoveto = 0; pC->cacheStatus = CACHE_STALE; @@ -3803,6 +3809,7 @@ case OP_SeekGT: { /* jump, in3 */ res = sqlite3BtreeEof(pC->pCursor); } } +take_the_jump: assert( pOp->p2>0 ); VdbeBranchTaken(res!=0,2); if( res ){ diff --git a/src/vdbeaux.c b/src/vdbeaux.c index f605ea3ec8..8e53ef7de2 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -3969,6 +3969,7 @@ int sqlite3VdbeRecordCompareWithSkip( || vdbeRecordCompareDebug(nKey1, pKey1, pPKey2, pPKey2->default_rc) || pKeyInfo->db->mallocFailed ); + pPKey2->eqSeen = 1; return pPKey2->default_rc; } int sqlite3VdbeRecordCompare( @@ -4068,6 +4069,7 @@ static int vdbeRecordCompareInt( /* The first fields of the two keys are equal and there are no trailing ** fields. Return pPKey2->default_rc in this case. */ res = pPKey2->default_rc; + pPKey2->eqSeen = 1; } assert( vdbeRecordCompareDebug(nKey1, pKey1, pPKey2, res) ); @@ -4114,6 +4116,7 @@ static int vdbeRecordCompareString( res = sqlite3VdbeRecordCompareWithSkip(nKey1, pKey1, pPKey2, 1); }else{ res = pPKey2->default_rc; + pPKey2->eqSeen = 1; } }else if( res>0 ){ res = pPKey2->r2; diff --git a/src/wherecode.c b/src/wherecode.c index 87db0e0a25..644c1aa0a2 100644 --- a/src/wherecode.c +++ b/src/wherecode.c @@ -1026,6 +1026,7 @@ Bitmask sqlite3WhereCodeOneLoopStart( WhereTerm *pRangeEnd = 0; /* Inequality constraint at range end */ int startEq; /* True if range start uses ==, >= or <= */ int endEq; /* True if range end uses ==, >= or <= */ + int eqOnly; /* True if uses only == */ int start_constraints; /* Start of range is constrained */ int nConstraint; /* Number of constraint terms */ Index *pIdx; /* The index we will be using */ @@ -1095,6 +1096,8 @@ Bitmask sqlite3WhereCodeOneLoopStart( } } assert( pRangeEnd==0 || (pRangeEnd->wtFlags & TERM_VNULL)==0 ); + eqOnly = nEq>0 && (pLoop->wsFlags & WHERE_COLUMN_RANGE)==0 + && (pWInfo->wctrlFlags&WHERE_ORDERBY_MIN)==0; /* If we are doing a reverse order scan on an ascending index, or ** a forward order scan on a descending index, interchange the @@ -1167,6 +1170,7 @@ Bitmask sqlite3WhereCodeOneLoopStart( VdbeCoverageIf(v, op==OP_SeekGE); testcase( op==OP_SeekGE ); VdbeCoverageIf(v, op==OP_SeekLE); testcase( op==OP_SeekLE ); VdbeCoverageIf(v, op==OP_SeekLT); testcase( op==OP_SeekLT ); + if( eqOnly ) sqlite3VdbeChangeP5(v, OPFLAG_SEEKEQ); /* Load the value for the inequality constraint at the end of the ** range (if any). @@ -1202,6 +1206,11 @@ Bitmask sqlite3WhereCodeOneLoopStart( /* Check if the index cursor is past the end of the range. */ if( nConstraint ){ + if( eqOnly ){ + int bx = sqlite3VdbeCurrentAddr(v); + sqlite3VdbeAddOp2(v, OP_Goto, 0, bx+2); + pLevel->p2 = bx+1; + } op = aEndOp[bRev*2 + endEq]; sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint); testcase( op==OP_IdxGT ); VdbeCoverageIf(v, op==OP_IdxGT ); From 9030d0ac28066728dd77d5705bb0ff2ae5a10ffb Mon Sep 17 00:00:00 2001 From: mistachkin Date: Thu, 5 Nov 2015 21:49:19 +0000 Subject: [PATCH 21/32] Fix typo in help information for an FTS5 script. FossilOrigin-Name: 777ae8007f6ff303b120b25f2dc37d7ef6b6a4f8 --- ext/fts5/tool/loadfts5.tcl | 2 +- manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ext/fts5/tool/loadfts5.tcl b/ext/fts5/tool/loadfts5.tcl index 8606930ae1..4a5aa37250 100644 --- a/ext/fts5/tool/loadfts5.tcl +++ b/ext/fts5/tool/loadfts5.tcl @@ -48,7 +48,7 @@ proc usage {} { puts stderr " -crisismerge N (set the crisismerge parameter to N)" puts stderr " -prefix PREFIX (comma separated prefix= argument)" puts stderr " -trans N (commit after N inserts - 0 == never)" - puts stderr " -hashsize N (set the fts5 hashsize parameteger to N)" + puts stderr " -hashsize N (set the fts5 hashsize parameter to N)" exit 1 } diff --git a/manifest b/manifest index 28f79199d9..daf44cfd73 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\s'hashsize'\sconfiguration\soption\sto\sfts5,\sfor\sconfiguring\sthe\samount\sof\smemory\sallocated\sto\sthe\sin-memory\shash\stable\swhile\swriting. -D 2015-11-05T18:09:16.776 +C Fix\stypo\sin\shelp\sinformation\sfor\san\sFTS5\sscript. +D 2015-11-05T21:49:19.879 F Makefile.in 3a705bb4bd12e194212ddbdbf068310d17153cdb F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 702d3e98f3afc6587a78481257f3c4c900efc3a4 @@ -184,7 +184,7 @@ F ext/fts5/test/fts5unindexed.test e9539d5b78c677315e7ed8ea911d4fd25437c680 F ext/fts5/test/fts5version.test 978f59541d8cef7e8591f8be2115ec5ccb863e2e F ext/fts5/test/fts5vocab.test c88a5554d0409494da95ba647bbdb4879b2624b0 F ext/fts5/tool/fts5txt2db.tcl c374c4c4797e8cdfadabdfaeeb5412dcd6686e84 -F ext/fts5/tool/loadfts5.tcl 84d6f1b11096e984259765874dae7d119e3cfb54 +F ext/fts5/tool/loadfts5.tcl 4cc2d6af43b58d4fac05bc4fdabd0e5862c3b2c1 F ext/fts5/tool/mkfts5c.tcl d1c2a9ab8e0ec690a52316f33dd9b1d379942f45 F ext/fts5/tool/showfts5.tcl d54da0e067306663e2d5d523965ca487698e722c F ext/icu/README.txt d9fbbad0c2f647c3fdf715fc9fd64af53aedfc43 @@ -1398,7 +1398,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 8303e4cfed715464c710668c2bdc58a8e3d4cd9f -R 430b0b0a24aaa42e32648f0a371f94b9 -U dan -Z 6707a1116c6926e8f57d8eea48f7af2a +P 445480095e6877cce8220b1c095f334bbb04c1c3 +R 68d01af6e20ce1ec369a81a5012243d6 +U mistachkin +Z 34f3b0f0379f36a413653d60c651c6ba diff --git a/manifest.uuid b/manifest.uuid index d4f47b12be..1f1b6d3fb2 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -445480095e6877cce8220b1c095f334bbb04c1c3 \ No newline at end of file +777ae8007f6ff303b120b25f2dc37d7ef6b6a4f8 \ No newline at end of file From b1d607de25eae569ccdf6b56f5b648124bc4def3 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 5 Nov 2015 22:30:54 +0000 Subject: [PATCH 22/32] Improvements and simplifications to the equality seek logic. Tests are adjusted so that they all pass now. FossilOrigin-Name: 997ce6c90b454c03cc2ef6934752ee8dd2e520e3 --- manifest | 29 +++++++++++++---------------- manifest.uuid | 2 +- src/btree.c | 4 ++-- src/btree.h | 2 -- src/sqliteInt.h | 32 +++++++++++++++++++++++++------- src/vdbe.c | 43 ++++++++++++++++++++++++++++++------------- src/wherecode.c | 9 --------- test/collate4.test | 8 ++++---- test/where.test | 16 ++++++++-------- test/where4.test | 2 +- 10 files changed, 84 insertions(+), 63 deletions(-) diff --git a/manifest b/manifest index 77a185034b..f7386a922e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C The\stop\sof\san\sindex\sequality\sloop\snormally\sstarts\swith\sOP_SeekGE\sand\sOP_IdxGT.\nThis\scheck-in\sadds\sa\sflag\sto\sOP_SeekGE\ssuch\sthat\sit\sfails\simmediately\sif\nthe\skey\sis\snot\sequal,\sthen\sjumps\sover\sthe\sOP_IdxGT,\ssaving\sa\scall\sto\sthe\skey\ncomparison\sfunctions.\s\sConsider\sthis\scheck-in\sa\sproof-of-concept.\s\sIt\sneeds\s\nimprovement\sbefore\sgoing\son\strunk.\s\sSome\stests\sfail,\sbut\sonly\sbecause\sthey\nnew\suse\sfewer\skey\scomparisons\sthan\sexpected\s(which\sis\sa\sgood\sthing!). -D 2015-11-05T20:25:09.480 +C Improvements\sand\ssimplifications\sto\sthe\sequality\sseek\slogic.\s\sTests\sare\nadjusted\sso\sthat\sthey\sall\spass\snow. +D 2015-11-05T22:30:54.990 F Makefile.in 3a705bb4bd12e194212ddbdbf068310d17153cdb F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 702d3e98f3afc6587a78481257f3c4c900efc3a4 @@ -282,8 +282,8 @@ F src/auth.c b56c78ebe40a2110fd361379f7e8162d23f92240 F src/backup.c 2869a76c03eb393ee795416e2387005553df72bc F src/bitvec.c d1f21d7d91690747881f03940584f4cc548c9d3d F src/btmutex.c 45a968cc85afed9b5e6cf55bf1f42f8d18107f79 -F src/btree.c 233c1536927b12d820cb0a19c657c59837f9334f -F src/btree.h b512723e4f27d7ba16b4b985cdecdb82c0f6d0c0 +F src/btree.c 9e5d713bf54be8bfcae9b60210173dd53570f56d +F src/btree.h 1b8bf2818b5e256c25a5e09126720113b1d783da F src/btreeInt.h 3ab435ed27adea54d040584b0bcc488ee7db1e38 F src/build.c ca574d33ffb1763cfd2979383f4d507095bfbe19 F src/callback.c 7b44ce59674338ad48b0e84e7b72f935ea4f68b0 @@ -345,7 +345,7 @@ F src/shell.c d25df04168d6ba5a4fa05bdbf859df667f9eb621 F src/sqlite.h.in 3cfc86c55e57c63d86b9e1e92869e2bfb162ca8e F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad F src/sqlite3ext.h 4b66e3e3435da4b4c8c83696d0349f0c503b3924 -F src/sqliteInt.h 8769e43c68421bdd6b4b830290965c9303056c4f +F src/sqliteInt.h 12ff325b433c4ded39995b74b01b78aacc19805a F src/sqliteLimit.h 216557999cb45f2e3578ed53ebefe228d779cb46 F src/status.c 70912d7be68e9e2dbc4010c93d344af61d4c59ba F src/table.c 51b46b2a62d1b3a959633d593b89bab5e2c9155e @@ -403,7 +403,7 @@ F src/update.c 40e51cd0883cb5bfd6abb7d8a7cd8aa47fab2945 F src/utf.c fc6b889ba0779b7722634cdeaa25f1930d93820c F src/util.c fc612367108b74573c5fd13a85d0a23027f438bd F src/vacuum.c 2ddd5cad2a7b9cef7f9e431b8c7771634c6b1701 -F src/vdbe.c 1f9ef1ef7e48e1d5268036a18b7c9b5cded49879 +F src/vdbe.c a9b0ec9f8df86a805d593b625d1f21a8e71dcda5 F src/vdbe.h efb7a8c1459e31f3ea4377824c6a7e4cb5068637 F src/vdbeInt.h 33403622c6a8feaaac5f0f3f17f5d1bf6df42286 F src/vdbeapi.c 020681b943e77766b32ae1cddf86d7831b7374ca @@ -419,7 +419,7 @@ F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4 F src/walker.c 2e14d17f592d176b6dc879c33fbdec4fbccaa2ba F src/where.c 6aceb72cc58dc06922a9e1604d559c8ca4c3e728 F src/whereInt.h 7892bb54cf9ca0ae5c7e6094491b94c9286dc647 -F src/wherecode.c b45fe3878b0ea4962784d3072498ff63b233d958 +F src/wherecode.c 4c96182e7b25e4be54008dee2da5b9c2f8480b9b F src/whereexpr.c e63244ca06c503e5f3c5b7f3c9aea0db826089ed F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 F test/affinity2.test a6d901b436328bd67a79b41bb0ac2663918fe3bd @@ -519,7 +519,7 @@ F test/coalesce.test cee0dccb9fbd2d494b77234bccf9dc6c6786eb91 F test/collate1.test 08c18e7512a5a32c97938854263fa15362eeb846 F test/collate2.test 9aaa410a00734e48bcb27f3872617d6f69b2a621 F test/collate3.test 89defc49983ddfbf0a0555aca8c0521a676f56a5 -F test/collate4.test f04d5168685f2eef637ecfa2d4ddf8ec0d600177 +F test/collate4.test c953715fb498b87163e3e73dd94356bff1f317bd F test/collate5.test 65d928034d30d2d263a80f6359f7549ee1598ec6 F test/collate6.test 8be65a182abaac8011a622131486dafb8076e907 F test/collate7.test 8ec29d98f3ee4ccebce6e16ce3863fb6b8c7b868 @@ -1301,10 +1301,10 @@ F test/walro.test 34422d1d95aaff0388f0791ec20edb34e2a3ed57 F test/walshared.test 0befc811dcf0b287efae21612304d15576e35417 F test/walslow.test e7be6d9888f83aa5d3d3c7c08aa9b5c28b93609a F test/walthread.test de8dbaf6d9e41481c460ba31ca61e163d7348f8e -F test/where.test 66d4c107e82dfe86c01a96277b77e7a8809aff0b +F test/where.test 9902a3d84e9bc80357a2c54ed0e76c0d6d04a867 F test/where2.test af78c55589cbc82d793449493adba0dc3d659f23 F test/where3.test 1ad55ba900bd7747f98b6082e65bd3e442c5004e -F test/where4.test 44f506bf1737cf0fa4fc795e340208250f1fcd89 +F test/where4.test 4a371bfcc607f41d233701bdec33ac2972908ba8 F test/where5.test fdf66f96d29a064b63eb543e28da4dfdccd81ad2 F test/where6.test 5da5a98cec820d488e82708301b96cb8c18a258b F test/where7.test 5a4b0abc207d71da4deecd734ad8579e8dd40aa8 @@ -1398,10 +1398,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 445480095e6877cce8220b1c095f334bbb04c1c3 -R 05aade661a6de043d2b7f27fd40fb41a -T *branch * seekeq-experiment -T *sym-seekeq-experiment * -T -sym-trunk * +P 32e31b9bc8664afcd326a1ff3892d86dc5202474 +R 39eaab676629cc3889ae2b19a383806f U drh -Z 34383bd81ccfcce5590ebe9ba011f808 +Z 569a968eaa17fd575e8f13c4e6f1f518 diff --git a/manifest.uuid b/manifest.uuid index 83ba86fca9..bc5f548b56 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -32e31b9bc8664afcd326a1ff3892d86dc5202474 \ No newline at end of file +997ce6c90b454c03cc2ef6934752ee8dd2e520e3 \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index 5488d2010e..a61a6edf2f 100644 --- a/src/btree.c +++ b/src/btree.c @@ -5041,6 +5041,8 @@ int sqlite3BtreeLast(BtCursor *pCur, int *pRes){ ** *pRes>0 The cursor is left pointing at an entry that ** is larger than intKey/pIdxKey. ** +** For index tables, the pIdxKey->eqSeen field is set to 1 if there +** exists an entry in the table that exactly matches pIdxKey. */ int sqlite3BtreeMovetoUnpacked( BtCursor *pCur, /* The cursor to be moved */ @@ -9644,7 +9646,6 @@ int sqlite3BtreeSetVersion(Btree *pBtree, int iVersion){ return rc; } -#ifdef SQLITE_DEBUG /* ** Return true if the cursor has a hint specified. This routine is ** only used from within assert() statements @@ -9652,7 +9653,6 @@ int sqlite3BtreeSetVersion(Btree *pBtree, int iVersion){ int sqlite3BtreeCursorHasHint(BtCursor *pCsr, unsigned int mask){ return (pCsr->hints & mask)!=0; } -#endif /* ** Return true if the given Btree is read-only. diff --git a/src/btree.h b/src/btree.h index f37ec5e7fc..0c15a59c11 100644 --- a/src/btree.h +++ b/src/btree.h @@ -257,9 +257,7 @@ int sqlite3BtreePutData(BtCursor*, u32 offset, u32 amt, void*); void sqlite3BtreeIncrblobCursor(BtCursor *); void sqlite3BtreeClearCursor(BtCursor *); int sqlite3BtreeSetVersion(Btree *pBt, int iVersion); -#ifdef SQLITE_DEBUG int sqlite3BtreeCursorHasHint(BtCursor*, unsigned int mask); -#endif int sqlite3BtreeIsReadonly(Btree *pBt); int sqlite3HeaderSizeBtree(void); diff --git a/src/sqliteInt.h b/src/sqliteInt.h index b86de1b2bd..2b9ece78e2 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -1812,9 +1812,8 @@ struct KeyInfo { }; /* -** An instance of the following structure holds information about a -** single index record that has already been parsed out into individual -** values. +** This object holds a record which has been parsed out into individual +** fields, for the purposes of doing a comparison. ** ** A record is an object that contains one or more fields of data. ** Records are used to store the content of a table row and to store @@ -1822,11 +1821,30 @@ struct KeyInfo { ** the OP_MakeRecord opcode of the VDBE and is disassembled by the ** OP_Column opcode. ** -** This structure holds a record that has already been disassembled -** into its constituent fields. +** An instance of this object serves as a "key" for doing a search on +** an index b+tree. The goal of the search is to find the entry that +** is closed to the key described by this object. This object might hold +** just a prefix of the key. The number of fields is given by +** pKeyInfo->nField. ** -** The r1 and r2 member variables are only used by the optimized comparison -** functions vdbeRecordCompareInt() and vdbeRecordCompareString(). +** The r1 and r2 fields are the values to return if this key is less than +** or greater than a key in the btree, respectively. These are normally +** -1 and +1 respectively, but might be inverted to +1 and -1 if the b-tree +** is in DESC order. +** +** The key comparison functions actually return default_rc when they find +** an equals comparison. default_rc can be -1, 0, or +1. If there are +** multiple entries in the b-tree with the same key (when only looking +** at the first pKeyInfo->nFields,) then default_rc can be set to -1 to +** cause the search to find the last match, or +1 to cause the search to +** find the first match. +** +** The key comparison functions will set eqSeen to true if they ever +** get and equal results when comparing this structure to a b-tree record. +** When default_rc!=0, the search might end up on the record immediately +** before the first match or immediately after the last match. The +** eqSeen field will indicate whether or not an exact match exists in the +** b-tree. */ struct UnpackedRecord { KeyInfo *pKeyInfo; /* Collation and sort-order information */ diff --git a/src/vdbe.c b/src/vdbe.c index 6a4729a696..bfbb7e0195 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -3597,6 +3597,13 @@ case OP_ColumnsUsed: { ** is greater than or equal to the key value. If there are no records ** greater than or equal to the key and P2 is not zero, then jump to P2. ** +** If the cursor P1 was opened using the OPFLAG_SEEKEQ flag, then this +** opcode will always land on a record that equally equals the key, or +** else jump immediately to P2. When the cursor is OPFLAG_SEEKEQ, this +** opcode must be followed by an IdxLE opcode with the same arguments. +** The IdxLE opcode will be skipped if this opcode succeeds, but the +** IdxLE opcode will be used on subsequent loop iterations. +** ** This opcode leaves the cursor configured to move in forward order, ** from the beginning toward the end. In other words, the cursor is ** configured to use Next, not Prev. @@ -3655,18 +3662,26 @@ case OP_ColumnsUsed: { ** from the end toward the beginning. In other words, the cursor is ** configured to use Prev, not Next. ** +** If the cursor P1 was opened using the OPFLAG_SEEKEQ flag, then this +** opcode will always land on a record that equally equals the key, or +** else jump immediately to P2. When the cursor is OPFLAG_SEEKEQ, this +** opcode must be followed by an IdxGE opcode with the same arguments. +** The IdxGE opcode will be skipped if this opcode succeeds, but the +** IdxGE opcode will be used on subsequent loop iterations. +** ** See also: Found, NotFound, SeekGt, SeekGe, SeekLt */ case OP_SeekLT: /* jump, in3 */ case OP_SeekLE: /* jump, in3 */ case OP_SeekGE: /* jump, in3 */ case OP_SeekGT: { /* jump, in3 */ - int res; - int oc; - VdbeCursor *pC; - UnpackedRecord r; - int nField; - i64 iKey; /* The rowid we are to seek to */ + int res; /* Comparison result */ + int oc; /* Opcode */ + VdbeCursor *pC; /* The cursor to seek */ + UnpackedRecord r; /* The key to seek for */ + int nField; /* Number of columns or fields in the key */ + i64 iKey; /* The rowid we are to seek to */ + int eqOnly = 0; /* Only interested in == results */ assert( pOp->p1>=0 && pOp->p1nCursor ); assert( pOp->p2!=0 ); @@ -3688,18 +3703,15 @@ case OP_SeekGT: { /* jump, in3 */ ** OP_SeekLE opcodes are allowed, and these must be immediately followed ** by an OP_IdxGT or OP_IdxLT opcode, respectively, with the same key. */ -#ifdef SQLITE_DEBUG if( sqlite3BtreeCursorHasHint(pC->pCursor, BTREE_SEEK_EQ) ){ + eqOnly = 1; assert( pOp->opcode==OP_SeekGE || pOp->opcode==OP_SeekLE ); -#if 0 assert( pOp[1].opcode==OP_IdxLT || pOp[1].opcode==OP_IdxGT ); assert( pOp[1].p1==pOp[0].p1 ); assert( pOp[1].p2==pOp[0].p2 ); assert( pOp[1].p3==pOp[0].p3 ); assert( pOp[1].p4.i==pOp[0].p4.i ); -#endif } -#endif if( pC->isTable ){ /* The input value in P3 might be of any type: integer, real, string, @@ -3749,6 +3761,7 @@ case OP_SeekGT: { /* jump, in3 */ if( rc!=SQLITE_OK ){ goto abort_due_to_error; } + if( eqOnly && res ) goto seek_not_found; }else{ nField = pOp->p4.i; assert( pOp->p4type==P4_INT32 ); @@ -3779,8 +3792,9 @@ case OP_SeekGT: { /* jump, in3 */ if( rc!=SQLITE_OK ){ goto abort_due_to_error; } - if( (pOp->p5 & OPFLAG_SEEKEQ)!=0 && r.eqSeen==0 ){ - goto take_the_jump; + if( eqOnly && r.eqSeen==0 ){ + assert( res!=0 ); + goto seek_not_found; } } pC->deferredMoveto = 0; @@ -3809,11 +3823,14 @@ case OP_SeekGT: { /* jump, in3 */ res = sqlite3BtreeEof(pC->pCursor); } } -take_the_jump: +seek_not_found: assert( pOp->p2>0 ); VdbeBranchTaken(res!=0,2); if( res ){ goto jump_to_p2; + }else if( eqOnly ){ + assert( pOp[1].opcode==OP_IdxLT || pOp[1].opcode==OP_IdxGT ); + pOp++; /* Skip the OP_IdxLt or OP_IdxGT that follows */ } break; } diff --git a/src/wherecode.c b/src/wherecode.c index 644c1aa0a2..87db0e0a25 100644 --- a/src/wherecode.c +++ b/src/wherecode.c @@ -1026,7 +1026,6 @@ Bitmask sqlite3WhereCodeOneLoopStart( WhereTerm *pRangeEnd = 0; /* Inequality constraint at range end */ int startEq; /* True if range start uses ==, >= or <= */ int endEq; /* True if range end uses ==, >= or <= */ - int eqOnly; /* True if uses only == */ int start_constraints; /* Start of range is constrained */ int nConstraint; /* Number of constraint terms */ Index *pIdx; /* The index we will be using */ @@ -1096,8 +1095,6 @@ Bitmask sqlite3WhereCodeOneLoopStart( } } assert( pRangeEnd==0 || (pRangeEnd->wtFlags & TERM_VNULL)==0 ); - eqOnly = nEq>0 && (pLoop->wsFlags & WHERE_COLUMN_RANGE)==0 - && (pWInfo->wctrlFlags&WHERE_ORDERBY_MIN)==0; /* If we are doing a reverse order scan on an ascending index, or ** a forward order scan on a descending index, interchange the @@ -1170,7 +1167,6 @@ Bitmask sqlite3WhereCodeOneLoopStart( VdbeCoverageIf(v, op==OP_SeekGE); testcase( op==OP_SeekGE ); VdbeCoverageIf(v, op==OP_SeekLE); testcase( op==OP_SeekLE ); VdbeCoverageIf(v, op==OP_SeekLT); testcase( op==OP_SeekLT ); - if( eqOnly ) sqlite3VdbeChangeP5(v, OPFLAG_SEEKEQ); /* Load the value for the inequality constraint at the end of the ** range (if any). @@ -1206,11 +1202,6 @@ Bitmask sqlite3WhereCodeOneLoopStart( /* Check if the index cursor is past the end of the range. */ if( nConstraint ){ - if( eqOnly ){ - int bx = sqlite3VdbeCurrentAddr(v); - sqlite3VdbeAddOp2(v, OP_Goto, 0, bx+2); - pLevel->p2 = bx+1; - } op = aEndOp[bRev*2 + endEq]; sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint); testcase( op==OP_IdxGT ); VdbeCoverageIf(v, op==OP_IdxGT ); diff --git a/test/collate4.test b/test/collate4.test index 2ddf53d58b..b8c1c573c3 100644 --- a/test/collate4.test +++ b/test/collate4.test @@ -352,7 +352,7 @@ do_test collate4-2.1.2 { count { SELECT * FROM collate4t2, collate4t1 WHERE a = b; } -} {A a A A 5} +} {A a A A 4} do_test collate4-2.1.3 { count { SELECT * FROM collate4t2, collate4t1 WHERE b = a; @@ -372,7 +372,7 @@ do_test collate4-2.1.5 { count { SELECT * FROM collate4t2, collate4t1 WHERE b = a; } -} {A A 4} +} {A A 3} ifcapable subquery { do_test collate4-2.1.6 { count { @@ -389,12 +389,12 @@ ifcapable subquery { SELECT a FROM collate4t1 WHERE a IN (SELECT * FROM collate4t2) ORDER BY rowid } - } {a A 6} + } {a A 5} do_test collate4-2.1.8 { count { SELECT a FROM collate4t1 WHERE a IN ('z', 'a'); } - } {a A 5} + } {a A 4} do_test collate4-2.1.9 { execsql { DROP INDEX collate4i1; diff --git a/test/where.test b/test/where.test index e94047564c..0b5bb934d0 100644 --- a/test/where.test +++ b/test/where.test @@ -412,22 +412,22 @@ ifcapable subquery { count { SELECT * FROM t1 WHERE w IN (-1,1,2,3) order by 1; } - } {1 0 4 2 1 9 3 1 16 13} + } {1 0 4 2 1 9 3 1 16 12} do_test where-5.3b { count { SELECT * FROM t1 WHERE w IN (3,-1,1,2) order by 1; } - } {1 0 4 2 1 9 3 1 16 13} + } {1 0 4 2 1 9 3 1 16 12} do_test where-5.3c { count { SELECT * FROM t1 WHERE w IN (3,2,-1,1,2) order by 1; } - } {1 0 4 2 1 9 3 1 16 13} + } {1 0 4 2 1 9 3 1 16 12} do_test where-5.3d { count { SELECT * FROM t1 WHERE w IN (-1,1,2,3) order by 1 DESC; } - } {3 1 16 2 1 9 1 0 4 12} + } {3 1 16 2 1 9 1 0 4 11} do_test where-5.4 { count { SELECT * FROM t1 WHERE w+0 IN (-1,1,2,3) order by 1; @@ -465,7 +465,7 @@ ifcapable subquery { count { SELECT * FROM t1 WHERE x IN (1,7) ORDER BY 1; } - } {2 1 9 3 1 16 7} + } {2 1 9 3 1 16 6} do_test where-5.10 { count { SELECT * FROM t1 WHERE x+0 IN (1,7) ORDER BY 1; @@ -485,17 +485,17 @@ ifcapable subquery { count { SELECT * FROM t1 WHERE x IN (1,7) AND y NOT IN (6400,8100) ORDER BY 1; } - } {2 1 9 3 1 16 7} + } {2 1 9 3 1 16 6} do_test where-5.14 { count { SELECT * FROM t1 WHERE x IN (1,7) AND y IN (9,10) ORDER BY 1; } - } {2 1 9 8} + } {2 1 9 5} do_test where-5.15 { count { SELECT * FROM t1 WHERE x IN (1,7) AND y IN (9,16) ORDER BY 1; } - } {2 1 9 3 1 16 11} + } {2 1 9 3 1 16 9} do_test where-5.100 { db eval { SELECT w, x, y FROM t1 WHERE x IN (1,5) AND y IN (9,8,3025,1000,3969) diff --git a/test/where4.test b/test/where4.test index 3b24711514..bafc84faef 100644 --- a/test/where4.test +++ b/test/where4.test @@ -91,7 +91,7 @@ do_test where4-1.10 { } {6 2} do_test where4-1.11 { count {SELECT rowid FROM t1 WHERE w=x'78' AND x IS NULL AND y=123} -} {1} +} {0} do_test where4-1.12 { count {SELECT rowid FROM t1 WHERE w=x'78' AND x IS NULL AND y=x'7A'} } {6 2} From 8b8446fc21c194dbd92c57fe2527b1ec08067077 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 6 Nov 2015 01:04:41 +0000 Subject: [PATCH 23/32] Increase the precision of integer vs. floating-point comparisons. Candidate fix for ticket [38a97a87a6e4e8]. FossilOrigin-Name: cfcaa0ff276b1936418abe72c7e0c99d90d37885 --- manifest | 17 ++++++++++------- manifest.uuid | 2 +- src/vdbeaux.c | 14 +++++++------- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/manifest b/manifest index daf44cfd73..12e3f87135 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\stypo\sin\shelp\sinformation\sfor\san\sFTS5\sscript. -D 2015-11-05T21:49:19.879 +C Increase\sthe\sprecision\sof\sinteger\svs.\sfloating-point\scomparisons.\nCandidate\sfix\sfor\sticket\s[38a97a87a6e4e8]. +D 2015-11-06T01:04:41.562 F Makefile.in 3a705bb4bd12e194212ddbdbf068310d17153cdb F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 702d3e98f3afc6587a78481257f3c4c900efc3a4 @@ -407,7 +407,7 @@ F src/vdbe.c dfbaae2570172c523bce14299021d352b8508f7f F src/vdbe.h efb7a8c1459e31f3ea4377824c6a7e4cb5068637 F src/vdbeInt.h 33403622c6a8feaaac5f0f3f17f5d1bf6df42286 F src/vdbeapi.c 020681b943e77766b32ae1cddf86d7831b7374ca -F src/vdbeaux.c 717bc2ae9cc0b58ef398fff44bd9164bfd96772a +F src/vdbeaux.c debf7e021cf9008c65319da75f293f1edc1172cb F src/vdbeblob.c 565fabd302f5fca3bdf3d56cac330483616a39b6 F src/vdbemem.c fdd1578e47bea61390d472de53c565781d81e045 F src/vdbesort.c 8b23930a1289526f6d2a3a9f2e965bcc963e4a68 @@ -1398,7 +1398,10 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 445480095e6877cce8220b1c095f334bbb04c1c3 -R 68d01af6e20ce1ec369a81a5012243d6 -U mistachkin -Z 34f3b0f0379f36a413653d60c651c6ba +P 777ae8007f6ff303b120b25f2dc37d7ef6b6a4f8 +R cc9765cd257243db22c6bd69c3d99131 +T *branch * int-float-precision +T *sym-int-float-precision * +T -sym-trunk * +U drh +Z d0948553cd93aaec56b5aa2032a41416 diff --git a/manifest.uuid b/manifest.uuid index 1f1b6d3fb2..4dab4a3e5b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -777ae8007f6ff303b120b25f2dc37d7ef6b6a4f8 \ No newline at end of file +cfcaa0ff276b1936418abe72c7e0c99d90d37885 \ No newline at end of file diff --git a/src/vdbeaux.c b/src/vdbeaux.c index f605ea3ec8..9b3b1be874 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -3665,7 +3665,7 @@ int sqlite3MemCompare(const Mem *pMem1, const Mem *pMem2, const CollSeq *pColl){ ** if both values are integers. */ if( combined_flags&(MEM_Int|MEM_Real) ){ - double r1, r2; + LONGDOUBLE_TYPE r1, r2; if( (f1 & f2 & MEM_Int)!=0 ){ if( pMem1->u.i < pMem2->u.i ) return -1; if( pMem1->u.i > pMem2->u.i ) return 1; @@ -3674,14 +3674,14 @@ int sqlite3MemCompare(const Mem *pMem1, const Mem *pMem2, const CollSeq *pColl){ if( (f1&MEM_Real)!=0 ){ r1 = pMem1->u.r; }else if( (f1&MEM_Int)!=0 ){ - r1 = (double)pMem1->u.i; + r1 = (LONGDOUBLE_TYPE)pMem1->u.i; }else{ return 1; } if( (f2&MEM_Real)!=0 ){ r2 = pMem2->u.r; }else if( (f2&MEM_Int)!=0 ){ - r2 = (double)pMem2->u.i; + r2 = (LONGDOUBLE_TYPE)pMem2->u.i; }else{ return -1; } @@ -3838,7 +3838,7 @@ int sqlite3VdbeRecordCompareWithSkip( }else if( serial_type==0 ){ rc = -1; }else if( serial_type==7 ){ - double rhs = (double)pRhs->u.i; + LONGDOUBLE_TYPE rhs = (LONGDOUBLE_TYPE)pRhs->u.i; sqlite3VdbeSerialGet(&aKey1[d1], serial_type, &mem1); if( mem1.u.ru.r; - double lhs; + LONGDOUBLE_TYPE rhs = pRhs->u.r; + LONGDOUBLE_TYPE lhs; sqlite3VdbeSerialGet(&aKey1[d1], serial_type, &mem1); if( serial_type==7 ){ lhs = mem1.u.r; }else{ - lhs = (double)mem1.u.i; + lhs = (LONGDOUBLE_TYPE)mem1.u.i; } if( lhs Date: Fri, 6 Nov 2015 03:37:02 +0000 Subject: [PATCH 24/32] Some simple test cases from the mailing list. FossilOrigin-Name: 1d642b73f9e93a1ba291bf265b3d17e46551d70e --- manifest | 14 ++++++-------- manifest.uuid | 2 +- test/numindex1.test | 43 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 9 deletions(-) create mode 100644 test/numindex1.test diff --git a/manifest b/manifest index 12e3f87135..77daa100c0 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Increase\sthe\sprecision\sof\sinteger\svs.\sfloating-point\scomparisons.\nCandidate\sfix\sfor\sticket\s[38a97a87a6e4e8]. -D 2015-11-06T01:04:41.562 +C Some\ssimple\stest\scases\sfrom\sthe\smailing\slist. +D 2015-11-06T03:37:02.272 F Makefile.in 3a705bb4bd12e194212ddbdbf068310d17153cdb F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 702d3e98f3afc6587a78481257f3c4c900efc3a4 @@ -902,6 +902,7 @@ F test/notify3.test 10ff25cde502e72a92053a2f215d64bece4ef934 F test/notnull.test f8fcf58669ddba79274daa2770d61dfad8274f62 F test/null.test 0dcce4f04284ec66108c503327ad6d224c0752b3 F test/numcast.test 5d126f7f581432e86a90d1e35cac625164aec4a1 +F test/numindex1.test 6a72785828bd48deb0187480d1f821f643503254 F test/offset1.test f06b83657bcf26f9ce805e67450e189e282143b2 F test/openv2.test 0d3040974bf402e19b7df4b783e447289d7ab394 F test/orderby1.test 870e150450437d3980badbde3d0166b81d9e33f6 @@ -1398,10 +1399,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 777ae8007f6ff303b120b25f2dc37d7ef6b6a4f8 -R cc9765cd257243db22c6bd69c3d99131 -T *branch * int-float-precision -T *sym-int-float-precision * -T -sym-trunk * +P cfcaa0ff276b1936418abe72c7e0c99d90d37885 +R 935a655a72fb7279f445266ee8ecd942 U drh -Z d0948553cd93aaec56b5aa2032a41416 +Z 4bf13cc28fe21ef0ca61de36df50b42a diff --git a/manifest.uuid b/manifest.uuid index 4dab4a3e5b..678514d7ad 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -cfcaa0ff276b1936418abe72c7e0c99d90d37885 \ No newline at end of file +1d642b73f9e93a1ba291bf265b3d17e46551d70e \ No newline at end of file diff --git a/test/numindex1.test b/test/numindex1.test new file mode 100644 index 0000000000..8d4f2c695f --- /dev/null +++ b/test/numindex1.test @@ -0,0 +1,43 @@ +# 2015-11-05 +# +# 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 tests for indexes on large numeric values. +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl + + +# Test cases from Zsbán Ambrus: +# +do_execsql_test numindex1-1.1 { + CREATE TABLE t1(a INTEGER PRIMARY KEY, b); + CREATE INDEX t1b ON t1(b); + INSERT INTO t1(a,b) VALUES(100, 356282677878746339); + INSERT INTO t1(a,b) VALUES(50, 356282677878746339.0); + INSERT INTO t1(a,b) VALUES(0, 356282677878746340); + DELETE FROM t1 WHERE a=50; + PRAGMA integrity_check; +} {ok} + +do_execsql_test numindex1-1.2 { + CREATE TABLE t2(a,b); + INSERT INTO t2(a,b) VALUES('b', 1<<58), + ('c', (1<<58)+1e-7), ('d', (1<<58)+1); + SELECT a, b, typeof(b), '|' FROM t2 ORDER BY +a; +} {b 288230376151711744 integer | c 2.88230376151712e+17 real | d 288230376151711745 integer |} + +do_execsql_test numindex1-1.3 { + SELECT x.a || CASE WHEN x.b==y.b THEN '==' ELSE '<>' END || y.a + FROM t2 AS x, t2 AS y + ORDER BY +x.a, +x.b; +} {b==b b==c b<>d c==b c==c c<>d d<>b d<>c d==d} + +finish_test From aa8ff2ff6aea8cc8132bbdfd4f1304c4b6c6b926 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 6 Nov 2015 04:14:38 +0000 Subject: [PATCH 25/32] More test cases for indexes on large numeric values. FossilOrigin-Name: c220741a62808c64d42c6161152ab06af74cb48c --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/numindex1.test | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index 77daa100c0..51dce57c40 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Some\ssimple\stest\scases\sfrom\sthe\smailing\slist. -D 2015-11-06T03:37:02.272 +C More\stest\scases\sfor\sindexes\son\slarge\snumeric\svalues. +D 2015-11-06T04:14:38.328 F Makefile.in 3a705bb4bd12e194212ddbdbf068310d17153cdb F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 702d3e98f3afc6587a78481257f3c4c900efc3a4 @@ -902,7 +902,7 @@ F test/notify3.test 10ff25cde502e72a92053a2f215d64bece4ef934 F test/notnull.test f8fcf58669ddba79274daa2770d61dfad8274f62 F test/null.test 0dcce4f04284ec66108c503327ad6d224c0752b3 F test/numcast.test 5d126f7f581432e86a90d1e35cac625164aec4a1 -F test/numindex1.test 6a72785828bd48deb0187480d1f821f643503254 +F test/numindex1.test 20a5450d4b056e48cd5db30e659f13347a099823 F test/offset1.test f06b83657bcf26f9ce805e67450e189e282143b2 F test/openv2.test 0d3040974bf402e19b7df4b783e447289d7ab394 F test/orderby1.test 870e150450437d3980badbde3d0166b81d9e33f6 @@ -1399,7 +1399,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P cfcaa0ff276b1936418abe72c7e0c99d90d37885 -R 935a655a72fb7279f445266ee8ecd942 +P 1d642b73f9e93a1ba291bf265b3d17e46551d70e +R 64855a7c14d6459f4208513a6a2213eb U drh -Z 4bf13cc28fe21ef0ca61de36df50b42a +Z bbc2fe290cec56ea8698b9d9e249b3b7 diff --git a/manifest.uuid b/manifest.uuid index 678514d7ad..bdf1a11827 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1d642b73f9e93a1ba291bf265b3d17e46551d70e \ No newline at end of file +c220741a62808c64d42c6161152ab06af74cb48c \ No newline at end of file diff --git a/test/numindex1.test b/test/numindex1.test index 8d4f2c695f..c647fc5401 100644 --- a/test/numindex1.test +++ b/test/numindex1.test @@ -40,4 +40,40 @@ do_execsql_test numindex1-1.3 { ORDER BY +x.a, +x.b; } {b==b b==c b<>d c==b c==c c<>d d<>b d<>c d==d} +# New test cases +# +do_execsql_test numindex1-2.1 { + DROP TABLE IF EXISTS t1; + CREATE TABLE t1(a INTEGER PRIMARY KEY,b); + CREATE INDEX t1b ON t1(b); + WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<100) + INSERT INTO t1(a,b) SELECT x, 10000000000000004.0 FROM c + WHERE x NOT IN (23,37); + INSERT INTO t1(a,b) VALUES(23,10000000000000005); + INSERT INTO t1(a,b) VALUES(37,10000000000000003); + DELETE FROM t1 WHERE a NOT IN (23,37); + PRAGMA integrity_check; +} {ok} + +do_execsql_test numindex1-3.1 { + DROP TABLE IF EXISTS t1; + CREATE TABLE t1(a INTEGER PRIMARY KEY,b); + CREATE INDEX t1b ON t1(b); + WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<20) + INSERT INTO t1(a,b) SELECT x, 100000000000000005.0 + FROM c WHERE x NOT IN (3,5,7,11,13,17,19); + INSERT INTO t1(a,b) VALUES(3,100000000000000005); + INSERT INTO t1(a,b) VALUES(5,100000000000000000); + INSERT INTO t1(a,b) VALUES(7,100000000000000008); + INSERT INTO t1(a,b) VALUES(11,100000000000000006); + INSERT INTO t1(a,b) VALUES(13,100000000000000001); + INSERT INTO t1(a,b) VALUES(17,100000000000000004); + INSERT INTO t1(a,b) VALUES(19,100000000000000003); + PRAGMA integrity_check; +} {ok} + +do_execsql_test numindex1-3.2 { + SELECT a FROM t1 ORDER BY b; +} {1 2 4 5 6 8 9 10 12 14 15 16 18 20 13 19 17 3 11 7} + finish_test From dbbda39453fbc2e0b1cf5dfb7c03e7e2be116ee1 Mon Sep 17 00:00:00 2001 From: dan Date: Fri, 6 Nov 2015 12:50:57 +0000 Subject: [PATCH 26/32] Have fts5 load its configuration from the xConnect() method is invoked. This ensures that the very first query run uses the correct value of the 'rank' option. FossilOrigin-Name: 33e6606f5e497e81119ec491cf2370f60bddafc0 --- ext/fts5/fts5_config.c | 54 ++++++++++++++++++---------------- ext/fts5/fts5_index.c | 3 -- ext/fts5/fts5_main.c | 45 ++++++++++++++++++++++++---- ext/fts5/test/fts5fault1.test | 6 ++-- ext/fts5/test/fts5fault4.test | 2 +- ext/fts5/test/fts5rank.test | 55 +++++++++++++++++++++++++++++++++++ ext/fts5/test/fts5simple.test | 15 ++++++++++ manifest | 26 ++++++++--------- manifest.uuid | 2 +- 9 files changed, 157 insertions(+), 51 deletions(-) diff --git a/ext/fts5/fts5_config.c b/ext/fts5/fts5_config.c index b566526e0e..4f6272dbe2 100644 --- a/ext/fts5/fts5_config.c +++ b/ext/fts5/fts5_config.c @@ -707,33 +707,37 @@ int sqlite3Fts5ConfigParseRank( *pzRank = 0; *pzRankArgs = 0; - p = fts5ConfigSkipWhitespace(p); - pRank = p; - p = fts5ConfigSkipBareword(p); - - if( p ){ - zRank = sqlite3Fts5MallocZero(&rc, 1 + p - pRank); - if( zRank ) memcpy(zRank, pRank, p-pRank); - }else{ + if( p==0 ){ rc = SQLITE_ERROR; - } + }else{ + p = fts5ConfigSkipWhitespace(p); + pRank = p; + p = fts5ConfigSkipBareword(p); - if( rc==SQLITE_OK ){ - p = fts5ConfigSkipWhitespace(p); - if( *p!='(' ) rc = SQLITE_ERROR; - p++; - } - if( rc==SQLITE_OK ){ - const char *pArgs; - p = fts5ConfigSkipWhitespace(p); - pArgs = p; - if( *p!=')' ){ - p = fts5ConfigSkipArgs(p); - if( p==0 ){ - rc = SQLITE_ERROR; - }else{ - zRankArgs = sqlite3Fts5MallocZero(&rc, 1 + p - pArgs); - if( zRankArgs ) memcpy(zRankArgs, pArgs, p-pArgs); + if( p ){ + zRank = sqlite3Fts5MallocZero(&rc, 1 + p - pRank); + if( zRank ) memcpy(zRank, pRank, p-pRank); + }else{ + rc = SQLITE_ERROR; + } + + if( rc==SQLITE_OK ){ + p = fts5ConfigSkipWhitespace(p); + if( *p!='(' ) rc = SQLITE_ERROR; + p++; + } + if( rc==SQLITE_OK ){ + const char *pArgs; + p = fts5ConfigSkipWhitespace(p); + pArgs = p; + if( *p!=')' ){ + p = fts5ConfigSkipArgs(p); + if( p==0 ){ + rc = SQLITE_ERROR; + }else{ + zRankArgs = sqlite3Fts5MallocZero(&rc, 1 + p - pArgs); + if( zRankArgs ) memcpy(zRankArgs, pArgs, p-pArgs); + } } } } diff --git a/ext/fts5/fts5_index.c b/ext/fts5/fts5_index.c index a91af1304a..b7374f9805 100644 --- a/ext/fts5/fts5_index.c +++ b/ext/fts5/fts5_index.c @@ -4447,9 +4447,6 @@ int sqlite3Fts5IndexBeginWrite(Fts5Index *p, int bDelete, i64 iRowid){ /* Allocate the hash table if it has not already been allocated */ if( p->pHash==0 ){ p->rc = sqlite3Fts5HashNew(&p->pHash, &p->nPendingData); - - /* Force the configuration to be loaded */ - fts5StructureRelease(fts5StructureRead(p)); } /* Flush the hash table to disk if required */ diff --git a/ext/fts5/fts5_main.c b/ext/fts5/fts5_main.c index bd004cf824..ee5adc4b98 100644 --- a/ext/fts5/fts5_main.c +++ b/ext/fts5/fts5_main.c @@ -395,6 +395,15 @@ static int fts5InitVtab( rc = sqlite3Fts5ConfigDeclareVtab(pConfig); } + /* Load the initial configuration */ + if( rc==SQLITE_OK ){ + assert( pConfig->pzErrmsg==0 ); + pConfig->pzErrmsg = pzErr; + rc = sqlite3Fts5IndexLoadConfig(pTab->pIndex); + sqlite3Fts5IndexRollback(pTab->pIndex); + pConfig->pzErrmsg = 0; + } + if( rc!=SQLITE_OK ){ fts5FreeVtab(pTab); pTab = 0; @@ -829,6 +838,36 @@ static int fts5NextMethod(sqlite3_vtab_cursor *pCursor){ return rc; } + +static sqlite3_stmt *fts5PrepareStatement( + int *pRc, + Fts5Config *pConfig, + const char *zFmt, + ... +){ + sqlite3_stmt *pRet = 0; + va_list ap; + va_start(ap, zFmt); + + if( *pRc==SQLITE_OK ){ + int rc; + char *zSql = sqlite3_vmprintf(zFmt, ap); + if( zSql==0 ){ + rc = SQLITE_NOMEM; + }else{ + rc = sqlite3_prepare_v2(pConfig->db, zSql, -1, &pRet, 0); + if( rc!=SQLITE_OK ){ + *pConfig->pzErrmsg = sqlite3_mprintf("%s", sqlite3_errmsg(pConfig->db)); + } + sqlite3_free(zSql); + } + *pRc = rc; + } + + va_end(ap); + return pRet; +} + static int fts5CursorFirstSorted(Fts5Table *pTab, Fts5Cursor *pCsr, int bDesc){ Fts5Config *pConfig = pTab->pConfig; Fts5Sorter *pSorter; @@ -853,17 +892,13 @@ static int fts5CursorFirstSorted(Fts5Table *pTab, Fts5Cursor *pCsr, int bDesc){ ** table, saving it creates a circular reference. ** ** If SQLite a built-in statement cache, this wouldn't be a problem. */ - zSql = sqlite3Fts5Mprintf(&rc, + pSorter->pStmt = fts5PrepareStatement(&rc, pConfig, "SELECT rowid, rank FROM %Q.%Q ORDER BY %s(%s%s%s) %s", pConfig->zDb, pConfig->zName, zRank, pConfig->zName, (zRankArgs ? ", " : ""), (zRankArgs ? zRankArgs : ""), bDesc ? "DESC" : "ASC" ); - if( zSql ){ - rc = sqlite3_prepare_v2(pConfig->db, zSql, -1, &pSorter->pStmt, 0); - sqlite3_free(zSql); - } pCsr->pSorter = pSorter; if( rc==SQLITE_OK ){ diff --git a/ext/fts5/test/fts5fault1.test b/ext/fts5/test/fts5fault1.test index 13f36803e1..429ea39af0 100644 --- a/ext/fts5/test/fts5fault1.test +++ b/ext/fts5/test/fts5fault1.test @@ -52,7 +52,7 @@ do_faultsim_test 2 -prep { INSERT INTO t1 VALUES('a b c', 'a bc def ghij klmno'); } } -test { - faultsim_test_result {0 {}} + faultsim_test_result {0 {}} {1 {vtable constructor failed: t1}} } reset_db @@ -66,7 +66,7 @@ do_faultsim_test 3 -prep { } -body { execsql { DELETE FROM t1 } } -test { - faultsim_test_result {0 {}} + faultsim_test_result {0 {}} {1 {vtable constructor failed: t1}} } reset_db @@ -101,7 +101,7 @@ foreach {tn expr res} { } -body " execsql { SELECT rowid FROM t2 WHERE t2 MATCH '$expr' } " -test " - faultsim_test_result {[list 0 $res]} + faultsim_test_result {[list 0 $res]} {1 {vtable constructor failed: t2}} " } diff --git a/ext/fts5/test/fts5fault4.test b/ext/fts5/test/fts5fault4.test index a392b238ee..989a372d49 100644 --- a/ext/fts5/test/fts5fault4.test +++ b/ext/fts5/test/fts5fault4.test @@ -107,7 +107,7 @@ set ::res [db eval {SELECT rowid, x1 FROM x1 WHERE x1 MATCH '*reads'}] do_faultsim_test 4 -faults oom-* -body { db eval {SELECT rowid, x, x1 FROM x1 WHERE x1 MATCH '*reads'} } -test { - faultsim_test_result {0 {0 {} 3}} + faultsim_test_result {0 {0 {} 4}} } #------------------------------------------------------------------------- diff --git a/ext/fts5/test/fts5rank.test b/ext/fts5/test/fts5rank.test index 2182ab3097..4961b42605 100644 --- a/ext/fts5/test/fts5rank.test +++ b/ext/fts5/test/fts5rank.test @@ -41,5 +41,60 @@ do_execsql_test 1.3 { WHERE xyz MATCH 'x AND y' ORDER BY rank } [list [string map {x [x] y [y]} $doc]] +#------------------------------------------------------------------------- +# Check that the 'rank' option really is persistent. +# +do_execsql_test 2.0 { + CREATE VIRTUAL TABLE tt USING fts5(a); + INSERT INTO tt VALUES('a x x x x'); + INSERT INTO tt VALUES('x x a a a'); + INSERT INTO tt VALUES('x a a x x'); +} + +proc firstinst {cmd} { + foreach {p c o} [$cmd xInst 0] {} + return $o +} +sqlite3_fts5_create_function db firstinst firstinst + +do_execsql_test 2.1 { + SELECT rowid FROM tt('a') ORDER BY rank; +} {2 3 1} + +do_execsql_test 2.2 { + SELECT rowid FROM tt('a', 'firstinst()') ORDER BY rank; +} {1 3 2} + +do_execsql_test 2.3 { + INSERT INTO tt(tt, rank) VALUES('rank', 'firstinst()'); + SELECT rowid FROM tt('a') ORDER BY rank; +} {1 3 2} + +do_test 2.4 { + sqlite3 db2 test.db + catchsql { SELECT rowid FROM tt('a') ORDER BY rank; } db2 +} {1 {no such function: firstinst}} + +do_test 2.5 { + db2 close + sqlite3 db2 test.db + sqlite3_fts5_create_function db2 firstinst firstinst + execsql { SELECT rowid FROM tt('a') ORDER BY rank; } db2 +} {1 3 2} + +do_test 2.6 { + execsql { SELECT rowid FROM tt('a') ORDER BY rank; } db2 +} {1 3 2} + +do_test 2.7 { + execsql { SELECT rowid FROM tt('a') ORDER BY rank; } db +} {1 3 2} + + + + + + + finish_test diff --git a/ext/fts5/test/fts5simple.test b/ext/fts5/test/fts5simple.test index 458d018c34..27a1aee08b 100644 --- a/ext/fts5/test/fts5simple.test +++ b/ext/fts5/test/fts5simple.test @@ -336,5 +336,20 @@ do_test 14.2 { fts5_level_segs ttt } {1} +#------------------------------------------------------------------------- +db func rnddoc fts5_rnddoc +do_execsql_test 4.0 { + CREATE VIRTUAL TABLE x1 USING fts5(x); + INSERT INTO x1(x1, rank) VALUES('pgsz', 32); + + WITH ii(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM ii WHERE i<10 ) + INSERT INTO x1 SELECT rnddoc(5) FROM ii; +} + +do_execsql_test 4.1 { + SELECT rowid, x, x1 FROM x1 WHERE x1 MATCH '*reads' +} {0 {} 4} + + finish_test diff --git a/manifest b/manifest index daf44cfd73..4163d9d511 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\stypo\sin\shelp\sinformation\sfor\san\sFTS5\sscript. -D 2015-11-05T21:49:19.879 +C Have\sfts5\sload\sits\sconfiguration\sfrom\sthe\sxConnect()\smethod\sis\sinvoked.\sThis\sensures\sthat\sthe\svery\sfirst\squery\srun\suses\sthe\scorrect\svalue\sof\sthe\s'rank'\soption. +D 2015-11-06T12:50:57.166 F Makefile.in 3a705bb4bd12e194212ddbdbf068310d17153cdb F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 702d3e98f3afc6587a78481257f3c4c900efc3a4 @@ -106,11 +106,11 @@ F ext/fts5/fts5.h 8b9a13b309b180e9fb88ea5666c0d8d73c6102d9 F ext/fts5/fts5Int.h acf968e43d57b6b1caf7554d34ec35d6ed3b4fe8 F ext/fts5/fts5_aux.c 1f384972d606375b8fa078319f25ab4b5feb1b35 F ext/fts5/fts5_buffer.c 1e49512a535045e621246dc7f4f65f3593fa0fc2 -F ext/fts5/fts5_config.c 81ec07cb644e33df4cd58d46990016b2ce7c175c +F ext/fts5/fts5_config.c 6fc92c0b1bda5244c28a54c9ba740736bd5513d9 F ext/fts5/fts5_expr.c 28b15c9ae296204bc0a2e5cf7a667d840a9d2900 F ext/fts5/fts5_hash.c a9d4c1efebc2a91d26ad7ebdfcbf2678ceac405f -F ext/fts5/fts5_index.c 967d797282e4595f8671d152ed8ecf6cc7e640b5 -F ext/fts5/fts5_main.c 39358d3d8f0d6ea3757c40e0ddcbb6bc435604c3 +F ext/fts5/fts5_index.c b622a0a70f57a96469e6828da2dd70e0872aeb37 +F ext/fts5/fts5_main.c 0569cd9fc18f3b56f6eeac601836df8ed5fb54cb F ext/fts5/fts5_storage.c 9ea3d92178743758b6c54d9fe8836bbbdcc92e3b F ext/fts5/fts5_tcl.c 3bf445e66de32137d4693694ff7b1fd6074e32bd F ext/fts5/fts5_test_mi.c e96be827aa8f571031e65e481251dc1981d608bf @@ -149,10 +149,10 @@ F ext/fts5/test/fts5dlidx.test ecba5e62ea8b26c33829961602069c546228046d F ext/fts5/test/fts5doclist.test 8edb5b57e5f144030ed74ec00ef6fa4294fed79b F ext/fts5/test/fts5ea.test b01e3a18cdfabbff8104a96a5242a06a68a998a0 F ext/fts5/test/fts5eb.test 3e5869af2008cbc4ad03a175a0b6f6e58134cd43 -F ext/fts5/test/fts5fault1.test 7a562367cb4a735b57b410dbdb62dcc8d971faec +F ext/fts5/test/fts5fault1.test 4b39c47ca3544615daa8a2f733b911fa08022c77 F ext/fts5/test/fts5fault2.test 28c36c843bb39ae855ba79827417ecc37f114341 F ext/fts5/test/fts5fault3.test d6e9577d4312e331a913c72931bf131704efc8f3 -F ext/fts5/test/fts5fault4.test 762991d526ee67c2b374351a17248097ea38bee7 +F ext/fts5/test/fts5fault4.test 4864f2b5c2c083440dbe85aff60897bc1aa04603 F ext/fts5/test/fts5fault5.test f2b8645053d48982e8979749e93994c43011c118 F ext/fts5/test/fts5fault6.test 9682664d679643ac6736e90c225526cc84073cda F ext/fts5/test/fts5fault7.test 01be274bfc8d9bf22451a3bf5892e9399d044f1b @@ -170,11 +170,11 @@ F ext/fts5/test/fts5porter.test 7cdc07bef301d70eebbfa75dcaf45c3680e1d0e1 F ext/fts5/test/fts5porter2.test 2e65633d58a1c525d5af0f6c01e5a59155bb3487 F ext/fts5/test/fts5prefix.test 7ccbdf180ed561a912acef520519e85af8642239 F ext/fts5/test/fts5query.test f5ec25f5f2fbb70033424113cdffc101b1985a40 -F ext/fts5/test/fts5rank.test 11dcebba31d822f7e99685b4ea2c2ae3ec0b16f1 +F ext/fts5/test/fts5rank.test 7e9e64eac7245637f6f2033aec4b292aaf611aab F ext/fts5/test/fts5rebuild.test 03935f617ace91ed23a6099c7c74d905227ff29b F ext/fts5/test/fts5restart.test c17728fdea26e7d0f617d22ad5b4b2862b994c17 F ext/fts5/test/fts5rowid.test 400384798349d658eaf06aefa1e364957d5d4821 -F ext/fts5/test/fts5simple.test ec1c6a6f51890ba864f866387794878ff2994de9 +F ext/fts5/test/fts5simple.test 9bded45827b4ab8933c87b7b3bcc3cd47f7378a4 F ext/fts5/test/fts5synonym.test cf88c0a56d5ea9591e3939ef1f6e294f7f2d0671 F ext/fts5/test/fts5tokenizer.test ea4df698b35cc427ebf2ba22829d0e28386d8c89 F ext/fts5/test/fts5unicode.test fbef8d8a3b4b88470536cc57604a82ca52e51841 @@ -1398,7 +1398,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 445480095e6877cce8220b1c095f334bbb04c1c3 -R 68d01af6e20ce1ec369a81a5012243d6 -U mistachkin -Z 34f3b0f0379f36a413653d60c651c6ba +P 777ae8007f6ff303b120b25f2dc37d7ef6b6a4f8 +R 4ec8b8e5e66f6ab44c58d4f991232b45 +U dan +Z f9c34cc6cfcf4374f3d76c696dbe3249 diff --git a/manifest.uuid b/manifest.uuid index 1f1b6d3fb2..146948eca4 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -777ae8007f6ff303b120b25f2dc37d7ef6b6a4f8 \ No newline at end of file +33e6606f5e497e81119ec491cf2370f60bddafc0 \ No newline at end of file From 2ab410aa1ececc8db6cd9c97db58b6b1e14756ac Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 6 Nov 2015 14:59:07 +0000 Subject: [PATCH 27/32] A different approach to handling integer/float comparisons. This seems to work better on systems where "long double" and "double" are the same type, but still needs refinement and testing. FossilOrigin-Name: a3f7614b2095fbc1eca54801b2da88f85f294ec5 --- manifest | 16 ++++----- manifest.uuid | 2 +- src/test1.c | 3 ++ src/vdbeaux.c | 91 ++++++++++++++++++++++++++++++------------------- test/atof1.test | 2 +- 5 files changed, 69 insertions(+), 45 deletions(-) diff --git a/manifest b/manifest index 51dce57c40..e26ea741b7 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C More\stest\scases\sfor\sindexes\son\slarge\snumeric\svalues. -D 2015-11-06T04:14:38.328 +C A\sdifferent\sapproach\sto\shandling\sinteger/float\scomparisons.\s\sThis\sseems\sto\nwork\sbetter\son\ssystems\swhere\s"long\sdouble"\sand\s"double"\sare\sthe\ssame\stype,\nbut\sstill\sneeds\srefinement\sand\stesting. +D 2015-11-06T14:59:07.361 F Makefile.in 3a705bb4bd12e194212ddbdbf068310d17153cdb F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 702d3e98f3afc6587a78481257f3c4c900efc3a4 @@ -350,7 +350,7 @@ F src/sqliteLimit.h 216557999cb45f2e3578ed53ebefe228d779cb46 F src/status.c 70912d7be68e9e2dbc4010c93d344af61d4c59ba F src/table.c 51b46b2a62d1b3a959633d593b89bab5e2c9155e F src/tclsqlite.c d9439b6a910985b7fff43ba6756bcef00de22649 -F src/test1.c 9ac5cbfe3c859ab7518edc5109a2959d6bf7b059 +F src/test1.c a719afff3144f7f01c6dc3f7d118ac31d15e7527 F src/test2.c 5586f43fcd9a1be0830793cf9d354082c261b25b F src/test3.c a8887dabbbee3059af338f20d290084a63ed1b0f F src/test4.c d168f83cc78d02e8d35567bb5630e40dcd85ac1e @@ -407,7 +407,7 @@ F src/vdbe.c dfbaae2570172c523bce14299021d352b8508f7f F src/vdbe.h efb7a8c1459e31f3ea4377824c6a7e4cb5068637 F src/vdbeInt.h 33403622c6a8feaaac5f0f3f17f5d1bf6df42286 F src/vdbeapi.c 020681b943e77766b32ae1cddf86d7831b7374ca -F src/vdbeaux.c debf7e021cf9008c65319da75f293f1edc1172cb +F src/vdbeaux.c 869c95b0fc73026da1ca179e053807f563793e8f F src/vdbeblob.c 565fabd302f5fca3bdf3d56cac330483616a39b6 F src/vdbemem.c fdd1578e47bea61390d472de53c565781d81e045 F src/vdbesort.c 8b23930a1289526f6d2a3a9f2e965bcc963e4a68 @@ -453,7 +453,7 @@ F test/async2.test c0a9bd20816d7d6a2ceca7b8c03d3d69c28ffb8b F test/async3.test d73a062002376d7edc1fe3edff493edbec1fc2f7 F test/async4.test 1787e3952128aa10238bf39945126de7ca23685a F test/async5.test 383ab533fdb9f7ad228cc99ee66e1acb34cc0dc0 -F test/atof1.test 08a61df9365c341f334a65f4348897312d8f3db7 +F test/atof1.test ff0b0156fd705b67c506e1f2bfe9e26102bea9bd F test/attach.test 437107943f14d131cf5efc2ae5305a94d7cb1d58 F test/attach2.test 0ec5defa340363de6cd50fd595046465e9aaba2d F test/attach3.test 359eb65d00102cdfcef6fa4e81dc1648f8f80b27 @@ -1399,7 +1399,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 1d642b73f9e93a1ba291bf265b3d17e46551d70e -R 64855a7c14d6459f4208513a6a2213eb +P c220741a62808c64d42c6161152ab06af74cb48c +R 657a004dd1109c7e46c85d0fcca1d027 U drh -Z bbc2fe290cec56ea8698b9d9e249b3b7 +Z b71edcd294ef001f8419c54517ae11bb diff --git a/manifest.uuid b/manifest.uuid index bdf1a11827..1a122130c0 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c220741a62808c64d42c6161152ab06af74cb48c \ No newline at end of file +a3f7614b2095fbc1eca54801b2da88f85f294ec5 \ No newline at end of file diff --git a/src/test1.c b/src/test1.c index dd190feebc..7ce4ed5a5a 100644 --- a/src/test1.c +++ b/src/test1.c @@ -7039,6 +7039,7 @@ int Sqlitetest1_Init(Tcl_Interp *interp){ }; static int bitmask_size = sizeof(Bitmask)*8; + static int longdouble_size = sizeof(LONGDOUBLE_TYPE); int i; extern int sqlite3_sync_count, sqlite3_fullsync_count; extern int sqlite3_opentemp_count; @@ -7139,6 +7140,8 @@ int Sqlitetest1_Init(Tcl_Interp *interp){ (char*)&sqlite3_data_directory, TCL_LINK_STRING); Tcl_LinkVar(interp, "bitmask_size", (char*)&bitmask_size, TCL_LINK_INT|TCL_LINK_READ_ONLY); + Tcl_LinkVar(interp, "longdouble_size", + (char*)&longdouble_size, TCL_LINK_INT|TCL_LINK_READ_ONLY); Tcl_LinkVar(interp, "sqlite_sync_count", (char*)&sqlite3_sync_count, TCL_LINK_INT); Tcl_LinkVar(interp, "sqlite_fullsync_count", diff --git a/src/vdbeaux.c b/src/vdbeaux.c index 9b3b1be874..196a6765df 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -3634,6 +3634,34 @@ static SQLITE_NOINLINE int sqlite3BlobCompare(const Mem *pB1, const Mem *pB2){ return pB1->n - pB2->n; } +/* +** Do a comparison between a 64-bit signed integer and a 64-bit floating-point +** number. Return negative, zero, or positive if the first (i64) is less than, +** equal to, or greater than the second (double). +*/ +static int sqlite3IntFloatCompare(i64 i, double r){ + if( sizeof(LONGDOUBLE_TYPE)>8 ){ + LONGDOUBLE_TYPE x = (LONGDOUBLE_TYPE)i; + if( xr ) return +1; + return 0; + }else{ + i64 y; + double s; + if( r<-9223372036854775808.0 ) return +1; + if( r>9223372036854775807.0 ) return -1; + y = (i64)r; + if( iy ){ + if( y==SMALLEST_INT64 && r>0.0 ) return -1; + return +1; + } + s = (double)i; + if( sr ) return +1; + return 0; + } +} /* ** Compare the values contained by the two memory cells, returning @@ -3660,34 +3688,34 @@ int sqlite3MemCompare(const Mem *pMem1, const Mem *pMem2, const CollSeq *pColl){ return (f2&MEM_Null) - (f1&MEM_Null); } - /* If one value is a number and the other is not, the number is less. - ** If both are numbers, compare as reals if one is a real, or as integers - ** if both values are integers. + /* At least one of the two values is a number */ if( combined_flags&(MEM_Int|MEM_Real) ){ - LONGDOUBLE_TYPE r1, r2; if( (f1 & f2 & MEM_Int)!=0 ){ if( pMem1->u.i < pMem2->u.i ) return -1; - if( pMem1->u.i > pMem2->u.i ) return 1; + if( pMem1->u.i > pMem2->u.i ) return +1; return 0; } + if( (f1 & f2 & MEM_Real)!=0 ){ + if( pMem1->u.r < pMem2->u.r ) return -1; + if( pMem1->u.r > pMem2->u.r ) return +1; + return 0; + } + if( (f1&MEM_Int)!=0 ){ + if( (f2&MEM_Real)!=0 ){ + return sqlite3IntFloatCompare(pMem1->u.i, pMem2->u.r); + }else{ + return -1; + } + } if( (f1&MEM_Real)!=0 ){ - r1 = pMem1->u.r; - }else if( (f1&MEM_Int)!=0 ){ - r1 = (LONGDOUBLE_TYPE)pMem1->u.i; - }else{ - return 1; + if( (f2&MEM_Int)!=0 ){ + return -sqlite3IntFloatCompare(pMem2->u.i, pMem1->u.r); + }else{ + return -1; + } } - if( (f2&MEM_Real)!=0 ){ - r2 = pMem2->u.r; - }else if( (f2&MEM_Int)!=0 ){ - r2 = (LONGDOUBLE_TYPE)pMem2->u.i; - }else{ - return -1; - } - if( r1r2 ) return 1; - return 0; + return +1; } /* If one value is a string and the other is a blob, the string is less. @@ -3838,13 +3866,8 @@ int sqlite3VdbeRecordCompareWithSkip( }else if( serial_type==0 ){ rc = -1; }else if( serial_type==7 ){ - LONGDOUBLE_TYPE rhs = (LONGDOUBLE_TYPE)pRhs->u.i; sqlite3VdbeSerialGet(&aKey1[d1], serial_type, &mem1); - if( mem1.u.rrhs ){ - rc = +1; - } + rc = -sqlite3IntFloatCompare(pRhs->u.i, mem1.u.r); }else{ i64 lhs = vdbeRecordDecodeInt(serial_type, &aKey1[d1]); i64 rhs = pRhs->u.i; @@ -3868,18 +3891,15 @@ int sqlite3VdbeRecordCompareWithSkip( }else if( serial_type==0 ){ rc = -1; }else{ - LONGDOUBLE_TYPE rhs = pRhs->u.r; - LONGDOUBLE_TYPE lhs; sqlite3VdbeSerialGet(&aKey1[d1], serial_type, &mem1); if( serial_type==7 ){ - lhs = mem1.u.r; + if( mem1.u.ru.r ){ + rc = -1; + }else if( mem1.u.r>pRhs->u.r ){ + rc = +1; + } }else{ - lhs = (LONGDOUBLE_TYPE)mem1.u.i; - } - if( lhsrhs ){ - rc = +1; + rc = sqlite3IntFloatCompare(mem1.u.i, pRhs->u.r); } } } @@ -4088,6 +4108,7 @@ static int vdbeRecordCompareString( int serial_type; int res; + assert( pPKey2->aMem[0].flags & MEM_Str ); vdbeAssertFieldCountWithinLimits(nKey1, pKey1, pPKey2->pKeyInfo); getVarint32(&aKey1[1], serial_type); if( serial_type<12 ){ diff --git a/test/atof1.test b/test/atof1.test index 5c04d02290..55f5e44d96 100644 --- a/test/atof1.test +++ b/test/atof1.test @@ -15,7 +15,7 @@ set testdir [file dirname $argv0] source $testdir/tester.tcl -if {![info exists __GNUC__] || [regexp arm $tcl_platform(machine)]} { +if {$::longdouble_size<=8} { finish_test return } From ff621c6894ee0f8b2ef9bec58b1d0bf7e8851cd7 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 6 Nov 2015 17:01:20 +0000 Subject: [PATCH 28/32] Test cases for the ieee754 extension. FossilOrigin-Name: 840cbda88675b6012dae2423252bf42d0d563874 --- ext/misc/ieee754.c | 4 ++-- manifest | 15 +++++++------ manifest.uuid | 2 +- test/ieee754.test | 56 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 67 insertions(+), 10 deletions(-) create mode 100644 test/ieee754.test diff --git a/ext/misc/ieee754.c b/ext/misc/ieee754.c index f143893885..a0e07b6349 100644 --- a/ext/misc/ieee754.c +++ b/ext/misc/ieee754.c @@ -94,13 +94,13 @@ static void ieee754func( m >>= 1; e++; } - while( ((m>>32)&0xfff00000)==0 ){ + while( m!=0 && ((m>>32)&0xfff00000)==0 ){ m <<= 1; e--; } e += 1075; if( e<0 ) e = m = 0; - if( e>0x7ff ) m = 0; + if( e>0x7ff ) e = 0x7ff; a = m & ((((sqlite3_int64)1)<<52)-1); a |= e<<52; if( isNeg ) a |= ((sqlite3_int64)1)<<63; diff --git a/manifest b/manifest index 4163d9d511..075ff7fbdb 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Have\sfts5\sload\sits\sconfiguration\sfrom\sthe\sxConnect()\smethod\sis\sinvoked.\sThis\sensures\sthat\sthe\svery\sfirst\squery\srun\suses\sthe\scorrect\svalue\sof\sthe\s'rank'\soption. -D 2015-11-06T12:50:57.166 +C Test\scases\sfor\sthe\sieee754\sextension. +D 2015-11-06T17:01:20.579 F Makefile.in 3a705bb4bd12e194212ddbdbf068310d17153cdb F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 702d3e98f3afc6587a78481257f3c4c900efc3a4 @@ -196,7 +196,7 @@ F ext/misc/compress.c 122faa92d25033d6c3f07c39231de074ab3d2e83 F ext/misc/eval.c f971962e92ebb8b0a4e6b62949463ee454d88fa2 F ext/misc/fileio.c d4171c815d6543a9edef8308aab2951413cd8d0f F ext/misc/fuzzer.c 4c84635c71c26cfa7c2e5848cf49fe2d2cfcd767 -F ext/misc/ieee754.c b0362167289170627659e84173f5d2e8fee8566e +F ext/misc/ieee754.c ca4a0a8fd2d4667a7ef10b761312c256bc734039 F ext/misc/json1.c 4f45afd9dbcd6feca8c528251efbb7fc09299a09 F ext/misc/nextchar.c 35c8b8baacb96d92abbb34a83a997b797075b342 F ext/misc/percentile.c bcbee3c061b884eccb80e21651daaae8e1e43c63 @@ -765,6 +765,7 @@ F test/genesis.tcl 1e2e2e8e5cc4058549a154ff1892fe5c9de19f98 F test/hexlit.test 1d312fa816dfd3650a3bb488093bc09a0c927f67 F test/hook.test 162d7cef7a2d2b04839fe14402934e6a1b79442f F test/icu.test 70df4faca133254c042d02ae342c0a141f2663f4 +F test/ieee754.test 118b665a97a8df0e8f2fbdb07d113e596f4a6b53 F test/imposter1.test c3f1db2d3db2c24611a6596a3fc0ffc14f1466c8 F test/in.test 61a24ae38d4b64ec69f06ccdf022992f68a98176 F test/in2.test 5d4c61d17493c832f7d2d32bef785119e87bde75 @@ -1398,7 +1399,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 777ae8007f6ff303b120b25f2dc37d7ef6b6a4f8 -R 4ec8b8e5e66f6ab44c58d4f991232b45 -U dan -Z f9c34cc6cfcf4374f3d76c696dbe3249 +P 33e6606f5e497e81119ec491cf2370f60bddafc0 +R 6a48cd86f6e2c59a9972f4901e737c7d +U drh +Z 4f550f3fed6ca631b416aee9408c87ae diff --git a/manifest.uuid b/manifest.uuid index 146948eca4..5f0e15612b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -33e6606f5e497e81119ec491cf2370f60bddafc0 \ No newline at end of file +840cbda88675b6012dae2423252bf42d0d563874 \ No newline at end of file diff --git a/test/ieee754.test b/test/ieee754.test new file mode 100644 index 0000000000..c0bf9d7995 --- /dev/null +++ b/test/ieee754.test @@ -0,0 +1,56 @@ +# 2015-11-06 +# +# 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. +# +#*********************************************************************** +# +# Tests of the iee754 extension +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl + +load_static_extension db ieee754 + +foreach {id float rep} { + 1 1.0 1,0 + 2 2.0 2,0 + 3 0.5 1,-1 + 4 1.5 3,-1 + 5 0.0 0,-1075 + 6 4.9406564584124654e-324 4503599627370497,-1075 + 7 2.2250738585072009e-308 9007199254740991,-1075 + 8 2.2250738585072014e-308 1,-1022 +} { + do_test ieee754-100-$id-1 { + db eval "SELECT ieee754($float);" + } "ieee754($rep)" + do_test ieee754-100-$id-2 { + db eval "SELECT ieee754($rep)==$float;" + } {1} + if {$float!=0.0} { + do_test ieee754-100-$id-3 { + db eval "SELECT ieee754(-$float);" + } "ieee754(-$rep)" + do_test ieee754-100-$id-4 { + db eval "SELECT ieee754(-$rep)==-$float;" + } {1} + } +} + +do_execsql_test ieee754-110 { + SELECT ieee754(1,1024), ieee754(4503599627370495,972); +} {Inf 1.79769313486232e+308} +do_execsql_test ieee754-111 { + SELECT ieee754(-1,1024), ieee754(-4503599627370495,972); +} {-Inf -1.79769313486232e+308} +do_execsql_test ieee754-112 { + SELECT ieee754(4503599627370495,973) is null; +} {1} + +finish_test From c8bb430dfe1ced6cf5a89500dafe45cc9c3bd871 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 6 Nov 2015 17:28:00 +0000 Subject: [PATCH 29/32] A proposed patch for working around a bug in the optimizer for the HP compiler found on HP/UX Itanium. FossilOrigin-Name: 8a171548e4f665f03d00af6dcb46669a4a78fad5 --- manifest | 15 +++++++++------ manifest.uuid | 2 +- src/vdbeaux.c | 4 ++++ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index 075ff7fbdb..37f03579b7 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Test\scases\sfor\sthe\sieee754\sextension. -D 2015-11-06T17:01:20.579 +C A\sproposed\spatch\sfor\sworking\saround\sa\sbug\sin\sthe\soptimizer\sfor\sthe\sHP\scompiler\nfound\son\sHP/UX\sItanium. +D 2015-11-06T17:28:00.429 F Makefile.in 3a705bb4bd12e194212ddbdbf068310d17153cdb F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 702d3e98f3afc6587a78481257f3c4c900efc3a4 @@ -407,7 +407,7 @@ F src/vdbe.c dfbaae2570172c523bce14299021d352b8508f7f F src/vdbe.h efb7a8c1459e31f3ea4377824c6a7e4cb5068637 F src/vdbeInt.h 33403622c6a8feaaac5f0f3f17f5d1bf6df42286 F src/vdbeapi.c 020681b943e77766b32ae1cddf86d7831b7374ca -F src/vdbeaux.c 717bc2ae9cc0b58ef398fff44bd9164bfd96772a +F src/vdbeaux.c 5f7b42d82d1984c496927d2d739387f8363d6575 F src/vdbeblob.c 565fabd302f5fca3bdf3d56cac330483616a39b6 F src/vdbemem.c fdd1578e47bea61390d472de53c565781d81e045 F src/vdbesort.c 8b23930a1289526f6d2a3a9f2e965bcc963e4a68 @@ -1399,7 +1399,10 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 33e6606f5e497e81119ec491cf2370f60bddafc0 -R 6a48cd86f6e2c59a9972f4901e737c7d +P 840cbda88675b6012dae2423252bf42d0d563874 +R 7a881fe3a454259c48d7dca38381f204 +T *branch * hp-optimizer-fix +T *sym-hp-optimizer-fix * +T -sym-trunk * U drh -Z 4f550f3fed6ca631b416aee9408c87ae +Z b81d9efde52745233947ff97559d6a84 diff --git a/manifest.uuid b/manifest.uuid index 5f0e15612b..6d4801fa98 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -840cbda88675b6012dae2423252bf42d0d563874 \ No newline at end of file +8a171548e4f665f03d00af6dcb46669a4a78fad5 \ No newline at end of file diff --git a/src/vdbeaux.c b/src/vdbeaux.c index f605ea3ec8..4fafdcd9de 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -3319,6 +3319,10 @@ u32 sqlite3VdbeSerialGet( /* EVIDENCE-OF: R-01849-26079 Value is a big-endian 32-bit ** twos-complement integer. */ pMem->u.i = FOUR_BYTE_INT(buf); +#ifdef __HP_cc + /* Work around a sign-extension bug in the HP compiler for HP/UX */ + if( buf[0]&0x80 ) pMem->u.i |= 0xffffffff80000000LL; +#endif pMem->flags = MEM_Int; testcase( pMem->u.i<0 ); return 4; From 51675f24f30792f06bc69fc8f1b1eac7cc4d91fd Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 6 Nov 2015 20:04:08 +0000 Subject: [PATCH 30/32] Test changes: Omit numindex1.test from valgrind, since valgrind uses a none-standard floating-point processor which gives inconsistent answers. Run one releasetest.tcl module using LONGDOUBLE_TYPE=double. FossilOrigin-Name: d421efbf9a5688f5a20b6dfe3aa216299c7b9c86 --- manifest | 15 +++++++-------- manifest.uuid | 2 +- test/permutations.test | 2 +- test/releasetest.tcl | 1 + 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index 96707680e4..29f832afe0 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Enforce\sconsistent\scomparison\sresults\sbetween\sinteger\sand\sfloating\spoint\nvalues.\s\sFix\sfor\sticket\s[38a97a87a6e4e83]. -D 2015-11-06T19:53:09.863 +C Test\schanges:\s\sOmit\snumindex1.test\sfrom\svalgrind,\ssince\svalgrind\suses\sa\nnone-standard\sfloating-point\sprocessor\swhich\sgives\sinconsistent\sanswers.\nRun\sone\sreleasetest.tcl\smodule\susing\sLONGDOUBLE_TYPE=double. +D 2015-11-06T20:04:08.458 F Makefile.in 3a705bb4bd12e194212ddbdbf068310d17153cdb F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 702d3e98f3afc6587a78481257f3c4c900efc3a4 @@ -930,7 +930,7 @@ F test/parser1.test 222b5cbf3e2e659fec1bf7d723488c8b9c94f1d0 F test/pcache.test c8acbedd3b6fd0f9a7ca887a83b11d24a007972b F test/pcache2.test af7f3deb1a819f77a6d0d81534e97d1cf62cd442 F test/percentile.test 4243af26b8f3f4555abe166f723715a1f74c77ff -F test/permutations.test 0be620cfc7309d72b0608b3f1cbadef1034417fa +F test/permutations.test 4ea119731c62d2f7d0aa86dd5b184cbb61ca411b F test/pragma.test a44253f911e7d50127d4a08f927f47c861a4c772 F test/pragma2.test b5e2ce4c892afceb308c6ae6163a9099b2a0d8d7 F test/pragma3.test 6f849ccffeee7e496d2f2b5e74152306c0b8757c @@ -950,7 +950,7 @@ F test/rbu.test 168573d353cd0fd10196b87b0caa322c144ef736 F test/rdonly.test 64e2696c322e3538df0b1ed624e21f9a23ed9ff8 F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 -F test/releasetest.tcl c12c4122a7b2ddec16b5f8fb9163f7a008886005 +F test/releasetest.tcl 2d000ceded3115758be96abb9c10a5669fb27862 F test/resolver01.test f4022acafda7f4d40eca94dbf16bc5fc4ac30ceb F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14 @@ -1400,8 +1400,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 840cbda88675b6012dae2423252bf42d0d563874 7a9988d38cd7ab3df79eed97631ff23d5928b4ad -R 281cdf2e28b38f35a9e781fe4ef44557 -T +closed 7a9988d38cd7ab3df79eed97631ff23d5928b4ad +P 849e686da2d20fd7f938427475fc792384d2aa7c +R bc805b9c9eb147f835a7b134914f33c0 U drh -Z 043f003e4fd28221190bc705626ad8a1 +Z 126ae0fefea0cf2ca80b12b014ca7256 diff --git a/manifest.uuid b/manifest.uuid index 446605d121..d3e399026a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -849e686da2d20fd7f938427475fc792384d2aa7c \ No newline at end of file +d421efbf9a5688f5a20b6dfe3aa216299c7b9c86 \ No newline at end of file diff --git a/test/permutations.test b/test/permutations.test index 9396f2ce4b..28bbd3017e 100644 --- a/test/permutations.test +++ b/test/permutations.test @@ -178,7 +178,7 @@ test_suite "valgrind" -prefix "" -description { } -files [ test_set $allquicktests -exclude *malloc* *ioerr* *fault* wal.test \ shell*.test crash8.test atof1.test selectG.test \ - tkt-fc62af4523.test + tkt-fc62af4523.test numindex1.test ] -initialize { set ::G(valgrind) 1 } -shutdown { diff --git a/test/releasetest.tcl b/test/releasetest.tcl index c2fbd0acb3..2e67aabae2 100644 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -128,6 +128,7 @@ array set ::Configs [strip_comments { -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_RBU -DSQLITE_MAX_ATTACHED=125 + -DLONGDOUBLE_TYPE=double } "Device-One" { -O2 From 3901692ede9b144e0a7ea7be74bb557a3256ea5e Mon Sep 17 00:00:00 2001 From: drh Date: Sat, 7 Nov 2015 00:51:15 +0000 Subject: [PATCH 31/32] Fix a harmless sanitizer warning in the ieee754 extension. FossilOrigin-Name: dd9a26ecdeaef7b0b9cbf4ff70448ab13a276b4e --- ext/misc/ieee754.c | 2 +- manifest | 13 ++++++------- manifest.uuid | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/ext/misc/ieee754.c b/ext/misc/ieee754.c index a0e07b6349..20c5e61433 100644 --- a/ext/misc/ieee754.c +++ b/ext/misc/ieee754.c @@ -103,7 +103,7 @@ static void ieee754func( if( e>0x7ff ) e = 0x7ff; a = m & ((((sqlite3_int64)1)<<52)-1); a |= e<<52; - if( isNeg ) a |= ((sqlite3_int64)1)<<63; + if( isNeg ) a |= ((sqlite3_uint64)1)<<63; memcpy(&r, &a, sizeof(r)); sqlite3_result_double(context, r); } diff --git a/manifest b/manifest index e367097276..495696b9a2 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Avoid\san\sunnecessary\skey\scomparison\swhen\sdoing\san\sindexed\slookup\sagainst\san\nequality\sconstraint. -D 2015-11-06T20:22:25.475 +C Fix\sa\sharmless\ssanitizer\swarning\sin\sthe\sieee754\sextension. +D 2015-11-07T00:51:15.328 F Makefile.in 3a705bb4bd12e194212ddbdbf068310d17153cdb F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 702d3e98f3afc6587a78481257f3c4c900efc3a4 @@ -196,7 +196,7 @@ F ext/misc/compress.c 122faa92d25033d6c3f07c39231de074ab3d2e83 F ext/misc/eval.c f971962e92ebb8b0a4e6b62949463ee454d88fa2 F ext/misc/fileio.c d4171c815d6543a9edef8308aab2951413cd8d0f F ext/misc/fuzzer.c 4c84635c71c26cfa7c2e5848cf49fe2d2cfcd767 -F ext/misc/ieee754.c ca4a0a8fd2d4667a7ef10b761312c256bc734039 +F ext/misc/ieee754.c f190d0cc5182529acb15babd177781be1ac1718c F ext/misc/json1.c 4f45afd9dbcd6feca8c528251efbb7fc09299a09 F ext/misc/nextchar.c 35c8b8baacb96d92abbb34a83a997b797075b342 F ext/misc/percentile.c bcbee3c061b884eccb80e21651daaae8e1e43c63 @@ -1400,8 +1400,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 46c36b1543d7a8156eaa866c67080526153fb10d 997ce6c90b454c03cc2ef6934752ee8dd2e520e3 -R d671b922284dee0f3690ad077e9da684 -T +closed 997ce6c90b454c03cc2ef6934752ee8dd2e520e3 +P d741e1ccdce96e6142e294fbdd20a0282296dcea +R 09ac306f39fb272ed95e60baefe78a45 U drh -Z 296d234d0e2e95f43350e42db47ce3df +Z d2d47fc2f78320b8e866fa5d7ad2519b diff --git a/manifest.uuid b/manifest.uuid index dd7abc718a..e3b122df6d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d741e1ccdce96e6142e294fbdd20a0282296dcea \ No newline at end of file +dd9a26ecdeaef7b0b9cbf4ff70448ab13a276b4e \ No newline at end of file From d6b7946c32ec1cf4b77f51ab82db553cf466c488 Mon Sep 17 00:00:00 2001 From: drh Date: Sat, 7 Nov 2015 01:19:00 +0000 Subject: [PATCH 32/32] The OPFLAG_SEEKEQ optimization is only applicable to equality comparisons against an index, not against a rowid table. FossilOrigin-Name: 0f5b147d1fe83c34d0fbeacc7422be94d8441bc1 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/vdbe.c | 35 +++++++++++++++++++---------------- 3 files changed, 26 insertions(+), 23 deletions(-) diff --git a/manifest b/manifest index 495696b9a2..782863019b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sharmless\ssanitizer\swarning\sin\sthe\sieee754\sextension. -D 2015-11-07T00:51:15.328 +C The\sOPFLAG_SEEKEQ\soptimization\sis\sonly\sapplicable\sto\sequality\scomparisons\nagainst\san\sindex,\snot\sagainst\sa\srowid\stable. +D 2015-11-07T01:19:00.997 F Makefile.in 3a705bb4bd12e194212ddbdbf068310d17153cdb F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 702d3e98f3afc6587a78481257f3c4c900efc3a4 @@ -403,7 +403,7 @@ F src/update.c 40e51cd0883cb5bfd6abb7d8a7cd8aa47fab2945 F src/utf.c fc6b889ba0779b7722634cdeaa25f1930d93820c F src/util.c fc612367108b74573c5fd13a85d0a23027f438bd F src/vacuum.c 2ddd5cad2a7b9cef7f9e431b8c7771634c6b1701 -F src/vdbe.c a9b0ec9f8df86a805d593b625d1f21a8e71dcda5 +F src/vdbe.c 7a9b18027414368d800716e6319e2acd699c70db F src/vdbe.h efb7a8c1459e31f3ea4377824c6a7e4cb5068637 F src/vdbeInt.h 33403622c6a8feaaac5f0f3f17f5d1bf6df42286 F src/vdbeapi.c 020681b943e77766b32ae1cddf86d7831b7374ca @@ -1400,7 +1400,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P d741e1ccdce96e6142e294fbdd20a0282296dcea -R 09ac306f39fb272ed95e60baefe78a45 +P dd9a26ecdeaef7b0b9cbf4ff70448ab13a276b4e +R 37fd8f25666e5cc61c467cdb94b7bb71 U drh -Z d2d47fc2f78320b8e866fa5d7ad2519b +Z b3bf4f06c783a2156de71d3cb1963976 diff --git a/manifest.uuid b/manifest.uuid index e3b122df6d..f7a057f393 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -dd9a26ecdeaef7b0b9cbf4ff70448ab13a276b4e \ No newline at end of file +0f5b147d1fe83c34d0fbeacc7422be94d8441bc1 \ No newline at end of file diff --git a/src/vdbe.c b/src/vdbe.c index bfbb7e0195..d13655d9c1 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -3681,7 +3681,7 @@ case OP_SeekGT: { /* jump, in3 */ UnpackedRecord r; /* The key to seek for */ int nField; /* Number of columns or fields in the key */ i64 iKey; /* The rowid we are to seek to */ - int eqOnly = 0; /* Only interested in == results */ + int eqOnly; /* Only interested in == results */ assert( pOp->p1>=0 && pOp->p1nCursor ); assert( pOp->p2!=0 ); @@ -3694,26 +3694,16 @@ case OP_SeekGT: { /* jump, in3 */ assert( pC->isOrdered ); assert( pC->pCursor!=0 ); oc = pOp->opcode; + eqOnly = 0; pC->nullRow = 0; #ifdef SQLITE_DEBUG pC->seekOp = pOp->opcode; #endif - /* For a cursor with the BTREE_SEEK_EQ hint, only the OP_SeekGE and - ** OP_SeekLE opcodes are allowed, and these must be immediately followed - ** by an OP_IdxGT or OP_IdxLT opcode, respectively, with the same key. - */ - if( sqlite3BtreeCursorHasHint(pC->pCursor, BTREE_SEEK_EQ) ){ - eqOnly = 1; - assert( pOp->opcode==OP_SeekGE || pOp->opcode==OP_SeekLE ); - assert( pOp[1].opcode==OP_IdxLT || pOp[1].opcode==OP_IdxGT ); - assert( pOp[1].p1==pOp[0].p1 ); - assert( pOp[1].p2==pOp[0].p2 ); - assert( pOp[1].p3==pOp[0].p3 ); - assert( pOp[1].p4.i==pOp[0].p4.i ); - } - if( pC->isTable ){ + /* The BTREE_SEEK_EQ flag is only set on index cursors */ + assert( sqlite3BtreeCursorHasHint(pC->pCursor, BTREE_SEEK_EQ)==0 ); + /* The input value in P3 might be of any type: integer, real, string, ** blob, or NULL. But it needs to be an integer before we can do ** the seek, so convert it. */ @@ -3761,8 +3751,21 @@ case OP_SeekGT: { /* jump, in3 */ if( rc!=SQLITE_OK ){ goto abort_due_to_error; } - if( eqOnly && res ) goto seek_not_found; }else{ + /* For a cursor with the BTREE_SEEK_EQ hint, only the OP_SeekGE and + ** OP_SeekLE opcodes are allowed, and these must be immediately followed + ** by an OP_IdxGT or OP_IdxLT opcode, respectively, with the same key. + */ + if( sqlite3BtreeCursorHasHint(pC->pCursor, BTREE_SEEK_EQ) ){ + eqOnly = 1; + assert( pOp->opcode==OP_SeekGE || pOp->opcode==OP_SeekLE ); + assert( pOp[1].opcode==OP_IdxLT || pOp[1].opcode==OP_IdxGT ); + assert( pOp[1].p1==pOp[0].p1 ); + assert( pOp[1].p2==pOp[0].p2 ); + assert( pOp[1].p3==pOp[0].p3 ); + assert( pOp[1].p4.i==pOp[0].p4.i ); + } + nField = pOp->p4.i; assert( pOp->p4type==P4_INT32 ); assert( nField>0 );