1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Merge the latest trunk changes into the stat3-trunk branch.

FossilOrigin-Name: 0beb88a92c8f75231df120bef54616c7e4bb68c8
This commit is contained in:
drh
2011-09-23 14:40:31 +00:00
24 changed files with 465 additions and 568 deletions

View File

@@ -885,18 +885,16 @@ soaktest: testfixture$(TEXE) sqlite3$(TEXE)
test: testfixture$(TEXE) sqlite3$(TEXE) test: testfixture$(TEXE) sqlite3$(TEXE)
./testfixture$(TEXE) $(TOP)/test/veryquick.test ./testfixture$(TEXE) $(TOP)/test/veryquick.test
sqlite3_analyzer$(TEXE): $(TESTFIXTURE_SRC) $(TOP)/tool/spaceanal.tcl sqlite3_analyzer.c: sqlite3.c $(TOP)/src/test_stat.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl
sed \ echo "#define TCLSH 2" > $@
-e '/^#/d' \ cat sqlite3.c $(TOP)/src/test_stat.c $(TOP)/src/tclsqlite.c >> $@
-e 's,\\,\\\\,g' \ echo "static const char *tclsh_main_loop(void){" >> $@
-e 's,",\\",g' \ echo "static const char *zMainloop = " >> $@
-e 's,^,",' \ $(NAWK) -f $(TOP)/tool/tostr.awk $(TOP)/tool/spaceanal.tcl >> $@
-e 's,$$,\\n",' \ echo "; return zMainloop; }" >> $@
$(TOP)/tool/spaceanal.tcl >spaceanal_tcl.h
$(LTLINK) -DTCLSH=2 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1 \
-DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE \
$(TEMP_STORE) -o $@ $(TESTFIXTURE_SRC) $(LIBTCL) $(TLIBS)
sqlite3_analyzer$(TEXE): sqlite3_analyzer.c
$(LTLINK) sqlite3_analyzer.c -o $@ $(LIBTCL) $(TLIBS)
# Standard install and cleanup targets # Standard install and cleanup targets
# #
@@ -930,9 +928,11 @@ clean:
rm -f $(PUBLISH) rm -f $(PUBLISH)
rm -f *.da *.bb *.bbg gmon.out rm -f *.da *.bb *.bbg gmon.out
rm -rf tsrc .target_source rm -rf tsrc .target_source
rm -f tclsqlite3$(TEXE)
rm -f testfixture$(TEXE) test.db rm -f testfixture$(TEXE) test.db
rm -f sqlite3.dll sqlite3.lib sqlite3.def rm -f sqlite3.dll sqlite3.lib sqlite3.exp sqlite3.def
rm -f sqlite3.c rm -f sqlite3.c
rm -f sqlite3_analyzer$(TEXE) sqlite3_analyzer.c
distclean: clean distclean: clean
rm -f config.log config.status libtool Makefile sqlite3.pc rm -f config.log config.status libtool Makefile sqlite3.pc

View File

@@ -926,15 +926,15 @@ soaktest: testfixture.exe sqlite3.exe
test: testfixture.exe sqlite3.exe test: testfixture.exe sqlite3.exe
.\testfixture.exe $(TOP)\test\veryquick.test .\testfixture.exe $(TOP)\test\veryquick.test
spaceanal_tcl.h: $(TOP)\tool\spaceanal.tcl sqlite3_analyzer.c: sqlite3.c $(TOP)\src\test_stat.c $(TOP)\src\tclsqlite.c $(TOP)\tool\spaceanal.tcl
$(NAWK) -f $(TOP)/tool/tostr.awk \ copy sqlite3.c + $(TOP)\src\test_stat.c + $(TOP)\src\tclsqlite.c $@
$(TOP)\tool\spaceanal.tcl > spaceanal_tcl.h echo static const char *tclsh_main_loop(void){ >> $@
echo static const char *zMainloop = >> $@
$(NAWK) -f $(TOP)\tool\tostr.awk $(TOP)\tool\spaceanal.tcl >> $@
echo ; return zMainloop; } >> $@
sqlite3_analyzer.exe: $(TESTFIXTURE_SRC) spaceanal_tcl.h sqlite3_analyzer.exe: sqlite3_analyzer.c
$(LTLINK) -DTCLSH=2 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1 \ $(LTLINK) -DBUILD_sqlite -DTCLSH=2 -I$(TCLINCDIR) sqlite3_analyzer.c \
-DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE \
-DBUILD_sqlite -I$(TCLINCDIR) \
$(TESTFIXTURE_SRC) \
/link $(LTLINKOPTS) /LIBPATH:$(TCLLIBDIR) $(LIBTCL) $(TLIBS) /link $(LTLINKOPTS) /LIBPATH:$(TCLLIBDIR) $(LIBTCL) $(TLIBS)
clean: clean:
@@ -944,10 +944,11 @@ clean:
del /Q mkkeywordhash.exe keywordhash.h del /Q mkkeywordhash.exe keywordhash.h
-rmdir /Q/S tsrc -rmdir /Q/S tsrc
del /Q .target_source del /Q .target_source
del /Q tclsqlite3.exe
del /Q testfixture.exe testfixture.exp test.db del /Q testfixture.exe testfixture.exp test.db
del /Q sqlite3.dll sqlite3.lib sqlite3.exp sqlite3.def del /Q sqlite3.dll sqlite3.lib sqlite3.exp sqlite3.def
del /Q sqlite3.c del /Q sqlite3.c
del /Q sqlite3_analyzer.exe sqlite3_analyzer.exp spaceanal_tcl.h del /Q sqlite3_analyzer.exe sqlite3_analyzer.exp sqlite3_analyzer.c
# #
# Windows section # Windows section

View File

@@ -1 +1 @@
3.7.8 3.7.9

374
configure vendored

File diff suppressed because it is too large Load Diff

27
main.mk
View File

@@ -518,6 +518,16 @@ tclsqlite3: $(TOP)/src/tclsqlite.c libsqlite3.a
$(TCCX) $(TCL_FLAGS) -DTCLSH=1 -o tclsqlite3 \ $(TCCX) $(TCL_FLAGS) -DTCLSH=1 -o tclsqlite3 \
$(TOP)/src/tclsqlite.c libsqlite3.a $(LIBTCL) $(THREADLIB) $(TOP)/src/tclsqlite.c libsqlite3.a $(LIBTCL) $(THREADLIB)
sqlite3_analyzer.c: sqlite3.c $(TOP)/src/test_stat.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl
echo "#define TCLSH 2" > $@
cat sqlite3.c $(TOP)/src/test_stat.c $(TOP)/src/tclsqlite.c >> $@
echo "static const char *tclsh_main_loop(void){" >> $@
echo "static const char *zMainloop = " >> $@
$(NAWK) -f $(TOP)/tool/tostr.awk $(TOP)/tool/spaceanal.tcl >> $@
echo "; return zMainloop; }" >> $@
sqlite3_analyzer$(EXE): sqlite3_analyzer.c
$(TCCX) $(TCL_FLAGS) sqlite3_analyzer.c -o $@ $(LIBTCL) $(THREADLIB)
# Rules to build the 'testfixture' application. # Rules to build the 'testfixture' application.
# #
@@ -560,16 +570,6 @@ threadtest3$(EXE): sqlite3.o $(TOP)/test/threadtest3.c $(TOP)/test/tt3_checkpoin
threadtest: threadtest3$(EXE) threadtest: threadtest3$(EXE)
./threadtest3$(EXE) ./threadtest3$(EXE)
sqlite3_analyzer$(EXE): $(TOP)/src/tclsqlite.c sqlite3.c $(TESTSRC) \
$(TOP)/tool/spaceanal.tcl
$(NAWK) -f $(TOP)/tool/tostr.awk $(TOP)/tool/spaceanal.tcl \
>spaceanal_tcl.h
$(TCCX) $(TCL_FLAGS) -DTCLSH=2 $(TESTFIXTURE_FLAGS) \
-DSQLITE_TEST=1 -DSQLITE_PRIVATE="" \
$(TESTSRC) $(TOP)/src/tclsqlite.c sqlite3.c \
-o sqlite3_analyzer$(EXE) \
$(LIBTCL) $(THREADLIB)
TEST_EXTENSION = $(SHPREFIX)testloadext.$(SO) TEST_EXTENSION = $(SHPREFIX)testloadext.$(SO)
$(TEST_EXTENSION): $(TOP)/src/test_loadext.c $(TEST_EXTENSION): $(TOP)/src/test_loadext.c
$(MKSHLIB) $(TOP)/src/test_loadext.c -o $(TEST_EXTENSION) $(MKSHLIB) $(TOP)/src/test_loadext.c -o $(TEST_EXTENSION)
@@ -593,10 +593,15 @@ install: sqlite3 libsqlite3.a sqlite3.h
mv sqlite3.h /usr/include mv sqlite3.h /usr/include
clean: clean:
rm -f *.o sqlite3 libsqlite3.a sqlite3.h opcodes.* rm -f *.o sqlite3 sqlite3.exe libsqlite3.a sqlite3.h opcodes.*
rm -f lemon lempar.c parse.* sqlite*.tar.gz mkkeywordhash keywordhash.h rm -f lemon lempar.c parse.* sqlite*.tar.gz mkkeywordhash keywordhash.h
rm -f $(PUBLISH) rm -f $(PUBLISH)
rm -f *.da *.bb *.bbg gmon.out rm -f *.da *.bb *.bbg gmon.out
rm -rf tsrc target_source rm -rf tsrc target_source
rm -f testloadext.dll libtestloadext.so rm -f testloadext.dll libtestloadext.so
rm -f amalgamation-testfixture amalgamation-testfixture.exe
rm -f fts3-testfixture fts3-testfixture.exe
rm -f testfixture testfixture.exe
rm -f threadtest3 threadtest3.exe
rm -f sqlite3.c fts?amal.c tclsqlite3.c rm -f sqlite3.c fts?amal.c tclsqlite3.c
rm -f sqlite3_analyzer sqlite3_analyzer.exe sqlite3_analyzer.c

View File

@@ -1,12 +1,12 @@
C Testability\senhancements. C Merge\sthe\slatest\strunk\schanges\sinto\sthe\sstat3-trunk\sbranch.
D 2011-09-23T13:59:33.693 D 2011-09-23T14:40:31.864
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in d314143fa6be24828021d3f583ad37d9afdce505 F Makefile.in 8de00a4e52f308ef6d564834c0973e53646e0d4c
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F Makefile.msc b5e917439d5ed42364173d1648aae1d418e323ea F Makefile.msc 6676bcfe711f621a0b1916ecfa5d0927f8084517
F Makefile.vxworks 1deb39c8bb047296c30161ffa10c1b5423e632f9 F Makefile.vxworks 1deb39c8bb047296c30161ffa10c1b5423e632f9
F README cd04a36fbc7ea56932a4052d7d0b7f09f27c33d6 F README cd04a36fbc7ea56932a4052d7d0b7f09f27c33d6
F VERSION f724de7326e87b7f3b0a55f16ef4b4d993680d54 F VERSION bb37c274b503bbe73f00ea4f374eb817cba4b171
F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50
F addopcodes.awk 17dc593f791f874d2c23a0f9360850ded0286531 F addopcodes.awk 17dc593f791f874d2c23a0f9360850ded0286531
F art/2005osaward.gif 0d1851b2a7c1c9d0ccce545f3e14bca42d7fd248 F art/2005osaward.gif 0d1851b2a7c1c9d0ccce545f3e14bca42d7fd248
@@ -23,7 +23,7 @@ F art/src_logo.gif 9341ef09f0e53cd44c0c9b6fc3c16f7f3d6c2ad9
F config.guess 226d9a188c6196f3033ffc651cbc9dcee1a42977 F config.guess 226d9a188c6196f3033ffc651cbc9dcee1a42977
F config.h.in 405a958bdb3af382a809dccb08a44694923ddd61 F config.h.in 405a958bdb3af382a809dccb08a44694923ddd61
F config.sub 9ebe4c3b3dab6431ece34f16828b594fb420da55 F config.sub 9ebe4c3b3dab6431ece34f16828b594fb420da55
F configure 4010a2e577b7d43c429672858d442ac5a570fdcd x F configure 806c06aef5895860da49600ce098dbe4d5a8435c x
F configure.ac 298a759c086e72c013da459c2aec02a104f4224f F configure.ac 298a759c086e72c013da459c2aec02a104f4224f
F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad
F doc/lemon.html 3091574143dd3415669b6745843ff8d011d33549 F doc/lemon.html 3091574143dd3415669b6745843ff8d011d33549
@@ -104,7 +104,7 @@ F ext/rtree/tkt3363.test 142ab96eded44a3615ec79fba98c7bde7d0f96de
F ext/rtree/viewrtree.tcl eea6224b3553599ae665b239bd827e182b466024 F ext/rtree/viewrtree.tcl eea6224b3553599ae665b239bd827e182b466024
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8 F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
F main.mk 8744cb76517817170f7fd2c78fbf0006fabb93c1 F main.mk aa43670ca62ce7a3f4d80a5f8980c9a9ad076903
F mkdll.sh 7d09b23c05d56532e9d44a50868eb4b12ff4f74a F mkdll.sh 7d09b23c05d56532e9d44a50868eb4b12ff4f74a
F mkextu.sh 416f9b7089d80e5590a29692c9d9280a10dbad9f F mkextu.sh 416f9b7089d80e5590a29692c9d9280a10dbad9f
F mkextw.sh 4123480947681d9b434a5e7b1ee08135abe409ac F mkextw.sh 4123480947681d9b434a5e7b1ee08135abe409ac
@@ -130,7 +130,7 @@ F src/btreeInt.h 67978c014fa4f7cc874032dd3aacadd8db656bc3
F src/build.c 2dc09385981bf7f41eae7d3aeb47cb2453813456 F src/build.c 2dc09385981bf7f41eae7d3aeb47cb2453813456
F src/callback.c 0425c6320730e6d3981acfb9202c1bed9016ad1a F src/callback.c 0425c6320730e6d3981acfb9202c1bed9016ad1a
F src/complete.c dc1d136c0feee03c2f7550bafc0d29075e36deac F src/complete.c dc1d136c0feee03c2f7550bafc0d29075e36deac
F src/ctime.c dde6a9b835b9e8cc067b713de1a7f6a0c9ff807e F src/ctime.c 829f3261d3db48e3d87891bc887208734734c2e4
F src/date.c a3c6842bad7ae632281811de112a8ba63ff08ab3 F src/date.c a3c6842bad7ae632281811de112a8ba63ff08ab3
F src/delete.c ff68e5ef23aee08c0ff528f699a19397ed8bbed8 F src/delete.c ff68e5ef23aee08c0ff528f699a19397ed8bbed8
F src/expr.c f4dcaeb8252c4b16fcdc245660f70ed366bc6cdd F src/expr.c f4dcaeb8252c4b16fcdc245660f70ed366bc6cdd
@@ -167,12 +167,12 @@ F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440 F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440
F src/os_unix.c 10e0c4dcdbec8d4189890fdf3e71b32efae194e3 F src/os_unix.c 10e0c4dcdbec8d4189890fdf3e71b32efae194e3
F src/os_win.c 0fc0f46c94b0385a940b0ee32992a833019a5985 F src/os_win.c 0fc0f46c94b0385a940b0ee32992a833019a5985
F src/pager.c 15d10371e2d560b68870a9ccec022ad8f01e70a2 F src/pager.c 8a6ac3e0d9694412076e2273e3c81e9c4e08758f
F src/pager.h 3f8c783de1d4706b40b1ac15b64f5f896bcc78d1 F src/pager.h dbcaa791e8b6c3a6b77c168c5c27deec289fb176
F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58 F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58
F src/pcache.c 49e718c095810c6b3334e3a6d89970aceaddefce F src/pcache.c 49e718c095810c6b3334e3a6d89970aceaddefce
F src/pcache.h c683390d50f856d4cd8e24342ae62027d1bb6050 F src/pcache.h c683390d50f856d4cd8e24342ae62027d1bb6050
F src/pcache1.c c8982f7048a70b7fd37975a8f6c84d6bc294175a F src/pcache1.c 24f5e85a78514584b46190260ba7ab0a66312197
F src/pragma.c ebcd20f1e654f5cb3aeef864ed69c4697719fbaa F src/pragma.c ebcd20f1e654f5cb3aeef864ed69c4697719fbaa
F src/prepare.c e64261559a3187698a3e7e6c8b001a4f4f98dab4 F src/prepare.c e64261559a3187698a3e7e6c8b001a4f4f98dab4
F src/printf.c 585a36b6a963df832cfb69505afa3a34ed5ef8a1 F src/printf.c 585a36b6a963df832cfb69505afa3a34ed5ef8a1
@@ -181,13 +181,13 @@ F src/resolve.c 36368f44569208fa074e61f4dd0b6c4fb60ca2b4
F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697 F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697
F src/select.c d9b7d20b0365f80761846f00ef3638d4b33eeaf2 F src/select.c d9b7d20b0365f80761846f00ef3638d4b33eeaf2
F src/shell.c 13fe2aeddc3cc90d6a273831d1f63736d1596f81 F src/shell.c 13fe2aeddc3cc90d6a273831d1f63736d1596f81
F src/sqlite.h.in 3f531daa04457e83bc13765c98c06c7d71c27fa5 F src/sqlite.h.in 3b238342522bfc3b9d68d7ff3240a27a2a59ee59
F src/sqlite3ext.h 1a1a4f784aa9c3b00edd287940197de52487cd93 F src/sqlite3ext.h 1a1a4f784aa9c3b00edd287940197de52487cd93
F src/sqliteInt.h 28cca77ebdaf6025ae5df52717dff429c7c6d4ef F src/sqliteInt.h 28cca77ebdaf6025ae5df52717dff429c7c6d4ef
F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d
F src/status.c 7ac64842c86cec2fc1a1d0e5c16d3beb8ad332bf F src/status.c 4568e72dfd36b6a5911f93457364deb072e0b03a
F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e
F src/tclsqlite.c 3ef1dda2f1dc207c792eaadebf9d8adc44648581 F src/tclsqlite.c 20578e66dda94b4d4db3d4478644a4dd9c6084a6
F src/test1.c 0f41b7c67719207a5de24b009e172c4dcf189827 F src/test1.c 0f41b7c67719207a5de24b009e172c4dcf189827
F src/test2.c 80d323d11e909cf0eb1b6fbb4ac22276483bcf31 F src/test2.c 80d323d11e909cf0eb1b6fbb4ac22276483bcf31
F src/test3.c 124ff9735fb6bb7d41de180d6bac90e7b1509432 F src/test3.c 124ff9735fb6bb7d41de180d6bac90e7b1509432
@@ -201,7 +201,7 @@ F src/test_async.c 0612a752896fad42d55c3999a5122af10dcf22ad
F src/test_autoext.c 30e7bd98ab6d70a62bb9ba572e4c7df347fe645e F src/test_autoext.c 30e7bd98ab6d70a62bb9ba572e4c7df347fe645e
F src/test_backup.c c129c91127e9b46e335715ae2e75756e25ba27de F src/test_backup.c c129c91127e9b46e335715ae2e75756e25ba27de
F src/test_btree.c 47cd771250f09cdc6e12dda5bc71bc0b3abc96e2 F src/test_btree.c 47cd771250f09cdc6e12dda5bc71bc0b3abc96e2
F src/test_config.c afc0bbf8fe048d79ae03469542e826c76a2175e5 F src/test_config.c 6b1b69da02eb9a19330d8c2c33403c6eafbc3416
F src/test_demovfs.c 20a4975127993f4959890016ae9ce5535a880094 F src/test_demovfs.c 20a4975127993f4959890016ae9ce5535a880094
F src/test_devsym.c e7498904e72ba7491d142d5c83b476c4e76993bc F src/test_devsym.c e7498904e72ba7491d142d5c83b476c4e76993bc
F src/test_func.c cbdec5cededa0761daedde5baf06004a9bf416b5 F src/test_func.c cbdec5cededa0761daedde5baf06004a9bf416b5
@@ -212,7 +212,7 @@ F src/test_intarray.c d879bbf8e4ce085ab966d1f3c896a7c8b4f5fc99
F src/test_intarray.h 489edb9068bb926583445cb02589344961054207 F src/test_intarray.h 489edb9068bb926583445cb02589344961054207
F src/test_journal.c 03313c693cca72959dcaaf79f8d76f21c01e19ff F src/test_journal.c 03313c693cca72959dcaaf79f8d76f21c01e19ff
F src/test_loadext.c df586c27176e3c2cb2e099c78da67bf14379a56e F src/test_loadext.c df586c27176e3c2cb2e099c78da67bf14379a56e
F src/test_malloc.c 91d5cf1751d3e563754fd183da1c020727b5480e F src/test_malloc.c 8d416f29ad8573f32601f6056c9d2b17472e9ad5
F src/test_multiplex.c 3fc368022c46fe44ec22c5e1ed727223a54a6a1d F src/test_multiplex.c 3fc368022c46fe44ec22c5e1ed727223a54a6a1d
F src/test_multiplex.h e99c571bc4968b7a9363b661481f3934bfead61d F src/test_multiplex.h e99c571bc4968b7a9363b661481f3934bfead61d
F src/test_mutex.c a6bd7b9cf6e19d989e31392b06ac8d189f0d573e F src/test_mutex.c a6bd7b9cf6e19d989e31392b06ac8d189f0d573e
@@ -223,7 +223,7 @@ F src/test_quota.c a391c866217e92986c6f523f05b08aa6956c8419
F src/test_rtree.c 6d06306e29946dc36f528a3a2cdc3add794656f1 F src/test_rtree.c 6d06306e29946dc36f528a3a2cdc3add794656f1
F src/test_schema.c 8c06ef9ddb240c7a0fcd31bc221a6a2aade58bf0 F src/test_schema.c 8c06ef9ddb240c7a0fcd31bc221a6a2aade58bf0
F src/test_server.c 2f99eb2837dfa06a4aacf24af24c6affdf66a84f F src/test_server.c 2f99eb2837dfa06a4aacf24af24c6affdf66a84f
F src/test_stat.c f682704b5d1ba8e1d4e7e882a6d7922e2dcf066c F src/test_stat.c 5bf0dcd0ffa469b2326d90f4a6e52d83e3f2df07
F src/test_superlock.c 2b97936ca127d13962c3605dbc9a4ef269c424cd F src/test_superlock.c 2b97936ca127d13962c3605dbc9a4ef269c424cd
F src/test_syscall.c a992d8c80ea91fbf21fb2dd570db40e77dd7e6ae F src/test_syscall.c a992d8c80ea91fbf21fb2dd570db40e77dd7e6ae
F src/test_tclvar.c f4dc67d5f780707210d6bb0eb6016a431c04c7fa F src/test_tclvar.c f4dc67d5f780707210d6bb0eb6016a431c04c7fa
@@ -346,7 +346,7 @@ F test/corruptA.test fafa652aa585753be4f6b62ff0bb250266eaf7ce
F test/corruptB.test 20d4a20cbed23958888c3e8995b424a47223d647 F test/corruptB.test 20d4a20cbed23958888c3e8995b424a47223d647
F test/corruptC.test 62a767fe64acb1975f58cc6171192839c783edbb F test/corruptC.test 62a767fe64acb1975f58cc6171192839c783edbb
F test/corruptD.test 99b1999dbfa7cc04aaeac9d695a2445d4e7c7458 F test/corruptD.test 99b1999dbfa7cc04aaeac9d695a2445d4e7c7458
F test/corruptE.test 78f7e1b9fd4a92e5951c7a5e414f2c4492733870 F test/corruptE.test 1b9eb20a8711251ce57b44a257e241085b39b52d
F test/count.test 454e1ce985c94d13efeac405ce54439f49336163 F test/count.test 454e1ce985c94d13efeac405ce54439f49336163
F test/crash.test 519dc29f6fea151f015a23236e555239353946eb F test/crash.test 519dc29f6fea151f015a23236e555239353946eb
F test/crash2.test 5b14d4eb58b880e231361d3b609b216acda86651 F test/crash2.test 5b14d4eb58b880e231361d3b609b216acda86651
@@ -359,9 +359,10 @@ F test/crash8.test 38767cb504bbe491de6be4a7006b154973a2309f
F test/crashtest1.c 09c1c7d728ccf4feb9e481671e29dda5669bbcc2 F test/crashtest1.c 09c1c7d728ccf4feb9e481671e29dda5669bbcc2
F test/createtab.test b5de160630b209c4b8925bdcbbaf48cc90b67fe8 F test/createtab.test b5de160630b209c4b8925bdcbbaf48cc90b67fe8
F test/cse.test 277350a26264495e86b1785f34d2d0c8600e021c F test/cse.test 277350a26264495e86b1785f34d2d0c8600e021c
F test/ctime.test 7f0bd5084d9dd7da9ad46901810896edd2ebb463 F test/ctime.test 7bd009071e242aac4f18521581536b652b789a47
F test/date.test a18a2ce81add84b17b06559e82ad7bb91bc6ddff F test/date.test a18a2ce81add84b17b06559e82ad7bb91bc6ddff
F test/dbstatus.test 9eb484ba837c6f3f9bbcaecc29e6060a8c3ba6d2 F test/dbstatus.test 9eb484ba837c6f3f9bbcaecc29e6060a8c3ba6d2
F test/dbstatus2.test dc57b0d9610851c0ff58a8e1b5b191678398b72a
F test/default.test 6faf23ccb300114924353007795aa9a8ec0aa9dc F test/default.test 6faf23ccb300114924353007795aa9a8ec0aa9dc
F test/delete.test a065b05d2ebf60fd16639c579a4adfb7c381c701 F test/delete.test a065b05d2ebf60fd16639c579a4adfb7c381c701
F test/delete2.test 3a03f2cca1f9a67ec469915cb8babd6485db43fa F test/delete2.test 3a03f2cca1f9a67ec469915cb8babd6485db43fa
@@ -584,9 +585,9 @@ F test/mallocK.test d79968641d1b70d88f6c01bdb9a7eb4a55582cc9
F test/malloc_common.tcl 2930895b0962823ec679853e67e58dd6d8198b3c F test/malloc_common.tcl 2930895b0962823ec679853e67e58dd6d8198b3c
F test/manydb.test 28385ae2087967aa05c38624cec7d96ec74feb3e F test/manydb.test 28385ae2087967aa05c38624cec7d96ec74feb3e
F test/mem5.test c6460fba403c5703141348cd90de1c294188c68f F test/mem5.test c6460fba403c5703141348cd90de1c294188c68f
F test/memdb.test 4b5d2671588ed59cb08642adc67fd78c666dc9c2 F test/memdb.test 708a028d6d373e5b3842e4bdc8ba80998c9a4da6
F test/memleak.test 10b9c6c57e19fc68c32941495e9ba1c50123f6e2 F test/memleak.test 10b9c6c57e19fc68c32941495e9ba1c50123f6e2
F test/memsubsys1.test 39f1ddddf76ce51a3232aab0279668e23cf00f83 F test/memsubsys1.test 16ce163ac1ace3d71bf0eaa6a821ed153addd91f
F test/memsubsys2.test 3a1c1a9de48e5726faa85108b02459fae8cb9ee9 F test/memsubsys2.test 3a1c1a9de48e5726faa85108b02459fae8cb9ee9
F test/minmax.test 722d80816f7e096bf2c04f4111f1a6c1ba65453d F test/minmax.test 722d80816f7e096bf2c04f4111f1a6c1ba65453d
F test/minmax2.test 33504c01a03bd99226144e4b03f7631a274d66e0 F test/minmax2.test 33504c01a03bd99226144e4b03f7631a274d66e0
@@ -619,7 +620,7 @@ F test/pagerfault3.test f16e2efcb5fc9996d1356f7cbc44c998318ae1d7
F test/pageropt.test 8146bf448cf09e87bb1867c2217b921fb5857806 F test/pageropt.test 8146bf448cf09e87bb1867c2217b921fb5857806
F test/pagesize.test 1dd51367e752e742f58e861e65ed7390603827a0 F test/pagesize.test 1dd51367e752e742f58e861e65ed7390603827a0
F test/pcache.test 065aa286e722ab24f2e51792c1f093bf60656b16 F test/pcache.test 065aa286e722ab24f2e51792c1f093bf60656b16
F test/pcache2.test bc67c6802989dba05cdf3a4574fd882e238c7ecf F test/pcache2.test a83efe2dec0d392f814bfc998def1d1833942025
F test/permutations.test ad17319066a90e2db71823c3ff104795ffc71b31 F test/permutations.test ad17319066a90e2db71823c3ff104795ffc71b31
F test/pragma.test c8108e01da04f16e67e5754e610bc62c1b993f6c F test/pragma.test c8108e01da04f16e67e5754e610bc62c1b993f6c
F test/pragma2.test 3a55f82b954242c642f8342b17dffc8b47472947 F test/pragma2.test 3a55f82b954242c642f8342b17dffc8b47472947
@@ -954,7 +955,7 @@ F tool/showjournal.c b62cecaab86a4053d944c276bb5232e4d17ece02
F tool/showwal.c f09e5a80a293919290ec85a6a37c85a5ddcf37d9 F tool/showwal.c f09e5a80a293919290ec85a6a37c85a5ddcf37d9
F tool/soak1.tcl 8d407956e1a45b485a8e072470a3e629a27037fe F tool/soak1.tcl 8d407956e1a45b485a8e072470a3e629a27037fe
F tool/space_used.tcl f714c41a59e326b8b9042f415b628b561bafa06b F tool/space_used.tcl f714c41a59e326b8b9042f415b628b561bafa06b
F tool/spaceanal.tcl fe02dede3d29ef0fefcf80a685644fdf4d9a768e F tool/spaceanal.tcl 537f35d9e432695990ec855314d72eba9b999fe4
F tool/speedtest.tcl 06c76698485ccf597b9e7dbb1ac70706eb873355 F tool/speedtest.tcl 06c76698485ccf597b9e7dbb1ac70706eb873355
F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81 F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
@@ -965,7 +966,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5
F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06 F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
P 74e27fad339a2d7899c1f42805e615128929f07a P be44928cf2a3c063c8228b769d90947acbfad1ef 6d8d4e1694694c3e961fc1922f732d1da40caa6f
R 2a02eac3daaa0669ad4c98fbdd4d2386 R d77ad79f371c48e48b75d0b9ae4d6798
U drh U drh
Z 0b4e185fe7f24f4f88a2a412ad76b268 Z 325ba8d2018722c1460e52f95a5b9a1a

View File

@@ -1 +1 @@
be44928cf2a3c063c8228b769d90947acbfad1ef 0beb88a92c8f75231df120bef54616c7e4bb68c8

View File

@@ -332,9 +332,6 @@ static const char * const azCompileOpt[] = {
#ifdef SQLITE_OMIT_XFER_OPT #ifdef SQLITE_OMIT_XFER_OPT
"OMIT_XFER_OPT", "OMIT_XFER_OPT",
#endif #endif
#ifdef SQLITE_PAGECACHE_BLOCKALLOC
"PAGECACHE_BLOCKALLOC",
#endif
#ifdef SQLITE_PERFORMANCE_TRACE #ifdef SQLITE_PERFORMANCE_TRACE
"PERFORMANCE_TRACE", "PERFORMANCE_TRACE",
#endif #endif

View File

@@ -670,8 +670,8 @@ struct Pager {
char *zJournal; /* Name of the journal file */ char *zJournal; /* Name of the journal file */
int (*xBusyHandler)(void*); /* Function to call when busy */ int (*xBusyHandler)(void*); /* Function to call when busy */
void *pBusyHandlerArg; /* Context argument for xBusyHandler */ void *pBusyHandlerArg; /* Context argument for xBusyHandler */
int nHit, nMiss; /* Total cache hits and misses */
#ifdef SQLITE_TEST #ifdef SQLITE_TEST
int nHit, nMiss; /* Cache hits and missing */
int nRead, nWrite; /* Database pages read/written */ int nRead, nWrite; /* Database pages read/written */
#endif #endif
void (*xReiniter)(DbPage*); /* Call this routine when reloading pages */ void (*xReiniter)(DbPage*); /* Call this routine when reloading pages */
@@ -4169,7 +4169,7 @@ static int pagerStress(void *p, PgHdr *pPg){
** **
** Spilling is also prohibited when in an error state since that could ** Spilling is also prohibited when in an error state since that could
** lead to database corruption. In the current implementaton it ** lead to database corruption. In the current implementaton it
** is impossible for sqlite3PCacheFetch() to be called with createFlag==1 ** is impossible for sqlite3PcacheFetch() to be called with createFlag==1
** while in the error state, hence it is impossible for this routine to ** while in the error state, hence it is impossible for this routine to
** be called in the error state. Nevertheless, we include a NEVER() ** be called in the error state. Nevertheless, we include a NEVER()
** test for the error state as a safeguard against future changes. ** test for the error state as a safeguard against future changes.
@@ -5005,14 +5005,13 @@ int sqlite3PagerAcquire(
/* In this case the pcache already contains an initialized copy of /* In this case the pcache already contains an initialized copy of
** the page. Return without further ado. */ ** the page. Return without further ado. */
assert( pgno<=PAGER_MAX_PGNO && pgno!=PAGER_MJ_PGNO(pPager) ); assert( pgno<=PAGER_MAX_PGNO && pgno!=PAGER_MJ_PGNO(pPager) );
PAGER_INCR(pPager->nHit); pPager->nHit++;
return SQLITE_OK; return SQLITE_OK;
}else{ }else{
/* The pager cache has created a new page. Its content needs to /* The pager cache has created a new page. Its content needs to
** be initialized. */ ** be initialized. */
PAGER_INCR(pPager->nMiss);
pPg = *ppPage; pPg = *ppPage;
pPg->pPager = pPager; pPg->pPager = pPager;
@@ -5048,6 +5047,7 @@ int sqlite3PagerAcquire(
IOTRACE(("ZERO %p %d\n", pPager, pgno)); IOTRACE(("ZERO %p %d\n", pPager, pgno));
}else{ }else{
assert( pPg->pPager==pPager ); assert( pPg->pPager==pPager );
pPager->nMiss++;
rc = readDbPage(pPg); rc = readDbPage(pPg);
if( rc!=SQLITE_OK ){ if( rc!=SQLITE_OK ){
goto pager_acquire_err; goto pager_acquire_err;
@@ -6082,6 +6082,31 @@ int *sqlite3PagerStats(Pager *pPager){
} }
#endif #endif
/*
** Parameter eStat must be either SQLITE_DBSTATUS_CACHE_HIT or
** SQLITE_DBSTATUS_CACHE_MISS. Before returning, *pnVal is incremented by the
** current cache hit or miss count, according to the value of eStat. If the
** reset parameter is non-zero, the cache hit or miss count is zeroed before
** returning.
*/
void sqlite3PagerCacheStat(Pager *pPager, int eStat, int reset, int *pnVal){
int *piStat;
assert( eStat==SQLITE_DBSTATUS_CACHE_HIT
|| eStat==SQLITE_DBSTATUS_CACHE_MISS
);
if( eStat==SQLITE_DBSTATUS_CACHE_HIT ){
piStat = &pPager->nHit;
}else{
piStat = &pPager->nMiss;
}
*pnVal += *piStat;
if( reset ){
*piStat = 0;
}
}
/* /*
** Return true if this is an in-memory pager. ** Return true if this is an in-memory pager.
*/ */

View File

@@ -155,6 +155,7 @@ const char *sqlite3PagerJournalname(Pager*);
int sqlite3PagerNosync(Pager*); int sqlite3PagerNosync(Pager*);
void *sqlite3PagerTempSpace(Pager*); void *sqlite3PagerTempSpace(Pager*);
int sqlite3PagerIsMemdb(Pager*); int sqlite3PagerIsMemdb(Pager*);
void sqlite3PagerCacheStat(Pager *, int, int, int *);
/* Functions used to truncate the database file. */ /* Functions used to truncate the database file. */
void sqlite3PagerTruncateImage(Pager*,Pgno); void sqlite3PagerTruncateImage(Pager*,Pgno);

View File

@@ -24,8 +24,6 @@ typedef struct PgHdr1 PgHdr1;
typedef struct PgFreeslot PgFreeslot; typedef struct PgFreeslot PgFreeslot;
typedef struct PGroup PGroup; typedef struct PGroup PGroup;
typedef struct PGroupBlock PGroupBlock;
typedef struct PGroupBlockList PGroupBlockList;
/* Each page cache (or PCache) belongs to a PGroup. A PGroup is a set /* Each page cache (or PCache) belongs to a PGroup. A PGroup is a set
** of one or more PCaches that are able to recycle each others unpinned ** of one or more PCaches that are able to recycle each others unpinned
@@ -56,66 +54,8 @@ struct PGroup {
int mxPinned; /* nMaxpage + 10 - nMinPage */ int mxPinned; /* nMaxpage + 10 - nMinPage */
int nCurrentPage; /* Number of purgeable pages allocated */ int nCurrentPage; /* Number of purgeable pages allocated */
PgHdr1 *pLruHead, *pLruTail; /* LRU list of unpinned pages */ PgHdr1 *pLruHead, *pLruTail; /* LRU list of unpinned pages */
#ifdef SQLITE_PAGECACHE_BLOCKALLOC
int isBusy; /* Do not run ReleaseMemory() if true */
PGroupBlockList *pBlockList; /* List of block-lists for this group */
#endif
}; };
/*
** If SQLITE_PAGECACHE_BLOCKALLOC is defined when the library is built,
** each PGroup structure has a linked list of the the following starting
** at PGroup.pBlockList. There is one entry for each distinct page-size
** currently used by members of the PGroup (i.e. 1024 bytes, 4096 bytes
** etc.). Variable PGroupBlockList.nByte is set to the actual allocation
** size requested by each pcache, which is the database page-size plus
** the various header structures used by the pcache, pager and btree layers.
** Usually around (pgsz+200) bytes.
**
** This size (pgsz+200) bytes is not allocated efficiently by some
** implementations of malloc. In particular, some implementations are only
** able to allocate blocks of memory chunks of 2^N bytes, where N is some
** integer value. Since the page-size is a power of 2, this means we
** end up wasting (pgsz-200) bytes in each allocation.
**
** If SQLITE_PAGECACHE_BLOCKALLOC is defined, the (pgsz+200) byte blocks
** are not allocated directly. Instead, blocks of roughly M*(pgsz+200) bytes
** are requested from malloc allocator. After a block is returned,
** sqlite3MallocSize() is used to determine how many (pgsz+200) byte
** allocations can fit in the space returned by malloc(). This value may
** be more than M.
**
** The blocks are stored in a doubly-linked list. Variable PGroupBlock.nEntry
** contains the number of allocations that will fit in the aData[] space.
** nEntry is limited to the number of bits in bitmask mUsed. If a slot
** within aData is in use, the corresponding bit in mUsed is set. Thus
** when (mUsed+1==(1 << nEntry)) the block is completely full.
**
** Each time a slot within a block is freed, the block is moved to the start
** of the linked-list. And if a block becomes completely full, then it is
** moved to the end of the list. As a result, when searching for a free
** slot, only the first block in the list need be examined. If it is full,
** then it is guaranteed that all blocks are full.
*/
struct PGroupBlockList {
int nByte; /* Size of each allocation in bytes */
PGroupBlock *pFirst; /* First PGroupBlock in list */
PGroupBlock *pLast; /* Last PGroupBlock in list */
PGroupBlockList *pNext; /* Next block-list attached to group */
};
struct PGroupBlock {
Bitmask mUsed; /* Mask of used slots */
int nEntry; /* Maximum number of allocations in aData[] */
u8 *aData; /* Pointer to data block */
PGroupBlock *pNext; /* Next PGroupBlock in list */
PGroupBlock *pPrev; /* Previous PGroupBlock in list */
PGroupBlockList *pList; /* Owner list */
};
/* Minimum value for PGroupBlock.nEntry */
#define PAGECACHE_BLOCKALLOC_MINENTRY 15
/* Each page cache is an instance of the following object. Every /* Each page cache is an instance of the following object. Every
** open database file (including each in-memory database and each ** open database file (including each in-memory database and each
** temporary or transient database) has a single page cache which ** temporary or transient database) has a single page cache which
@@ -219,17 +159,6 @@ static SQLITE_WSD struct PCacheGlobal {
#define PGHDR1_TO_PAGE(p) (void*)(((char*)p) - p->pCache->szPage) #define PGHDR1_TO_PAGE(p) (void*)(((char*)p) - p->pCache->szPage)
#define PAGE_TO_PGHDR1(c, p) (PgHdr1*)(((char*)p) + c->szPage) #define PAGE_TO_PGHDR1(c, p) (PgHdr1*)(((char*)p) + c->szPage)
/*
** Blocks used by the SQLITE_PAGECACHE_BLOCKALLOC blocks to store/retrieve
** a PGroupBlock pointer based on a pointer to a page buffer.
*/
#define PAGE_SET_BLOCKPTR(pCache, pPg, pBlock) \
( *(PGroupBlock **)&(((u8*)pPg)[sizeof(PgHdr1) + pCache->szPage]) = pBlock )
#define PAGE_GET_BLOCKPTR(pCache, pPg) \
( *(PGroupBlock **)&(((u8*)pPg)[sizeof(PgHdr1) + pCache->szPage]) )
/* /*
** Macros to enter and leave the PCache LRU mutex. ** Macros to enter and leave the PCache LRU mutex.
*/ */
@@ -355,139 +284,14 @@ static int pcache1MemSize(void *p){
} }
#endif /* SQLITE_ENABLE_MEMORY_MANAGEMENT */ #endif /* SQLITE_ENABLE_MEMORY_MANAGEMENT */
#ifdef SQLITE_PAGECACHE_BLOCKALLOC
/*
** The block pBlock belongs to list pList but is not currently linked in.
** Insert it into the start of the list.
*/
static void addBlockToList(PGroupBlockList *pList, PGroupBlock *pBlock){
pBlock->pPrev = 0;
pBlock->pNext = pList->pFirst;
pList->pFirst = pBlock;
if( pBlock->pNext ){
pBlock->pNext->pPrev = pBlock;
}else{
assert( pList->pLast==0 );
pList->pLast = pBlock;
}
}
/*
** If there are no blocks in the list headed by pList, remove pList
** from the pGroup->pBlockList list and free it with sqlite3_free().
*/
static void freeListIfEmpty(PGroup *pGroup, PGroupBlockList *pList){
assert( sqlite3_mutex_held(pGroup->mutex) );
if( pList->pFirst==0 ){
PGroupBlockList **pp;
for(pp=&pGroup->pBlockList; *pp!=pList; pp=&(*pp)->pNext);
*pp = (*pp)->pNext;
sqlite3_free(pList);
}
}
#endif /* SQLITE_PAGECACHE_BLOCKALLOC */
/* /*
** Allocate a new page object initially associated with cache pCache. ** Allocate a new page object initially associated with cache pCache.
*/ */
static PgHdr1 *pcache1AllocPage(PCache1 *pCache){ static PgHdr1 *pcache1AllocPage(PCache1 *pCache){
int nByte = sizeof(PgHdr1) + pCache->szPage; int nByte = sizeof(PgHdr1) + pCache->szPage;
void *pPg = 0; PgHdr1 *p = 0;
PgHdr1 *p; void *pPg;
#ifdef SQLITE_PAGECACHE_BLOCKALLOC
PGroup *pGroup = pCache->pGroup;
PGroupBlockList *pList;
PGroupBlock *pBlock;
int i;
nByte += sizeof(PGroupBlockList *);
nByte = ROUND8(nByte);
for(pList=pGroup->pBlockList; pList; pList=pList->pNext){
if( pList->nByte==nByte ) break;
}
if( pList==0 ){
PGroupBlockList *pNew;
assert( pGroup->isBusy==0 );
assert( sqlite3_mutex_held(pGroup->mutex) );
pGroup->isBusy = 1; /* Disable sqlite3PcacheReleaseMemory() */
pNew = (PGroupBlockList *)sqlite3MallocZero(sizeof(PGroupBlockList));
pGroup->isBusy = 0; /* Reenable sqlite3PcacheReleaseMemory() */
if( pNew==0 ){
/* malloc() failure. Return early. */
return 0;
}
#ifdef SQLITE_DEBUG
for(pList=pGroup->pBlockList; pList; pList=pList->pNext){
assert( pList->nByte!=nByte );
}
#endif
pNew->nByte = nByte;
pNew->pNext = pGroup->pBlockList;
pGroup->pBlockList = pNew;
pList = pNew;
}
pBlock = pList->pFirst;
if( pBlock==0 || pBlock->mUsed==(((Bitmask)1<<pBlock->nEntry)-1) ){
int sz;
/* Allocate a new block. Try to allocate enough space for the PGroupBlock
** structure and MINENTRY allocations of nByte bytes each. If the
** allocator returns more memory than requested, then more than MINENTRY
** allocations may fit in it. */
assert( sqlite3_mutex_held(pGroup->mutex) );
pcache1LeaveMutex(pCache->pGroup);
sz = sizeof(PGroupBlock) + PAGECACHE_BLOCKALLOC_MINENTRY * nByte;
pBlock = (PGroupBlock *)sqlite3Malloc(sz);
pcache1EnterMutex(pCache->pGroup);
if( !pBlock ){
freeListIfEmpty(pGroup, pList);
return 0;
}
pBlock->nEntry = (sqlite3MallocSize(pBlock) - sizeof(PGroupBlock)) / nByte;
if( pBlock->nEntry>=BMS ){
pBlock->nEntry = BMS-1;
}
pBlock->pList = pList;
pBlock->mUsed = 0;
pBlock->aData = (u8 *)&pBlock[1];
addBlockToList(pList, pBlock);
sz = sqlite3MallocSize(pBlock);
sqlite3_mutex_enter(pcache1.mutex);
sqlite3StatusAdd(SQLITE_STATUS_PAGECACHE_OVERFLOW, sz);
sqlite3_mutex_leave(pcache1.mutex);
}
for(i=0; pPg==0 && ALWAYS(i<pBlock->nEntry); i++){
if( 0==(pBlock->mUsed & ((Bitmask)1<<i)) ){
pBlock->mUsed |= ((Bitmask)1<<i);
pPg = (void *)&pBlock->aData[pList->nByte * i];
}
}
assert( pPg );
PAGE_SET_BLOCKPTR(pCache, pPg, pBlock);
/* If the block is now full, shift it to the end of the list */
if( pBlock->mUsed==(((Bitmask)1<<pBlock->nEntry)-1) && pList->pLast!=pBlock ){
assert( pList->pFirst==pBlock );
assert( pBlock->pPrev==0 );
assert( pList->pLast->pNext==0 );
pList->pFirst = pBlock->pNext;
pList->pFirst->pPrev = 0;
pBlock->pPrev = pList->pLast;
pBlock->pNext = 0;
pList->pLast->pNext = pBlock;
pList->pLast = pBlock;
}
p = PAGE_TO_PGHDR1(pCache, pPg);
if( pCache->bPurgeable ){
pCache->pGroup->nCurrentPage++;
}
#else
/* The group mutex must be released before pcache1Alloc() is called. This /* The group mutex must be released before pcache1Alloc() is called. This
** is because it may call sqlite3_release_memory(), which assumes that ** is because it may call sqlite3_release_memory(), which assumes that
** this mutex is not held. */ ** this mutex is not held. */
@@ -495,15 +299,13 @@ static PgHdr1 *pcache1AllocPage(PCache1 *pCache){
pcache1LeaveMutex(pCache->pGroup); pcache1LeaveMutex(pCache->pGroup);
pPg = pcache1Alloc(nByte); pPg = pcache1Alloc(nByte);
pcache1EnterMutex(pCache->pGroup); pcache1EnterMutex(pCache->pGroup);
if( pPg ){ if( pPg ){
p = PAGE_TO_PGHDR1(pCache, pPg); p = PAGE_TO_PGHDR1(pCache, pPg);
if( pCache->bPurgeable ){ if( pCache->bPurgeable ){
pCache->pGroup->nCurrentPage++; pCache->pGroup->nCurrentPage++;
} }
}else{
p = 0;
} }
#endif
return p; return p;
} }
@@ -517,49 +319,8 @@ static PgHdr1 *pcache1AllocPage(PCache1 *pCache){
static void pcache1FreePage(PgHdr1 *p){ static void pcache1FreePage(PgHdr1 *p){
if( ALWAYS(p) ){ if( ALWAYS(p) ){
PCache1 *pCache = p->pCache; PCache1 *pCache = p->pCache;
void *pPg = PGHDR1_TO_PAGE(p);
#ifdef SQLITE_PAGECACHE_BLOCKALLOC
PGroupBlock *pBlock = PAGE_GET_BLOCKPTR(pCache, pPg);
PGroupBlockList *pList = pBlock->pList;
int i = ((u8 *)pPg - pBlock->aData) / pList->nByte;
assert( pPg==(void *)&pBlock->aData[i*pList->nByte] );
assert( pBlock->mUsed & ((Bitmask)1<<i) );
pBlock->mUsed &= ~((Bitmask)1<<i);
/* Remove the block from the list. If it is completely empty, free it.
** Or if it is not completely empty, re-insert it at the start of the
** list. */
if( pList->pFirst==pBlock ){
pList->pFirst = pBlock->pNext;
if( pList->pFirst ) pList->pFirst->pPrev = 0;
}else{
pBlock->pPrev->pNext = pBlock->pNext;
}
if( pList->pLast==pBlock ){
pList->pLast = pBlock->pPrev;
if( pList->pLast ) pList->pLast->pNext = 0;
}else{
pBlock->pNext->pPrev = pBlock->pPrev;
}
if( pBlock->mUsed==0 ){
PGroup *pGroup = p->pCache->pGroup;
int sz = sqlite3MallocSize(pBlock);
sqlite3_mutex_enter(pcache1.mutex);
sqlite3StatusAdd(SQLITE_STATUS_PAGECACHE_OVERFLOW, -sz);
sqlite3_mutex_leave(pcache1.mutex);
freeListIfEmpty(pGroup, pList);
sqlite3_free(pBlock);
}else{
addBlockToList(pList, pBlock);
}
#else
assert( sqlite3_mutex_held(p->pCache->pGroup->mutex) ); assert( sqlite3_mutex_held(p->pCache->pGroup->mutex) );
pcache1Free(pPg); pcache1Free(PGHDR1_TO_PAGE(p));
#endif
if( pCache->bPurgeable ){ if( pCache->bPurgeable ){
pCache->pGroup->nCurrentPage--; pCache->pGroup->nCurrentPage--;
} }
@@ -1170,9 +931,6 @@ void sqlite3PCacheSetDefault(void){
*/ */
int sqlite3PcacheReleaseMemory(int nReq){ int sqlite3PcacheReleaseMemory(int nReq){
int nFree = 0; int nFree = 0;
#ifdef SQLITE_PAGECACHE_BLOCKALLOC
if( pcache1.grp.isBusy ) return 0;
#endif
assert( sqlite3_mutex_notheld(pcache1.grp.mutex) ); assert( sqlite3_mutex_notheld(pcache1.grp.mutex) );
assert( sqlite3_mutex_notheld(pcache1.mutex) ); assert( sqlite3_mutex_notheld(pcache1.mutex) );
if( pcache1.pStart==0 ){ if( pcache1.pStart==0 ){

View File

@@ -5810,6 +5810,18 @@ int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg);
** the database connection.)^ ** the database connection.)^
** ^The highwater mark associated with SQLITE_DBSTATUS_STMT_USED is always 0. ** ^The highwater mark associated with SQLITE_DBSTATUS_STMT_USED is always 0.
** </dd> ** </dd>
**
** [[SQLITE_DBSTATUS_CACHE_HIT]] ^(<dt>SQLITE_DBSTATUS_CACHE_HIT</dt>
** <dd>This parameter returns the number of pager cache hits that have
** occurred. ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_HIT
** is always 0.
** </dd>
**
** [[SQLITE_DBSTATUS_CACHE_MISS]] ^(<dt>SQLITE_DBSTATUS_CACHE_MISS</dt>
** <dd>This parameter returns the number of pager cache misses that have
** occurred. ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_MISS
** is always 0.
** </dd>
** </dl> ** </dl>
*/ */
#define SQLITE_DBSTATUS_LOOKASIDE_USED 0 #define SQLITE_DBSTATUS_LOOKASIDE_USED 0
@@ -5819,7 +5831,9 @@ int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg);
#define SQLITE_DBSTATUS_LOOKASIDE_HIT 4 #define SQLITE_DBSTATUS_LOOKASIDE_HIT 4
#define SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE 5 #define SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE 5
#define SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL 6 #define SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL 6
#define SQLITE_DBSTATUS_MAX 6 /* Largest defined DBSTATUS */ #define SQLITE_DBSTATUS_CACHE_HIT 7
#define SQLITE_DBSTATUS_CACHE_MISS 8
#define SQLITE_DBSTATUS_MAX 8 /* Largest defined DBSTATUS */
/* /*
@@ -5873,7 +5887,6 @@ int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
** A non-zero value in this counter may indicate an opportunity to ** A non-zero value in this counter may indicate an opportunity to
** improvement performance by adding permanent indices that do not ** improvement performance by adding permanent indices that do not
** need to be reinitialized each time the statement is run.</dd> ** need to be reinitialized each time the statement is run.</dd>
**
** </dl> ** </dl>
*/ */
#define SQLITE_STMTSTATUS_FULLSCAN_STEP 1 #define SQLITE_STMTSTATUS_FULLSCAN_STEP 1

View File

@@ -218,6 +218,28 @@ int sqlite3_db_status(
break; break;
} }
/*
** Set *pCurrent to the total cache hits or misses encountered by all
** pagers the database handle is connected to. *pHighwater is always set
** to zero.
*/
case SQLITE_DBSTATUS_CACHE_HIT:
case SQLITE_DBSTATUS_CACHE_MISS: {
int i;
int nRet = 0;
assert( SQLITE_DBSTATUS_CACHE_MISS==SQLITE_DBSTATUS_CACHE_HIT+1 );
for(i=0; i<db->nDb; i++){
if( db->aDb[i].pBt ){
Pager *pPager = sqlite3BtreePager(db->aDb[i].pBt);
sqlite3PagerCacheStat(pPager, op, resetFlag, &nRet);
}
}
*pHighwater = 0;
*pCurrent = nRet;
break;
}
default: { default: {
rc = SQLITE_ERROR; rc = SQLITE_ERROR;
} }

View File

@@ -3539,33 +3539,34 @@ int Md5_Register(sqlite3 *db){
** the TCL interpreter reads and evaluates that file. ** the TCL interpreter reads and evaluates that file.
*/ */
#if TCLSH==1 #if TCLSH==1
static char zMainloop[] = static const char *tclsh_main_loop(void){
"set line {}\n" static const char zMainloop[] =
"while {![eof stdin]} {\n" "set line {}\n"
"if {$line!=\"\"} {\n" "while {![eof stdin]} {\n"
"puts -nonewline \"> \"\n" "if {$line!=\"\"} {\n"
"} else {\n" "puts -nonewline \"> \"\n"
"puts -nonewline \"% \"\n" "} else {\n"
"}\n" "puts -nonewline \"% \"\n"
"flush stdout\n" "}\n"
"append line [gets stdin]\n" "flush stdout\n"
"if {[info complete $line]} {\n" "append line [gets stdin]\n"
"if {[catch {uplevel #0 $line} result]} {\n" "if {[info complete $line]} {\n"
"puts stderr \"Error: $result\"\n" "if {[catch {uplevel #0 $line} result]} {\n"
"} elseif {$result!=\"\"} {\n" "puts stderr \"Error: $result\"\n"
"puts $result\n" "} elseif {$result!=\"\"} {\n"
"puts $result\n"
"}\n"
"set line {}\n"
"} else {\n"
"append line \\n\n"
"}\n" "}\n"
"set line {}\n"
"} else {\n"
"append line \\n\n"
"}\n" "}\n"
"}\n" ;
; return zMainloop;
}
#endif #endif
#if TCLSH==2 #if TCLSH==2
static char zMainloop[] = static const char *tclsh_main_loop(void);
#include "spaceanal_tcl.h"
;
#endif #endif
#ifdef SQLITE_TEST #ifdef SQLITE_TEST
@@ -3649,6 +3650,17 @@ static void init_all(Tcl_Interp *interp){
Md5_Init(interp); Md5_Init(interp);
#endif #endif
/* Install the [register_dbstat_vtab] command to access the implementation
** of virtual table dbstat (source file test_stat.c). This command is
** required for testfixture and sqlite3_analyzer, but not by the production
** Tcl extension. */
#if defined(SQLITE_TEST) || TCLSH==2
{
extern int SqlitetestStat_Init(Tcl_Interp*);
SqlitetestStat_Init(interp);
}
#endif
#ifdef SQLITE_TEST #ifdef SQLITE_TEST
{ {
extern int Sqliteconfig_Init(Tcl_Interp*); extern int Sqliteconfig_Init(Tcl_Interp*);
@@ -3678,7 +3690,6 @@ static void init_all(Tcl_Interp *interp){
extern int Sqlitetestbackup_Init(Tcl_Interp*); extern int Sqlitetestbackup_Init(Tcl_Interp*);
extern int Sqlitetestintarray_Init(Tcl_Interp*); extern int Sqlitetestintarray_Init(Tcl_Interp*);
extern int Sqlitetestvfs_Init(Tcl_Interp *); extern int Sqlitetestvfs_Init(Tcl_Interp *);
extern int SqlitetestStat_Init(Tcl_Interp*);
extern int Sqlitetestrtree_Init(Tcl_Interp*); extern int Sqlitetestrtree_Init(Tcl_Interp*);
extern int Sqlitequota_Init(Tcl_Interp*); extern int Sqlitequota_Init(Tcl_Interp*);
extern int Sqlitemultiplex_Init(Tcl_Interp*); extern int Sqlitemultiplex_Init(Tcl_Interp*);
@@ -3722,7 +3733,6 @@ static void init_all(Tcl_Interp *interp){
Sqlitetestbackup_Init(interp); Sqlitetestbackup_Init(interp);
Sqlitetestintarray_Init(interp); Sqlitetestintarray_Init(interp);
Sqlitetestvfs_Init(interp); Sqlitetestvfs_Init(interp);
SqlitetestStat_Init(interp);
Sqlitetestrtree_Init(interp); Sqlitetestrtree_Init(interp);
Sqlitequota_Init(interp); Sqlitequota_Init(interp);
Sqlitemultiplex_Init(interp); Sqlitemultiplex_Init(interp);
@@ -3758,12 +3768,13 @@ int TCLSH_MAIN(int argc, char **argv){
** sqlite3_initialize() is. */ ** sqlite3_initialize() is. */
sqlite3_shutdown(); sqlite3_shutdown();
Tcl_FindExecutable(argv[0]);
interp = Tcl_CreateInterp();
#if TCLSH==2 #if TCLSH==2
sqlite3_config(SQLITE_CONFIG_SINGLETHREAD); sqlite3_config(SQLITE_CONFIG_SINGLETHREAD);
#endif #endif
Tcl_FindExecutable(argv[0]);
interp = Tcl_CreateInterp();
init_all(interp); init_all(interp);
if( argc>=2 ){ if( argc>=2 ){
int i; int i;
@@ -3784,7 +3795,7 @@ int TCLSH_MAIN(int argc, char **argv){
} }
} }
if( TCLSH==2 || argc<=1 ){ if( TCLSH==2 || argc<=1 ){
Tcl_GlobalEval(interp, zMainloop); Tcl_GlobalEval(interp, tclsh_main_loop());
} }
return 0; return 0;
} }

View File

@@ -561,12 +561,6 @@ Tcl_SetVar2(interp, "sqlite_options", "long_double",
Tcl_SetVar2(interp, "sqlite_options", "yytrackmaxstackdepth", "0", TCL_GLOBAL_ONLY); Tcl_SetVar2(interp, "sqlite_options", "yytrackmaxstackdepth", "0", TCL_GLOBAL_ONLY);
#endif #endif
#ifdef SQLITE_PAGECACHE_BLOCKALLOC
Tcl_SetVar2(interp, "sqlite_options", "blockalloc", "1", TCL_GLOBAL_ONLY);
#else
Tcl_SetVar2(interp, "sqlite_options", "blockalloc", "0", TCL_GLOBAL_ONLY);
#endif
#define LINKVAR(x) { \ #define LINKVAR(x) { \
static const int cv_ ## x = SQLITE_ ## x; \ static const int cv_ ## x = SQLITE_ ## x; \
Tcl_LinkVar(interp, "SQLITE_" #x, (char *)&(cv_ ## x), \ Tcl_LinkVar(interp, "SQLITE_" #x, (char *)&(cv_ ## x), \

View File

@@ -1325,11 +1325,13 @@ static int test_db_status(
{ "STMT_USED", SQLITE_DBSTATUS_STMT_USED }, { "STMT_USED", SQLITE_DBSTATUS_STMT_USED },
{ "LOOKASIDE_HIT", SQLITE_DBSTATUS_LOOKASIDE_HIT }, { "LOOKASIDE_HIT", SQLITE_DBSTATUS_LOOKASIDE_HIT },
{ "LOOKASIDE_MISS_SIZE", SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE }, { "LOOKASIDE_MISS_SIZE", SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE },
{ "LOOKASIDE_MISS_FULL", SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL } { "LOOKASIDE_MISS_FULL", SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL },
{ "CACHE_HIT", SQLITE_DBSTATUS_CACHE_HIT },
{ "CACHE_MISS", SQLITE_DBSTATUS_CACHE_MISS }
}; };
Tcl_Obj *pResult; Tcl_Obj *pResult;
if( objc!=4 ){ if( objc!=4 ){
Tcl_WrongNumArgs(interp, 1, objv, "PARAMETER RESETFLAG"); Tcl_WrongNumArgs(interp, 1, objv, "DB PARAMETER RESETFLAG");
return TCL_ERROR; return TCL_ERROR;
} }
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR; if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;

View File

@@ -18,7 +18,9 @@
** for an example implementation. ** for an example implementation.
*/ */
#include "sqliteInt.h" #ifndef SQLITE_AMALGAMATION
# include "sqliteInt.h"
#endif
#ifndef SQLITE_OMIT_VIRTUALTABLE #ifndef SQLITE_OMIT_VIRTUALTABLE
@@ -568,7 +570,7 @@ int sqlite3_dbstat_register(sqlite3 *db){
#endif #endif
#ifdef SQLITE_TEST #if defined(SQLITE_TEST) || TCLSH==2
#include <tcl.h> #include <tcl.h>
static int test_dbstat( static int test_dbstat(
@@ -604,4 +606,5 @@ int SqlitetestStat_Init(Tcl_Interp *interp){
Tcl_CreateObjCommand(interp, "register_dbstat_vtab", test_dbstat, 0, 0); Tcl_CreateObjCommand(interp, "register_dbstat_vtab", test_dbstat, 0, 0);
return TCL_OK; return TCL_OK;
} }
#endif #endif /* if defined(SQLITE_TEST) || TCLSH==2 */

View File

@@ -16,8 +16,6 @@
# #
# $Id: corruptE.test,v 1.14 2009/07/11 06:55:34 danielk1977 Exp $ # $Id: corruptE.test,v 1.14 2009/07/11 06:55:34 danielk1977 Exp $
catch {forcedelete test.db test.db-journal test.bu}
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl

View File

@@ -223,16 +223,5 @@ do_test ctime-2.5.$tc {
} ] } ]
} {0 {{}}} } {0 {{}}}
ifcapable blockalloc {
do_test ctime-3.1a {
db eval {SELECT sqlite_compileoption_used('PAGECACHE_BLOCKALLOC')}
} {1}
} else {
do_test ctime-3.1b {
db eval {SELECT sqlite_compileoption_used('PAGECACHE_BLOCKALLOC')}
} {0}
}
finish_test finish_test

76
test/dbstatus2.test Normal file
View File

@@ -0,0 +1,76 @@
# 2011 September 20
#
# 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 for the sqlite3_stmt_status() function
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set ::testprefix dbstatus2
do_execsql_test 1.0 {
PRAGMA page_size = 1024;
PRAGMA auto_vacuum = 0;
CREATE TABLE t1(a PRIMARY KEY, b);
INSERT INTO t1 VALUES(1, randomblob(600));
INSERT INTO t1 VALUES(2, randomblob(600));
INSERT INTO t1 VALUES(3, randomblob(600));
}
proc db_hit_miss {db {reset 0}} {
set nHit [sqlite3_db_status $db CACHE_HIT $reset]
set nMiss [sqlite3_db_status $db CACHE_MISS $reset]
list $nHit $nMiss
}
do_test 1.1 {
db close
sqlite3 db test.db
expr {[file size test.db] / 1024}
} 6
do_test 1.2 {
execsql { SELECT b FROM t1 WHERE a=2 }
db_hit_miss db
} {{0 2 0} {0 4 0}}
do_test 1.3 {
execsql { SELECT b FROM t1 WHERE a=2 }
db_hit_miss db
} {{0 6 0} {0 4 0}}
do_test 1.4 {
execsql { SELECT b FROM t1 WHERE a=2 }
db_hit_miss db
} {{0 10 0} {0 4 0}}
do_test 1.5 {
db_hit_miss db 1
} {{0 10 0} {0 4 0}}
do_test 1.6 {
db_hit_miss db 0
} {{0 0 0} {0 0 0}}
do_test 1.7 {
set fd [db incrblob main t1 b 1]
fconfigure $fd -translation binary
set len [string length [read $fd]]
close $fd
set len
} 600
do_test 1.8 { sqlite3_db_status db CACHE_HIT 0 } {0 2 0}
do_test 1.9 { sqlite3_db_status db CACHE_MISS 0 } {0 1 0}
finish_test

View File

@@ -407,7 +407,7 @@ do_test memdb-8.2 {
# Test that auto-vacuum works with in-memory databases. # Test that auto-vacuum works with in-memory databases.
# #
ifcapable autovacuum&&!blockalloc { ifcapable autovacuum {
do_test memdb-9.1 { do_test memdb-9.1 {
db close db close
sqlite3 db test.db sqlite3 db test.db

View File

@@ -25,13 +25,6 @@ if {[permutation] == "memsubsys1"} {
return return
} }
# Nor will it work if the pager is allocating memory in blocks.
#
ifcapable blockalloc {
finish_test
return
}
# This procedure constructs a new database in test.db. It fills # This procedure constructs a new database in test.db. It fills
# this database with many small records (enough to force multiple # this database with many small records (enough to force multiple
# rebalance operations in the btree-layer and to require a large # rebalance operations in the btree-layer and to require a large

View File

@@ -16,14 +16,6 @@
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
# If compiled with blockalloc, pagecache memory is not used. Which
# causes these tests to fail.
#
ifcapable blockalloc {
finish_test
return
}
# Set up a pcache memory pool so that we can easily track how many # Set up a pcache memory pool so that we can easily track how many
# pages are being used for cache. # pages are being used for cache.
# #

View File

@@ -35,8 +35,7 @@ sqlite3 db $file_to_analyze
register_dbstat_vtab db register_dbstat_vtab db
set pageSize [db one {PRAGMA page_size}] set pageSize [db one {PRAGMA page_size}]
db eval {SELECT count(*) FROM sqlite_master}
#set DB [btree_open $file_to_analyze 1000 0]
# In-memory database for collecting statistics. This script loops through # In-memory database for collecting statistics. This script loops through
# the tables and indices in the database being analyzed, adding a row for each # the tables and indices in the database being analyzed, adding a row for each
@@ -66,11 +65,10 @@ mem eval $tabledef
# Create a temporary "dbstat" virtual table. # Create a temporary "dbstat" virtual table.
# #
db eval { db eval {CREATE VIRTUAL TABLE temp.stat USING dbstat}
CREATE VIRTUAL TABLE temp.stat USING dbstat; db eval {CREATE TEMP TABLE dbstat AS SELECT * FROM temp.stat
CREATE TEMP TABLE dbstat AS SELECT * FROM temp.stat ORDER BY name, path; ORDER BY name, path}
DROP TABLE temp.stat; db eval {DROP TABLE temp.stat}
}
proc isleaf {pagetype is_index} { proc isleaf {pagetype is_index} {
return [expr {$pagetype == "leaf" || ($pagetype == "internal" && $is_index)}] return [expr {$pagetype == "leaf" || ($pagetype == "internal" && $is_index)}]