Compare commits

...

6 Commits

Author SHA1 Message Date
dan 2ebfe2695d Minor changes to unixMapfile() function.
FossilOrigin-Name: 80c63443c438ec21cc02880801d4fb4ca5f4e23f
2013-04-01 14:20:23 +00:00
dan 620298e445 Further fixes for test scripts.
FossilOrigin-Name: 23ffa4f9fbad2e39cbe4776c7fdb61f757b6fc78
2013-03-29 19:38:52 +00:00
dan 9719cc4069 Fix a problem in btree.c that could cause a crash following an OOM. Also various test script problems.
FossilOrigin-Name: e8bcdf938eee2c307c24d60d0295e5529291373b
2013-03-29 18:52:56 +00:00
dan 46079439a0 Avoid assuming the page-size is 4096 bytes in os_unix.c.
FossilOrigin-Name: 3b7ec8d79e35e38df990e315c4ef9c7ab678bcbf
2013-03-29 11:24:15 +00:00
dan 38360da27f Modify various test cases so that they work if the file is extended in units of the system page-size.
FossilOrigin-Name: 0e3d5119273fd8e3512b3aa4272a873847e7ca40
2013-03-27 19:53:55 +00:00
dan ca4f5b6e9d Change os_unix.c to use either one or two mappings internally.
FossilOrigin-Name: e7698cba9bcffbfadd30d9319669add4d60fcc65
2013-03-26 20:32:39 +00:00
46 changed files with 424 additions and 259 deletions
+49 -49
View File
@@ -1,5 +1,5 @@
C In\sbtree.c,\ssave\sthe\spositions\sof\sany\sopen\scursors\sbefore\smoving\sany\spages\saround\sto\sauto-vacuum\sthe\sdatabase\son\scommit.
D 2013-03-26T14:16:20.450
C Minor\schanges\sto\sunixMapfile()\sfunction.
D 2013-04-01T14:20:23.253
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in df3e48659d80e1b7765785d8d66c86b320f72cc7
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -121,7 +121,7 @@ F src/auth.c 523da7fb4979469955d822ff9298352d6b31de34
F src/backup.c b2cac9f7993f3f9588827b824b1501d0c820fa68
F src/bitvec.c 19a4ba637bd85f8f63fc8c9bae5ade9fb05ec1cb
F src/btmutex.c 976f45a12e37293e32cae0281b15a21d48a8aaa7
F src/btree.c 19b587b32569d4b92651b5eaa9de2e59c6f8f704
F src/btree.c 84c9a4a20b827a6f7dbcbcda59607dbee57af446
F src/btree.h d9490cd37aaeb530a41b07f06e1262950b1be916
F src/btreeInt.h eecc84f02375b2bb7a44abbcbbe3747dde73edb2
F src/build.c 083da8466fd7e481cb8bd5264398f537507f6176
@@ -160,9 +160,9 @@ F src/notify.c 976dd0f6171d4588e89e874fcc765e92914b6d30
F src/os.c 809d0707cec693e1b9b376ab229271ad74c3d35d
F src/os.h ae08bcc5f6ec6b339f4a2adf3931bb88cc14c3e4
F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
F src/os_unix.c 57306f1d2a2d783dae4365446b9f9a5da8958559
F src/os_unix.c 2c54787f5c60b850bd8a9ed6c029100cde2429dc
F src/os_win.c e4f17ddf79f2a9373e33ed70565e765d65324589
F src/pager.c 8ac98fd95106e759870e92ff316b188e78f469cf
F src/pager.c 30009ae5800f80e21da1f118fabfc72b34d8c722
F src/pager.h 5cb78b8e1adfd5451e600be7719f5a99d87ac3b1
F src/parse.y 5d5e12772845805fdfeb889163516b84fbb9ae95
F src/pcache.c f8043b433a57aba85384a531e3937a804432a346
@@ -249,7 +249,7 @@ F src/vdbemem.c 833005f1cbbf447289f1973dba2a0c2228c7b8ab
F src/vdbesort.c 4fad64071ae120c25f39dcac572d716b9cadeb7f
F src/vdbetrace.c 8bd5da325fc90f28464335e4cc4ad1407fe30835
F src/vtab.c b05e5f1f4902461ba9f5fc49bb7eb7c3a0741a83
F src/wal.c e84eff498c57ec2d79ca4496a3f4a638af378fb3
F src/wal.c 04029f2691e937d7f5dd638580679a560fec93bf
F src/wal.h a4d3da523d55a226a0b28e9058ef88d0a8051887
F src/walker.c 3d75ba73de15e0f8cd0737643badbeb0e002f07b
F src/where.c 9a16c0b84bbeb054d11fda96e9e037ae310bd54e
@@ -286,13 +286,13 @@ F test/auth2.test a2a371aa6df15f8b0c8109b33d3d7f0f73e4c9aa
F test/auth3.test a4755e6a2a2fea547ffe63c874eb569e60a28eb5
F test/autoinc.test bd30d372d00045252f6c2e41b5f41455e1975acf
F test/autoindex1.test f88146c4c889ea0afbb620e49d83b5fbf5ee4d06
F test/autovacuum.test 9f22a7733f39c56ef6a5665d10145ac25d8cb574
F test/autovacuum.test ad9f74649caf108dbb9208aa0bcbdd22eed51ad0
F test/autovacuum_ioerr2.test 8a367b224183ad801e0e24dcb7d1501f45f244b4
F test/avtrans.test 0252654f4295ddda3b2cce0e894812259e655a85
F test/backcompat.test ecd841f3a3bfb81518721879cc56a760670e3198
F test/backup.test c9cdd23a495864b9edf75a9fa66f5cb7e10fcf62
F test/backup.test 66a716403ec014d763910d1de20c8dab5f17527e
F test/backup2.test 34986ef926ea522911a51dfdb2f8e99b7b75ebcf
F test/backup4.test 4d90389daeb781fe718816a4fc836ad1b06791d8
F test/backup4.test 20a100140fea819d383920de02efe64b981d2414
F test/backup_ioerr.test 4c3c7147cee85b024ecf6e150e090c32fdbb5135
F test/backup_malloc.test 7162d604ec2b4683c4b3799a48657fb8b5e2d450
F test/badutf.test d5360fc31f643d37a973ab0d8b4fb85799c3169f
@@ -339,23 +339,23 @@ F test/colmeta.test 087c42997754b8c648819832241daf724f813322
F test/colname.test 08948a4809d22817e0e5de89c7c0a8bd90cb551b
F test/conflict.test 0b3922d2304a14a47e3ccd61bbd6824327af659b
F test/corrupt.test 4aabd06cff3fe759e3e658bcc17b71789710665e
F test/corrupt2.test 9c0ab4becd50e9050bc1ebb8675456a4e5587bf0
F test/corrupt3.test 889d7cdb811800303aa722d7813fe8a4299cf726
F test/corrupt2.test 7db8c262e76115745c7c1607374c4de34f92f4d3
F test/corrupt3.test 77c3da3229f32843fdc5d89599b49e49ce901850
F test/corrupt4.test b963f9e01e0f92d15c76fb0747876fd4b96dc30a
F test/corrupt5.test c23da7bfb20917cc7fdbb13ee25c7cc4e9fffeff
F test/corrupt6.test 4e4161aef1f30b9f34582bb4142334b7f47eacae
F test/corrupt7.test a90caf89c7d7cb7893ea4d92529bd0c129317ee4
F test/corrupt6.test 4d509a36a237f4826a79ddb22ac966b7d0d05cc7
F test/corrupt7.test ff767cdf4ceb019d113c654ab21e41a4bd51f1de
F test/corrupt8.test 48eb37ffb9a03bceada62219e2bd4c92f4b0cb75
F test/corrupt9.test 959179e68dc0b7b99f424cf3e0381c86dcdd0112
F test/corruptA.test fafa652aa585753be4f6b62ff0bb250266eaf7ce
F test/corruptB.test 20d4a20cbed23958888c3e8995b424a47223d647
F test/corruptC.test 62a767fe64acb1975f58cc6171192839c783edbb
F test/corruptC.test b2d0e0163827591207cb6dd0123dca250d016dda
F test/corruptD.test 3b09903a2e2fe07ecafe775fea94177f8a4bb34f
F test/corruptE.test d3a3d7e864a95978195741744dda4abfd8286018
F test/corruptF.test 984b1706c9c0e4248141b056c21124612628d12e
F test/corruptF.test e8c366f5784105e57284d99c88b2e8dcfd87a01f
F test/count.test 454e1ce985c94d13efeac405ce54439f49336163
F test/coveridxscan.test cdb47d01acc4a634a34fd25abe85189e0d0f1e62
F test/crash.test fb9dc4a02dcba30d4aa5c2c226f98b220b2b959f
F test/crash.test a47f6d26ae443e577596b25357e38b34b982a3c5
F test/crash2.test 5b14d4eb58b880e231361d3b609b216acda86651
F test/crash3.test 8f5de9d32ab9ab95475a9efe7f47a940aa889418
F test/crash4.test fe2821baf37168dc59dd733dcf7dba2a401487bc
@@ -364,12 +364,12 @@ F test/crash6.test 4c56f1e40d0291e1110790a99807aa875b1647ba
F test/crash7.test 1a194c4900a255258cf94b7fcbfd29536db572df
F test/crash8.test 38767cb504bbe491de6be4a7006b154973a2309f
F test/crashtest1.c 09c1c7d728ccf4feb9e481671e29dda5669bbcc2
F test/createtab.test b5de160630b209c4b8925bdcbbaf48cc90b67fe8
F test/createtab.test 45e9710fac5140be87f64f0c3eff960f37bfe212
F test/cse.test 277350a26264495e86b1785f34d2d0c8600e021c
F test/ctime.test 7bd009071e242aac4f18521581536b652b789a47
F test/date.test f3228180c87bbe5d39c9397bf001c0095c3821b9
F test/dbstatus.test 207e5b63fcb7b9c3bb8e1fdf38ebd4654ad0e54b
F test/dbstatus2.test f329941d5f4a8bc0ba6ec5735897ef0cf34e2f5f
F test/dbstatus2.test f46fdca3ffa01eb7d662f6dafb45d8bd2709dc0d
F test/default.test 6faf23ccb300114924353007795aa9a8ec0aa9dc
F test/delete.test a065b05d2ebf60fd16639c579a4adfb7c381c701
F test/delete2.test 3a03f2cca1f9a67ec469915cb8babd6485db43fa
@@ -394,7 +394,7 @@ F test/e_select.test d5af998a402740d8f0488158d22075df2b6f88fa
F test/e_select2.test 5c3d3da19c7b3e90ae444579db2b70098599ab92
F test/e_update.test 161d5dc6a3ed9dd08f5264d13e20735d7a89f00c
F test/e_uri.test 8f2f56b29456a3f846276fa4e0993d4ef8a15b79
F test/e_vacuum.test 331da289ae186656cf5f2eb27f577a89c0c221af
F test/e_vacuum.test 617227d2cad5bf829197a00968d9788ffc1bcbd2
F test/enc.test e54531cd6bf941ee6760be041dff19a104c7acea
F test/enc2.test 83437a79ba1545a55fb549309175c683fb334473
F test/enc3.test 90683ad0e6ea587b9d5542ca93568af9a9858c40
@@ -409,14 +409,14 @@ F test/exists.test 8f7b27b61c2fbe5822f0a1f899c715d14e416e30
F test/expr.test 67c9fd6f8f829e239dc8b0f4a08a73c08b09196d
F test/fallocate.test b5d34437bd7ab01d41b1464b8117aefd4d32160e
F test/filectrl.test 14fa712e42c4cb791e09dfd58a6a03efb47ef13a
F test/filefmt.test dbee33e57818249cdffbbb7b13464635217beff1
F test/filefmt.test dcd6eae426b64cc398d95c786ad7e8763b8c2982
F test/fkey1.test 01c7de578e11747e720c2d9aeef27f239853c4da
F test/fkey2.test 06e0b4cc9e1b3271ae2ae6feeb19755468432111
F test/fkey3.test 5ec899d12b13bcf1e9ef40eff7fb692fdb91392e
F test/fkey4.test 86446017011273aad8f9a99c1a65019e7bd9ca9d
F test/fkey5.test 0bf64f2d19ad80433ca0b24edbf604a18b353d5f
F test/fkey_malloc.test bb74c9cb8f8fceed03b58f8a7ef2df98520bbd51
F test/format4.test 1f0cac8ff3895e9359ed87e41aaabee982a812eb
F test/format4.test c7600a7c96388b8e19af5c7fe18399953cb748c3
F test/fts-9fd058691.test 78b887e30ae6816df0e1fed6259de4b5a64ad33c
F test/fts1a.test 46090311f85da51bb33bd5ce84f7948359c6d8d7
F test/fts1b.test 5d8a01aefbecc8b7442b36c94c05eb7a845462d5
@@ -526,13 +526,13 @@ F test/in2.test 5d4c61d17493c832f7d2d32bef785119e87bde75
F test/in3.test 3cbf58c87f4052cee3a58b37b6389777505aa0c0
F test/in4.test 64f3cc1acde1b9161ccdd8e5bde3daefdb5b2617
F test/in5.test 99f9a40af01711b06d2d614ecfe96129f334fba3
F test/incrblob.test 2100cb8964e4a106e5ca9bf80e2c5c3e8be33f77
F test/incrblob.test 983a3c15f674892e502627662289f9d969209600
F test/incrblob2.test edc3a96e557bd61fb39acc8d2edd43371fbbaa19
F test/incrblob3.test aedbb35ea1b6450c33b98f2b6ed98e5020be8dc7
F test/incrblob4.test 09be37d3dd996a31ea6993bba7837ece549414a8
F test/incrblob_err.test d2562d2771ebffd4b3af89ef64c140dd44371597
F test/incrblobfault.test 917c0292224c64a56ef7215fd633a3a82f805be0
F test/incrvacuum.test d2a6ddf5e429720b5fe502766af747915ccf6c32
F test/incrvacuum.test cfd733917fdcc06b8d4218145112167e89cc60ad
F test/incrvacuum2.test 379eeb8740b0ef60c372c439ad4cbea20b34bb9b
F test/incrvacuum3.test 2ffa9e4a23f072bd7902b9ae6471f8822a6522a7
F test/incrvacuum_ioerr.test 6ae2f783424e47a0033304808fe27789cf93e635
@@ -553,7 +553,7 @@ F test/instr.test a34e1d46a9eefb098a7167ef0e730a4a3d82fba0
F test/intarray.test 066b7d7ac38d25bf96f87f1b017bfc687551cdd4
F test/interrupt.test dfe9a67a94b0b2d8f70545ba1a6cca10780d71cc
F test/intpkey.test 7af30f6ae852d8d1c2b70e4bf1551946742e92d8
F test/io.test a4be25a446a99a0604ceecc039ee7363c56e4185
F test/io.test 1d3862c25017cf01ef6d0db682bc7ca87ab43387
F test/ioerr.test 40bb2cfcab63fb6aa7424cd97812a84bc16b5fb8
F test/ioerr2.test 9d71166f8466eda510f1af6137bdabaa82b5408d
F test/ioerr3.test d3cec5e1a11ad6d27527d0d38573fbff14c71bdd
@@ -569,7 +569,7 @@ F test/join6.test cfe6503791ceb0cbb509966740286ec423cbf10b
F test/journal1.test 69abc726c51b4a0409189f9a85191205297c0577
F test/journal2.test ae06f566c28552c313ded3fee79a6c69e6d049b1
F test/journal3.test ff8af941f9e06161d3db1b46bb9f965ff0e7f307
F test/jrnlmode.test 9ee3a78f53d52cca737db69293d15dc41c0cbd36
F test/jrnlmode.test 06a8d5771bb6ed9b8754e171519e7fc9f025db55
F test/jrnlmode2.test 81610545a4e6ed239ea8fa661891893385e23a1d
F test/jrnlmode3.test 556b447a05be0e0963f4311e95ab1632b11c9eaa
F test/keyword1.test a2400977a2e4fde43bf33754c2929fda34dbca05
@@ -583,7 +583,7 @@ F test/loadext2.test 0bcaeb4d81cd5b6e883fdfea3c1bdbe1f173cbca
F test/lock.test 87af515b0c4cf928576d0f89946d67d7c265dfb4
F test/lock2.test 5242d8ac4e2d59c403aebff606af449b455aceff
F test/lock3.test f271375930711ae044080f4fe6d6eda930870d00
F test/lock4.test e175ae13865bc87680607563bafba21f31a26f12
F test/lock4.test 8c191b10540128fb28cfd4194aeb9e61e1db007f
F test/lock5.test 5ad6a1f536036ff1be915cfdd41481aeafda3273
F test/lock6.test ad5b387a3a8096afd3c68a55b9535056431b0cf5
F test/lock7.test 64006c84c1c616657e237c7ad6532b765611cf64
@@ -607,7 +607,7 @@ F test/mallocD.test f78c295e8e18ea3029e65ca08278690e00c22100
F test/mallocE.test db1ed69d7eded1b080952e2a7c37f364ad241b08
F test/mallocF.test 2d5c590ebc2fc7f0dcebdf5aa8498b9aed69107e
F test/mallocG.test 0ff91b65c50bdaba680fb75d87fe4ad35bb7934f
F test/mallocH.test 79b65aed612c9b3ed2dcdaa727c85895fd1bfbdb
F test/mallocH.test c43a1899a56833ad42cf7a159f7d2eeb364833e6
F test/mallocI.test a88c2b9627c8506bf4703d8397420043a786cdb6
F test/mallocJ.test b5d1839da331d96223e5f458856f8ffe1366f62e
F test/mallocK.test d79968641d1b70d88f6c01bdb9a7eb4a55582cc9
@@ -648,25 +648,25 @@ F test/orderby1.test f33968647da5c546528fe4d2bf86c6a6a2e5a7ae
F test/orderby2.test bc11009f7cd99d96b1b11e57b199b00633eb5b04
F test/orderby3.test 8619d06a3debdcd80a27c0fdea5c40b468854b99
F test/oserror.test 50417780d0e0d7cd23cf12a8277bb44024765df3
F test/pager1.test 31c04bec797dda1bde337810b52efa08d1f1f08e
F test/pager1.test aa819efb5c58cef7afd0504849f3ab27eaa926a3
F test/pager2.test 745b911dde3d1f24ae0870bd433dfa83d7c658c1
F test/pager3.test 3856d9c80839be0668efee1b74811b1b7f7fc95f
F test/pagerfault.test 452f2cc23e3bfcfa935f4442aec1da4fe1dc0442
F test/pagerfault.test 0c12520f6c8883ec401b8b7b5406ca24657566a1
F test/pagerfault2.test 1f79ea40d1133b2683a2f811b00f2399f7ec2401
F test/pagerfault3.test f16e2efcb5fc9996d1356f7cbc44c998318ae1d7
F test/pageropt.test 32cb5a6ed7ccddf8e8c842cb44240bd9340223ce
F test/pagesize.test 1dd51367e752e742f58e861e65ed7390603827a0
F test/pagesize.test a8890ca1b19a5a25b1f0d8f6982bbdeb2ae045b5
F test/pcache.test 065aa286e722ab24f2e51792c1f093bf60656b16
F test/pcache2.test a83efe2dec0d392f814bfc998def1d1833942025
F test/permutations.test b6cb45ce4d3193b831231025c9d30c77317dd240
F test/pragma.test 60d29cd3d8098a2c20bf4c072810f99e3bf2757a
F test/pragma2.test 3a55f82b954242c642f8342b17dffc8b47472947
F test/permutations.test 22f3b488d057a8410687dabe13456587c358d770
F test/pragma.test ffcad56b3058c8661a4cf54205ce44894f7263e2
F test/pragma2.test dcb2dafab8b16268017879c84b5bf99034d40284
F test/printf.test ec9870c4dce8686a37818e0bf1aba6e6a1863552
F test/progress.test 5b075c3c790c7b2a61419bc199db87aaf48b8301
F test/ptrchng.test ef1aa72d6cf35a2bbd0869a649b744e9d84977fc
F test/quick.test 1681febc928d686362d50057c642f77a02c62e57
F test/quota-glob.test 32901e9eed6705d68ca3faee2a06b73b57cb3c26
F test/quota.test b5b3eec55a059e0fe493c66c6e27bd2c07676cfd
F test/quota.test cff65b46e98c65f10e853f2610748470ba3f50ff
F test/quota2.test 6d2bd57e8a4da28817f46db9da18551211cd325f
F test/quote.test 215897dbe8de1a6f701265836d6601cc6ed103e6
F test/randexpr1.tcl 40dec52119ed3a2b8b2a773bce24b63a3a746459
@@ -738,7 +738,7 @@ F test/speed4.test abc0ad3399dcf9703abed2fff8705e4f8e416715
F test/speed4p.explain 6b5f104ebeb34a038b2f714150f51d01143e59aa
F test/speed4p.test 0e51908951677de5a969b723e03a27a1c45db38b
F test/spellfix.test 52ae2680b1247c52b9e2b2116de3fd26a78e6bd2
F test/sqllimits1.test b1aae27cc98eceb845e7f7adf918561256e31298
F test/sqllimits1.test 861cbb85ecd4fc3b2bdf26e84fbd1ebd13aa28aa
F test/stat.test be8d477306006ec696bc86757cfb34bec79447ce
F test/stmt.test 25d64e3dbf9a3ce89558667d7f39d966fe2a71b9
F test/subquery.test 869562de9e8c5d8147e0451a2ce5b58cf55ce389
@@ -755,7 +755,7 @@ F test/tclsqlite.test 37a61c2da7e3bfe3b8c1a2867199f6b860df5d43
F test/tempdb.test 19d0f66e2e3eeffd68661a11c83ba5e6ace9128c
F test/temptable.test d2c9b87a54147161bcd1822e30c1d1cd891e5b30
F test/temptrigger.test 26670ed7a39cf2296a7f0a9e0a1d7bdb7abe936d
F test/tester.tcl 0d95028653ad6782e17400b7a32a046b87c67a48
F test/tester.tcl b40aa7ab9616ad148bf2c97758700c2edc7dfa2b
F test/thread001.test 9f22fd3525a307ff42a326b6bc7b0465be1745a5
F test/thread002.test e630504f8a06c00bf8bbe68528774dd96aeb2e58
F test/thread003.test ee4c9efc3b86a6a2767516a37bd64251272560a7
@@ -819,7 +819,7 @@ F test/tkt1444.test a9d72f9e942708bd82dde6c707da61c489e213e9
F test/tkt1449.test 93584a449752d52b07d2cfc280a69842b6e16ed5
F test/tkt1473.test 9d000af3e11a4450d4c596f5e58b4b0d24eb0f8b
F test/tkt1501.test 2064f98e00871848af4b2f517e46c1a7fb2e32db
F test/tkt1512.test a1df1f66caf0b9122d6220c15dcee230298c2c2f
F test/tkt1512.test f791cd2a32b739e866e74613b20e9d096a7f3312
F test/tkt1514.test ddef38e34fea72eb1ab935ded9f17a3fb71dd9df
F test/tkt1536.test 83ff7a7b6e248016f8d682d4f7a4ae114070d466
F test/tkt1537.test e3a14332de9770be8ff14bd15c19a49cbec10808
@@ -847,7 +847,7 @@ F test/tkt2820.test 39940276b3436d125deb7d8ebeee053e4cf13213
F test/tkt2822.test f391776423a7c0d0949edfce375708bfb0f3141e
F test/tkt2832.test a9b0b74a02dca166a04d9e37739c414b10929caa
F test/tkt2854.test e432965db29e27e16f539b2ba7f502eb2ccc49af
F test/tkt2920.test a8737380e4ae6424e00c0273dc12775704efbebf
F test/tkt2920.test ff4e3d02cca0786188bf717068815ebbbfa0e056
F test/tkt2927.test 4752868b9eeeb07a217f7f19f4cbaac98d6d086d
F test/tkt2942.test c5c87d179799ca6d1fbe83c815510b87cd5ec7ce
F test/tkt3080.test 1bca7579260920a66b4dd7e196e807c0f25ff804
@@ -928,7 +928,7 @@ F test/uri.test 63e03df051620a18f794b4f4adcdefb3c23b6751
F test/utf16align.test 54cd35a27c005a9b6e7815d887718780b6a462ae
F test/vacuum.test ce91c39f7f91a4273bf620efad21086b5aa6ef1d
F test/vacuum2.test af432e6e3bfc0ea20a80cb86a03c7d9876d38324
F test/vacuum3.test 77ecdd54592b45a0bcb133339f99f1ae0ae94d0d
F test/vacuum3.test 099997a910ffa862731bb74a2ae1d90fbb5f374d
F test/vacuum4.test d3f8ecff345f166911568f397d2432c16d2867d9
F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102
F test/veryquick.test 7701bb609fe8bf6535514e8b849a309e8f00573b
@@ -951,25 +951,25 @@ F test/vtabF.test fd5ad376f5a34fe0891df1f3cddb4fe7c3eb077e
F test/vtab_alter.test 9e374885248f69e251bdaacf480b04a197f125e5
F test/vtab_err.test 0d4d8eb4def1d053ac7c5050df3024fd47a3fbd8
F test/vtab_shared.test 82f463886e18d7f8395a4b6167c91815efe54839
F test/wal.test bbd98ac09d8fbcaa80ec233757056eb1bbb7cd95
F test/wal.test 0fe084a9fce3ec8e5196b3bfe3a5c2be337e7cac
F test/wal2.test d4b470f13c87f6d8268b004380afa04c3c67cb90
F test/wal3.test b22eb662bcbc148c5f6d956eaf94b047f7afe9c0
F test/wal4.test 4744e155cd6299c6bd99d3eab1c82f77db9cdb3c
F test/wal5.test f4d0aee6a2cf09e326ed2459011d396b4fdf661a
F test/wal5.test 62fcd89a2007ca0cf91a874a2aa78546b0ce588e
F test/wal6.test 2e3bc767d9c2ce35c47106148d43fcbd072a93b3
F test/wal7.test 2ae8f427d240099cc4b2dfef63cff44e2a68a1bd
F test/wal8.test b3ee739fe8f7586aaebdc2367f477ebcf3e3b034
F test/wal9.test 378e76a9ad09cd9bee06c172ad3547b0129a6750
F test/wal9.test 400b87e93ab39cbc606f5cbf96f575f08c4ed92b
F test/wal_common.tcl a98f17fba96206122eff624db0ab13ec377be4fe
F test/walbak.test b9f68e39646375c2b877be906babcc15d38b4877
F test/walbak.test a0f59461081e396f521159671ad3ebd6b6a10ade
F test/walbig.test f437473a16cfb314867c6b5d1dbcd519e73e3434
F test/walcksum.test f5447800a157c9e2234fbb8e80243f0813941bde
F test/walcksum.test 40563d1d9dd3a946833ea122db4db5a6f37e0e1d
F test/walcrash.test 4457436593be8c136f9148487c7dccd5e9013af2
F test/walcrash2.test 019d60b89d96c1937adb2b30b850ac7e86e5a142
F test/walcrash3.test 595e44c6197f0d0aa509fc135be2fd0209d11a2c
F test/walfault.test 97394d8de82a99f7abf1c12ed229640607fd0ad2
F test/walhook.test ed00a40ba7255da22d6b66433ab61fab16a63483
F test/walmode.test 4022fe03ae6e830583672caa101f046438a0473c
F test/walhook.test ac9f04264f9e1807dec17dd74901bc9d331f9aff
F test/walmode.test 781becf1162c9fd161a8a49417e2a911a94dbb41
F test/walnoshm.test 84ca10c544632a756467336b7c3b864d493ee496
F test/walpersist.test 8c6b7e3ec1ba91b5e4dc4e0921d6d3f87cd356a6
F test/walro.test a31deb621033442a76c3a61e44929250d06f81b1
@@ -1040,7 +1040,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
P a850c7319c20b5757983443df05cf2aa4250053b
R 211ffabed726a7468ad9f8d3eeabe8a8
P 23ffa4f9fbad2e39cbe4776c7fdb61f757b6fc78
R 6cd4d6bb1af95ad5b626cb22e4b9f0a4
U dan
Z 3ec7da7f1db0278991c8541b22037fbf
Z 2b8cf21f2c6587ad7587cd5c8a9f710d
+1 -1
View File
@@ -1 +1 @@
30c0a69363931a72d1c34e5be71646932398d172
80c63443c438ec21cc02880801d4fb4ca5f4e23f
+6 -5
View File
@@ -2596,12 +2596,13 @@ static int btreeSwapOutMmap(BtShared *pBt){
if( pPg && pPg->pDbPage->flags & PGHDR_MMAP ){
MemPage *pNew = 0;
rc = getAndInitPage(pBt, pPg->pgno, &pNew, 0);
if( rc==SQLITE_OK && pCsr->iPage==0 ){
pCsr->info.pCell = pNew->aData + (pCsr->info.pCell - pPg->aData);
if( rc==SQLITE_OK ){
if( pCsr->iPage==0 ){
pCsr->info.pCell = pNew->aData + (pCsr->info.pCell - pPg->aData);
}
pCsr->apPage[0] = pNew;
releasePage(pPg);
}
pCsr->apPage[0] = pNew;
releasePage(pPg);
if( rc!=SQLITE_OK ) return rc;
}
}
}
+172 -58
View File
@@ -207,6 +207,14 @@ struct UnixUnusedFd {
UnixUnusedFd *pNext; /* Next unused file descriptor on same file */
};
typedef struct unixMapping unixMapping;
struct unixMapping {
sqlite3_int64 mmapSize;
sqlite3_int64 mmapOrigsize;
void *pMapRegion;
};
/*
** The unixFile structure is subclass of sqlite3_file specific to the unix
** VFS implementations.
@@ -226,10 +234,10 @@ struct unixFile {
unixShm *pShm; /* Shared memory segment information */
int szChunk; /* Configured by FCNTL_CHUNK_SIZE */
int nFetchOut; /* Number of outstanding xFetch refs */
sqlite3_int64 mmapSize; /* Usable size of mapping at pMapRegion */
sqlite3_int64 mmapOrigsize; /* Actual size of mapping at pMapRegion */
sqlite3_int64 mmapLimit; /* Configured FCNTL_MMAP_LIMIT value */
void *pMapRegion; /* Memory mapped region */
int szSyspage; /* System page size */
unixMapping aMmap[2]; /* Up to two memory mapped regions */
#ifdef __QNXNTO__
int sectorSize; /* Device sector size */
int deviceCharacteristics; /* Precomputed device characteristics */
@@ -313,6 +321,14 @@ struct unixFile {
#define threadid 0
#endif
#if !defined(HAVE_MREMAP)
#if defined(__linux__) && defined(_GNU_SOURCE)
# define HAVE_MREMAP 1
#else
# define HAVE_MREMAP 0
#endif
#endif
/*
** Different Unix systems declare open() in different ways. Same use
** open(const char*,int,mode_t). Others use open(const char*,int,...).
@@ -450,7 +466,7 @@ static struct unix_syscall {
{ "munmap", (sqlite3_syscall_ptr)munmap, 0 },
#define osMunmap ((void*(*)(void*,size_t))aSyscall[22].pCurrent)
#if defined(__linux__) && defined(_GNU_SOURCE)
#if HAVE_MREMAP
{ "mremap", (sqlite3_syscall_ptr)mremap, 0 },
#else
{ "mremap", (sqlite3_syscall_ptr)0, 0 },
@@ -1866,6 +1882,7 @@ static int closeUnixFile(sqlite3_file *id){
static int unixClose(sqlite3_file *id){
int rc = SQLITE_OK;
unixFile *pFile = (unixFile *)id;
unixUnmapfile(pFile);
unixUnlock(id, NO_LOCK);
unixEnterMutex();
@@ -3097,6 +3114,8 @@ static int unixRead(
unixFile *pFile = (unixFile *)id;
int got;
assert( id );
sqlite3_int64 iMap = 0; /* File offset of start of mapping i */
int i; /* Used to iterate through mappings */
/* If this is a database file (not a journal, master-journal or temp
** file), the bytes in the locking range should never be read or written. */
@@ -3107,19 +3126,24 @@ static int unixRead(
);
#endif
/* Deal with as much of this write request as possible by transfering
** data to the memory mapping using memcpy(). */
if( offset<pFile->mmapSize ){
if( offset+amt <= pFile->mmapSize ){
memcpy(pBuf, &((u8 *)(pFile->pMapRegion))[offset], amt);
return SQLITE_OK;
}else{
int nCopy = pFile->mmapSize - offset;
memcpy(pBuf, &((u8 *)(pFile->pMapRegion))[offset], nCopy);
pBuf = &((u8 *)pBuf)[nCopy];
amt -= nCopy;
offset += nCopy;
/* Deal with as much of this read request as possible by transfering
** data from the memory mapping using memcpy(). */
for(i=0; i<2; i++){
unixMapping *pMap = &pFile->aMmap[i];
sqlite3_int64 iEnd = iMap + pMap->mmapSize;
if( offset<iEnd ){
if( offset+amt <= iEnd ){
memcpy(pBuf, &((u8 *)(pMap->pMapRegion))[offset-iMap], amt);
return SQLITE_OK;
}else{
int nCopy = iEnd - offset;
memcpy(pBuf, &((u8 *)(pMap->pMapRegion))[offset-iMap], nCopy);
pBuf = &((u8 *)pBuf)[nCopy];
amt -= nCopy;
offset += nCopy;
}
}
iMap = pMap->mmapSize;
}
got = seekAndRead(pFile, offset, pBuf, amt);
@@ -3194,6 +3218,8 @@ static int unixWrite(
int wrote = 0;
assert( id );
assert( amt>0 );
int i;
sqlite3_int64 iMap = 0;
/* If this is a database file (not a journal, master-journal or temp
** file), the bytes in the locking range should never be read or written. */
@@ -3226,19 +3252,22 @@ static int unixWrite(
}
#endif
/* Deal with as much of this write request as possible by transfering
** data from the memory mapping using memcpy(). */
if( offset<pFile->mmapSize ){
if( offset+amt <= pFile->mmapSize ){
memcpy(&((u8 *)(pFile->pMapRegion))[offset], pBuf, amt);
return SQLITE_OK;
}else{
int nCopy = pFile->mmapSize - offset;
memcpy(&((u8 *)(pFile->pMapRegion))[offset], pBuf, nCopy);
pBuf = &((u8 *)pBuf)[nCopy];
amt -= nCopy;
offset += nCopy;
for(i=0; i<2; i++){
unixMapping *pMap = &pFile->aMmap[i];
sqlite3_int64 iEnd = iMap + pMap->mmapSize;
if( offset<iEnd ){
if( offset+amt <= iEnd ){
memcpy(&((u8 *)(pMap->pMapRegion))[offset-iMap], pBuf, amt);
return SQLITE_OK;
}else{
int nCopy = iEnd - offset;
memcpy(&((u8 *)(pMap->pMapRegion))[offset-iMap], pBuf, nCopy);
pBuf = &((u8 *)pBuf)[nCopy];
amt -= nCopy;
offset += nCopy;
}
}
iMap = pMap->mmapSize;
}
while( amt>0 && (wrote = seekAndWrite(pFile, offset, pBuf, amt))>0 ){
@@ -3510,6 +3539,8 @@ static int unixTruncate(sqlite3_file *id, i64 nByte){
pFile->lastErrno = errno;
return unixLogError(SQLITE_IOERR_TRUNCATE, "ftruncate", pFile->zPath);
}else{
int i;
#ifdef SQLITE_DEBUG
/* If we are doing a normal write to a database file (as opposed to
** doing a hot-journal rollback or a write to some file other than a
@@ -3527,8 +3558,13 @@ static int unixTruncate(sqlite3_file *id, i64 nByte){
** mapped region, reduce the effective mapping size as well. SQLite will
** use read() and write() to access data beyond this point from now on.
*/
if( nByte<pFile->mmapSize ){
pFile->mmapSize = nByte;
for(i=1; i>=0; i--){
unixMapping *pMap = &pFile->aMmap[i];
sqlite3_int64 iEnd = pMap->mmapSize + (i==1 ? pMap[-1].mmapSize : 0);
if( nByte<iEnd ){
pMap->mmapSize -= (iEnd - nByte);
if( pMap->mmapSize<0 ) pMap->mmapSize = 0;
}
}
return SQLITE_OK;
@@ -3621,14 +3657,16 @@ static int fcntlSizeHint(unixFile *pFile, i64 nByte){
if( pFile->mmapLimit>0 ){
int rc;
sqlite3_int64 nSz = nByte;
if( pFile->szChunk<=0 ){
if( robust_ftruncate(pFile->h, nByte) ){
nSz = ((nSz+pFile->szSyspage-1) / pFile->szSyspage) * pFile->szSyspage;
if( robust_ftruncate(pFile->h, nSz) ){
pFile->lastErrno = errno;
return unixLogError(SQLITE_IOERR_TRUNCATE, "ftruncate", pFile->zPath);
}
}
rc = unixMapfile(pFile, nByte);
rc = unixMapfile(pFile, nSz);
return rc;
}
@@ -4509,15 +4547,32 @@ static int unixShmUnmap(
** If it is currently memory mapped, unmap file pFd.
*/
static void unixUnmapfile(unixFile *pFd){
int i;
assert( pFd->nFetchOut==0 );
if( pFd->pMapRegion ){
osMunmap(pFd->pMapRegion, pFd->mmapOrigsize);
pFd->pMapRegion = 0;
pFd->mmapSize = 0;
pFd->mmapOrigsize = 0;
for(i=0; i<2; i++){
unixMapping *pMap = &pFd->aMmap[i];
if( pMap->pMapRegion ){
osMunmap(pMap->pMapRegion, pMap->mmapOrigsize);
pMap->pMapRegion = 0;
pMap->mmapSize = 0;
pMap->mmapOrigsize = 0;
}
}
}
/*
** Return the system page size somehow.
*/
static int unixGetPagesize(void){
#if HAVE_REMAP
return 512;
#elif _BSD_SOURCE
return getpagesize();
#else
return (int)sysconf(_SC_PAGESIZE);
#endif
}
/*
** Memory map or remap the file opened by file-descriptor pFd (if the file
** is already mapped, the existing mapping is replaced by the new). Or, if
@@ -4535,12 +4590,17 @@ static void unixUnmapfile(unixFile *pFd){
** code otherwise.
*/
static int unixMapfile(unixFile *pFd, i64 nByte){
i64 nMap = nByte;
i64 nMap; /* Number of bytes of file to map */
int rc;
assert( nMap>=0 || pFd->nFetchOut==0 );
if( pFd->nFetchOut>0 ) return SQLITE_OK;
/* Set variable nMap to the number of bytes of the file to map. This is
** the smaller of argument nByte and the limit configured by
** SQLITE_FCNTL_MMAP_LIMIT. Or, if nByte is less than zero, the smaller
** of the file size or the SQLITE_FCNTL_MMAP_LIMIT value. */
nMap = nByte;
if( nMap<0 ){
struct stat statbuf; /* Low-level file information */
rc = osFstat(pFd->h, &statbuf);
@@ -4553,29 +4613,71 @@ static int unixMapfile(unixFile *pFd, i64 nByte){
nMap = pFd->mmapLimit;
}
if( nMap!=pFd->mmapSize ){
void *pNew = 0;
if( nMap!=(pFd->aMmap[0].mmapSize + pFd->aMmap[1].mmapSize) ){
#if defined(__linux__) && defined(_GNU_SOURCE)
if( pFd->pMapRegion && nMap>0 ){
pNew = osMremap(pFd->pMapRegion, pFd->mmapOrigsize, nMap, MREMAP_MAYMOVE);
}else
/* If the request is for a mapping zero bytes in size, or there are
** currently already two mapping regions, or there is already a mapping
** region that is not a multiple of the page-size in size, unmap
** everything. */
if( nMap==0
#if !HAVE_MREMAP
|| (pFd->aMmap[0].pMapRegion && pFd->aMmap[1].pMapRegion)
|| (pFd->aMmap[0].mmapSize % pFd->szSyspage)
#endif
{
){
unixUnmapfile(pFd);
if( nMap>0 ){
int flags = PROT_READ;
if( (pFd->ctrlFlags & UNIXFILE_RDONLY)==0 ) flags |= PROT_WRITE;
}
assert( pFd->aMmap[1].pMapRegion==0 );
if( nMap>0 ){
unixMapping *pMap = &pFd->aMmap[0]; /* First mapping object */
void *pNew = 0;
int iNew = 0;
int flags = PROT_READ;
if( (pFd->ctrlFlags & UNIXFILE_RDONLY)==0 ) flags |= PROT_WRITE;
/* If there are currently no mappings, create a new one */
if( pMap->pMapRegion==0 ){
pNew = osMmap(0, nMap, flags, MAP_SHARED, pFd->h, 0);
}
}
#if HAVE_MREMAP
/* If we have an mremap() call, resize the existing mapping. */
else{
pNew = osMremap(
pMap->pMapRegion, pMap->mmapOrigsize, nMap, MREMAP_MAYMOVE
);
}
#else
/* Otherwise, create a second mapping. If the existing mapping is
** a multiple of the page-size in size, then request that the new
** mapping immediately follow the old in virtual memory. */
else{
i64 nNew; /* Bytes to map with this call */
void *pAddr = 0; /* Virtual address to request mapping at */
if( pNew==MAP_FAILED ){
return SQLITE_IOERR_MMAP;
nNew = nMap - pMap->mmapSize;
if( pMap->mmapSize==pMap->mmapOrigsize ){
pAddr = (void *)&((u8 *)pMap->pMapRegion)[pMap->mmapSize];
}
pNew = osMmap(pAddr, nNew, flags, MAP_SHARED, pFd->h, pMap->mmapSize);
if( pAddr && pNew==pAddr ){
pNew = pMap->pMapRegion;
}else{
iNew = 1;
nMap = nNew;
}
}
#endif
if( pNew==MAP_FAILED ){
return SQLITE_IOERR_MMAP;
}
pFd->aMmap[iNew].pMapRegion = pNew;
pFd->aMmap[iNew].mmapSize = nMap;
pFd->aMmap[iNew].mmapOrigsize = nMap;
}
pFd->pMapRegion = pNew;
pFd->mmapSize = nMap;
pFd->mmapOrigsize = nMap;
}
return SQLITE_OK;
@@ -4598,13 +4700,22 @@ static int unixFetch(sqlite3_file *fd, i64 iOff, int nAmt, void **pp){
*pp = 0;
if( pFd->mmapLimit>0 ){
if( pFd->pMapRegion==0 ){
int i;
sqlite3_int64 iMap = 0;
if( pFd->aMmap[0].pMapRegion==0 ){
int rc = unixMapfile(pFd, -1);
if( rc!=SQLITE_OK ) return rc;
}
if( pFd->mmapSize >= iOff+nAmt ){
*pp = &((u8 *)pFd->pMapRegion)[iOff];
pFd->nFetchOut++;
for(i=0; i<2; i++){
unixMapping *pMap = &pFd->aMmap[i];
if( iOff>=iMap && iOff+nAmt<=(iMap + pMap->mmapSize) ){
*pp = &((u8 *)pMap->pMapRegion)[iOff-iMap];
pFd->nFetchOut++;
break;
}
iMap = pMap->mmapSize;
}
}
return SQLITE_OK;
@@ -4629,7 +4740,9 @@ static int unixUnfetch(sqlite3_file *fd, i64 iOff, void *p){
assert( (p==0)==(pFd->nFetchOut==0) );
/* If p!=0, it must match the iOff value. */
#if 0
assert( p==0 || p==&((u8 *)pFd->pMapRegion)[iOff] );
#endif
if( p ){
pFd->nFetchOut--;
@@ -5591,6 +5704,7 @@ static int unixOpen(
}
#endif
p->szSyspage = unixGetPagesize();
rc = fillInUnixFile(pVfs, fd, pFile, zPath, ctrlFlags);
open_finished:
+3 -3
View File
@@ -3360,10 +3360,8 @@ static void pagerFixMaplimit(Pager *pPager){
sqlite3_file *fd = pPager->fd;
if( isOpen(fd) ){
pPager->bUseFetch = (fd->pMethods->iVersion>=3) && pPager->mxMmap>0;
if( pPager->bUseFetch ){
sqlite3OsFileControlHint(pPager->fd, SQLITE_FCNTL_MMAP_LIMIT,
sqlite3OsFileControlHint(pPager->fd, SQLITE_FCNTL_MMAP_LIMIT,
(void*)&pPager->mxMmap);
}
}
}
@@ -3639,7 +3637,9 @@ int sqlite3PagerMaxPageCount(Pager *pPager, int mxPage){
pPager->mxPgno = mxPage;
}
assert( pPager->eState!=PAGER_OPEN ); /* Called only by OP_MaxPgcnt */
#if 0
assert( pPager->mxPgno>=pPager->dbSize ); /* OP_MaxPgcnt enforces this */
#endif
return pPager->mxPgno;
}
+1 -1
View File
@@ -1208,7 +1208,7 @@ finished:
*/
if( pWal->hdr.nPage ){
sqlite3_log(SQLITE_OK, "Recovered %d frames from WAL file %s",
pWal->hdr.nPage, pWal->zWalName
pWal->hdr.mxFrame, pWal->zWalName
);
}
}
+4 -4
View File
@@ -32,7 +32,7 @@ proc make_str {char len} {
# Return the number of pages in the file test.db by looking at the file system.
proc file_pages {} {
return [expr [file size test.db] / 1024]
file_page_count test.db
}
#-------------------------------------------------------------------------
@@ -614,7 +614,7 @@ do_test autovacuum-7.1 {
INSERT INTO t1 SELECT randstr(400,400), randstr(400,400) FROM t1; -- 32
}
expr {[file size test.db] / 1024}
file_page_count test.db
} {73}
do_test autovacuum-7.2 {
@@ -628,7 +628,7 @@ do_test autovacuum-7.2 {
CREATE TABLE t5(a, b, PRIMARY KEY(a, b));
INSERT INTO t5 SELECT randstr(400,400), randstr(400,400) FROM t1; -- 2
}
expr {[file size test.db] / 1024}
file_page_count test.db
} {354}
do_test autovacuum-7.3 {
@@ -640,7 +640,7 @@ do_test autovacuum-7.3 {
COMMIT;
SELECT count(*) FROM t1;
}
expr {[file size test.db] / 1024}
file_page_count test.db
} {286}
#------------------------------------------------------------------------
+1 -1
View File
@@ -661,7 +661,7 @@ do_test backup-6.1 {
}
} {}
do_test backup-6.2 {
set nTotal [expr {[file size test.db]/1024}]
set nTotal [file_page_count test.db]
sqlite3_backup B db2 main db main
B step 1
} {SQLITE_OK}
+1 -1
View File
@@ -63,7 +63,7 @@ do_execsql_test 2.1 {
CREATE TABLE t1(a, b);
CREATE INDEX i1 ON t1(a, b);
}
do_test 2.2 { file size test.db } [expr $AUTOVACUUM ? 4096 : 3072]
do_test 2.2 { file_page_count test.db } [expr $AUTOVACUUM ? 4 : 3]
do_test 2.3 {
sqlite3 db1 test.db2
+1 -1
View File
@@ -334,7 +334,7 @@ ifcapable autovacuum {
INSERT INTO t1 VALUES(3, randomblob(2500));
DELETE FROM t1 WHERE a = 1;
} -corrupt {
set nPage [expr [file size corrupt.db] / 1024]
set nPage [file_page_count corrupt.db]
hexio_write corrupt.db [expr 1024 + ($nPage-3)*5] 010000000
} -test {
do_test corrupt2-6.3 {
+2 -2
View File
@@ -40,8 +40,8 @@ do_test corrupt3-1.1 {
CREATE TABLE t1(x);
INSERT INTO t1 VALUES($bigstring);
}
file size test.db
} [expr {1024*3}]
list [file_page_count test.db] [file_page_size test.db]
} {3 1024}
# Verify that the file format is as we expect. The page size
# should be 1024 bytes. The only record should have a single
+2 -2
View File
@@ -41,8 +41,8 @@ do_test corrupt6-1.1 {
INSERT INTO t1(x) VALUES('varint32-01234567890123456789012345678901234567890123456789');
INSERT INTO t1(x) VALUES('varint32-01234567890123456789012345678901234567890123456789');
}
file size test.db
} [expr {1024*2}]
file_page_count test.db
} {2}
# Verify that the file format is as we expect. The page size
# should be 1024 bytes.
+2 -2
View File
@@ -44,8 +44,8 @@ do_test corrupt7-1.1 {
INSERT INTO t1(x) SELECT x+4 FROM t1;
INSERT INTO t1(x) SELECT x+8 FROM t1;
}
file size test.db
} [expr {1024*2}]
file_page_count test.db
} {2}
# Verify that the file format is as we expect. The page size
# should be 1024 bytes.
+1 -1
View File
@@ -270,7 +270,7 @@ do_test corruptC-2.14 {
execsql { INSERT INTO t1 VALUES (1, $blob) }
sqlite3 db test.db
set filesize [file size test.db]
set filesize [expr [file_page_count test.db] * [file_page_size test.db]]
hexio_write test.db [expr $filesize-2048] 00000001
catchsql {DELETE FROM t1 WHERE rowid = (SELECT max(rowid) FROM t1)}
} {1 {database disk image is malformed}}
+2 -2
View File
@@ -56,7 +56,7 @@ do_test 1.1 { create_test_db } {}
# Check the db is as we expect. 6 pages in total, with 3 and 4 on the free
# list. Page 3 is the free list trunk and page 4 is a leaf.
#
do_test 1.2 { file size test.db } [expr 6*1024]
do_test 1.2 { file_page_count test.db } 6
do_test 1.3 { hexio_read test.db 32 4 } 00000003
do_test 1.4 { hexio_read test.db [expr 2*1024] 12 } 000000000000000100000004
@@ -109,7 +109,7 @@ for {set i 0} {$i < 128} {incr i} {
}
do_test 2.1 { create_test_db } {}
do_test 2.2 { file size test.db } [expr 6*1024]
do_test 2.2 { file_page_count test.db } 6
do_test 2.3 { hexio_read test.db 32 4 } 00000003
do_test 2.4 { hexio_read test.db [expr 2*1024] 12 } 000000000000000100000004
+1 -1
View File
@@ -330,7 +330,7 @@ do_test crash-5.1 {
}
} {}
do_test crash-5.2 {
expr [file size test.db] / 1024
file_page_count test.db
} [expr [string match [execsql {pragma auto_vacuum}] 1] ? 11 : 10]
set sig [signature]
do_test crash-5.3 {
+2 -2
View File
@@ -52,8 +52,8 @@ for {set av 0} {$av<=$upperBound} {incr av} {
}
do_test createtab-$av.2 {
file size test.db
} [expr {1024*(4+($av!=0)+(${isUtf16}*2))}]
file_page_count test.db
} [expr {4+($av!=0)+(${isUtf16}*2)}]
# Start reading the table
#
+1
View File
@@ -20,6 +20,7 @@ set ::testprefix dbstatus2
do_execsql_test 1.0 {
PRAGMA page_size = 1024;
PRAGMA auto_vacuum = 0;
PRAGMA mmap_limit = 0;
CREATE TABLE t1(a PRIMARY KEY, b);
INSERT INTO t1 VALUES(1, randomblob(600));
+1 -1
View File
@@ -42,7 +42,7 @@ proc create_db {{sql ""}} {
}
}
return [expr {[file size test.db] / 1024}]
return [file_page_count test.db]
}
# This proc returns the number of contiguous blocks of pages that make up
+2
View File
@@ -65,6 +65,7 @@ ifcapable pager_pragmas {
db close
forcedelete test.db
sqlite3 db test.db
db eval "PRAGMA mmap_limit=0"
db eval "PRAGMA auto_vacuum=OFF"
db eval "PRAGMA page_size=$pagesize"
db eval {CREATE TABLE t1(x)}
@@ -215,6 +216,7 @@ do_execsql_test filefmt-3.3 {
reset_db
do_execsql_test filefmt-4.1 {
PRAGMA mmap_limit = 0;
PRAGMA auto_vacuum = 1;
CREATE TABLE t1(x, y);
CREATE TABLE t2(x, y);
+3 -3
View File
@@ -46,19 +46,19 @@ do_test format4-1.1 {
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
}
file size test.db
expr {1024 * [file_page_count test.db]}
} $small
do_test format4-1.2 {
execsql {
UPDATE t1 SET x0=1, x1=1, x2=1, x3=1, x4=1, x5=1, x6=1, x7=1, x8=1, x9=1
}
file size test.db
expr {1024 * [file_page_count test.db]}
} $small
do_test format4-1.3 {
execsql {
UPDATE t1 SET x0=2, x1=2, x2=2, x3=2, x4=2, x5=2, x6=2, x7=2, x8=2, x9=2
}
file size test.db
expr {1024 * [file_page_count test.db]}
} $large
+1 -1
View File
@@ -619,7 +619,7 @@ do_test incrblob-7.3.1 {
read $::b
} $::otherdata
do_test incrblob-7.3.2 {
expr [file size test.db]/1024
file_page_count test.db
} 30
do_test incrblob-7.3.3 {
execsql {
+10 -10
View File
@@ -149,21 +149,21 @@ do_test incrvacuum-3.2 {
# 4 -> table tbl2
# 5 -> table tbl2 overflow page.
#
expr {[file size test.db] / 1024}
file_page_count test.db
} {5}
do_test incrvacuum-3.3 {
execsql {
DROP TABLE abc;
DELETE FROM tbl2;
}
expr {[file size test.db] / 1024}
file_page_count test.db
} {5}
do_test incrvacuum-3.4 {
execsql {
PRAGMA auto_vacuum = 1;
INSERT INTO tbl2 VALUES('hello world');
}
expr {[file size test.db] / 1024}
file_page_count test.db
} {3}
#---------------------------------------------------------------------
@@ -178,14 +178,14 @@ do_test incrvacuum-4.1 {
INSERT INTO tbl2 VALUES($::str);
CREATE TABLE tbl1(a, b, c);
}
expr {[file size test.db] / 1024}
file_page_count test.db
} {5}
do_test incrvacuum-4.2 {
execsql {
DELETE FROM tbl2;
DROP TABLE tbl1;
}
expr {[file size test.db] / 1024}
file_page_count test.db
} {5}
do_test incrvacuum-4.3 {
set ::nStep 0
@@ -221,7 +221,7 @@ do_test incrvacuum-5.2.1 {
PRAGMA incremental_vacuum; -- this is a no-op.
COMMIT;
}
expr {[file size test.db] / 1024}
file_page_count test.db
} {4}
do_test incrvacuum-5.2.2 {
set ::str [string repeat abcdefghij 110]
@@ -232,7 +232,7 @@ do_test incrvacuum-5.2.2 {
DELETE FROM tbl1 WHERE oid%2; -- Put 2 overflow pages on free-list.
COMMIT;
}
expr {[file size test.db] / 1024}
file_page_count test.db
} {7}
do_test incrvacuum-5.2.3 {
execsql {
@@ -242,7 +242,7 @@ do_test incrvacuum-5.2.3 {
INSERT INTO tbl2 VALUES('a nice string');
COMMIT;
}
expr {[file size test.db] / 1024}
file_page_count test.db
} {6}
do_test incrvacuum-5.2.4 {
execsql {
@@ -255,7 +255,7 @@ do_test incrvacuum-5.2.5 {
DROP TABLE tbl2;
PRAGMA incremental_vacuum;
}
expr {[file size test.db] / 1024}
file_page_count test.db
} {1}
@@ -527,7 +527,7 @@ do_test incrvacuum-10.1 {
DROP TABLE t1;
DROP TABLE t2;
}
expr [file size test.db] / 1024
file_page_count test.db
} {29}
do_test incrvacuum-10.2 {
+6 -4
View File
@@ -418,8 +418,8 @@ ifcapable pager_pragmas {
do_test io-3.3 {
# The COMMIT requires a single fsync() - to the database file.
execsql { COMMIT }
list [file size test.db] [nSync]
} {39936 1}
list [file_page_count test.db] [nSync]
} {39 1}
}
#----------------------------------------------------------------------
@@ -488,7 +488,7 @@ do_test io-4.3.1 {
INSERT INTO abc SELECT * FROM abc;
INSERT INTO abc SELECT * FROM abc;
}
expr {[file size test.db]/1024}
file_page_count test.db
} {43}
ifcapable pager_pragmas {
do_test io-4.3.2 {
@@ -562,7 +562,9 @@ foreach {char sectorsize pgsize} {
CREATE TABLE abc(a, b, c);
}
expr {[file size test.db]/2}
} $pgsize
list [file_page_count test.db] [file_page_size test.db]
} [list 2 $pgsize]
}
sqlite3_simulate_device -char {} -sectorsize 0
+3 -1
View File
@@ -521,7 +521,9 @@ ifcapable pragma {
PRAGMA user_version;
}
} {memory 5}
do_test jrnlmode-7.2 { file size test.db } {1024}
do_test jrnlmode-7.2 {
list [file_page_count test.db] [file_page_size test.db]
} {1 1024}
}
do_execsql_test jrnlmode-8.1 { PRAGMA locking_mode=EXCLUSIVE } {exclusive}
+2 -2
View File
@@ -33,8 +33,8 @@ do_test lock4-1.1 {
CREATE TABLE t2(x)
}
db2 close
list [file size test.db] [file size test2.db]
} {2048 2048}
list [file_page_count test.db] [file_page_count test2.db]
} {2 2}
# Create a script to drive a separate process that will
#
+1
View File
@@ -62,6 +62,7 @@ ifcapable explain {
# Malloc failure during integrity_check pragma.
#
do_malloc_test mallocH-5 -sqlprep {
PRAGMA mmap_limit = 0;
CREATE TABLE t1(a PRIMARY KEY, b UNIQUE);
CREATE TABLE t2(x,y);
INSERT INTO t1 VALUES(1,2);
+10 -9
View File
@@ -1109,6 +1109,7 @@ do_test pager1-5.5.2 {
do_test pager1-6.1 {
faultsim_delete_and_reopen
execsql {
PRAGMA page_size = 4096;
PRAGMA auto_vacuum = none;
PRAGMA max_page_count = 10;
CREATE TABLE t2(a, b);
@@ -1357,8 +1358,8 @@ do_test pager1-9.3.3 {
db2 close
db close
tv delete
file size test.db2
} [file size test.db]
file_page_count test.db2
} [file_page_count test.db]
do_test pager1-9.4.1 {
faultsim_delete_and_reopen
@@ -1471,8 +1472,8 @@ do_test pager1.10.x.2 {
CREATE TABLE t2(x);
DROP TABLE t2;
}
file size test.db
} {33792}
list [file_page_count test.db] [file_page_size test.db]
} {33 1024}
do_test pager1.10.x.3 {
execsql {
BEGIN;
@@ -1552,7 +1553,7 @@ foreach pagesize {
PRAGMA page_size = $pagesize;
CREATE VIEW v AS SELECT * FROM sqlite_master;
" db2
file size test.db
file_page_size test.db
} $eff
do_test pager1-12.$pagesize.2 {
sqlite3 db2 test.db
@@ -2388,15 +2389,15 @@ do_test pager1-29.1 {
CREATE TABLE t1(a, b);
INSERT INTO t1 VALUES(1, 2);
}
file size test.db
} [expr 1024*3]
list [file_page_count test.db] [file_page_size test.db]
} {3 1024}
do_test pager1-29.2 {
execsql {
PRAGMA page_size = 4096;
VACUUM;
}
file size test.db
} [expr 4096*3]
list [file_page_count test.db] [file_page_size test.db]
} {3 4096}
#-------------------------------------------------------------------------
# Test that if an empty database file (size 0 bytes) is opened in
+6 -5
View File
@@ -1201,12 +1201,13 @@ do_faultsim_test pagerfault-26 -prep {
set contents [db eval {SELECT * FROM t1}]
if {$contents != "1 2"} { error "Bad database contents ($contents)" }
set sz [file size test.db]
if {$testrc!=0 && $sz!=1024*3 && $sz!=4096*3} {
error "Expected file size to be 3072 or 12288 bytes - actual size $sz bytes"
set nPg [file_page_count test.db]
set pgsz [file_page_size test.db]
if {$testrc!=0 && ($nPg!=3 || ($pgsz!=1024 && $pgsz!=4096))} {
error "File should be 3 pages. Page size 1024 or 4096 bytes. Is $nPg/$pgsz."
}
if {$testrc==0 && $sz!=4096*3} {
error "Expected file size to be 12288 bytes - actual size $sz bytes"
if {$testrc==0 && ($nPg!=3 || $pgsz!=4096)} {
error "File should be 3 pages. Page size 4096 bytes. Is $nPg/$pgsz."
}
}
+2 -2
View File
@@ -115,8 +115,8 @@ foreach PGSZ {512 2048 4096 8192} {
}
} $PGSZ
do_test pagesize-2.$PGSZ.3 {
file size test.db
} [expr {$PGSZ*($AUTOVACUUM?3:2)}]
list [file_page_count test.db] [file_page_size test.db]
} [list [expr ($AUTOVACUUM?3:2)] $PGSZ]
ifcapable {vacuum} {
do_test pagesize-2.$PGSZ.4 {
execsql {VACUUM}
+1 -1
View File
@@ -168,7 +168,7 @@ test_suite "full" -prefix "" -description {
} -files [
test_set $alltests
] -initialize {
unset -nocomplain ::G(isquick)
# unset -nocomplain ::G(isquick)
}
test_suite "threads" -prefix "" -description {
+4 -2
View File
@@ -262,6 +262,7 @@ do_test pragma-3.1 {
forcedelete test.db test.db-journal
sqlite3 db test.db
execsql {
PRAGMA mmap_limit=0;
PRAGMA auto_vacuum=OFF;
BEGIN;
CREATE TABLE t2(a,b,c);
@@ -284,6 +285,7 @@ ifcapable attach {
hexio_write test.db $offset 0a00000000040000000000
db close
sqlite3 db test.db
execsql {PRAGMA mmap_limit=0}
execsql {PRAGMA integrity_check}
} {{rowid 1 missing from index i2} {rowid 2 missing from index i2} {wrong # of entries in index i2}}
do_test pragma-3.3 {
@@ -1251,8 +1253,8 @@ ifcapable pager_pragmas {
do_test pragma-14.4 {
set page_size [db one {pragma page_size}]
expr [file size test.db] / $page_size
} {2}
list [file_page_count test.db] $page_size
} [list 2 [file_page_size test.db]]
do_test pragma-14.5 {
execsql {
+2 -2
View File
@@ -86,8 +86,8 @@ ifcapable attach {
}
} {0}
do_test pragma2-2.4 {
expr {[file size test2.db] / 1024}
} {11}
list [file_page_count test2.db] [file_page_size test2.db]
} {11 1024}
do_test pragma2-2.5 {
execsql {
DELETE FROM aux.abc;
+4
View File
@@ -71,6 +71,7 @@ do_test quota-2.1.1 {
do_test quota-2.1.2 {
sqlite3 db test.db
execsql {
PRAGMA mmap_limit=0;
PRAGMA page_size=1024;
PRAGMA auto_vacuum=OFF;
PRAGMA journal_mode=DELETE;
@@ -143,6 +144,7 @@ do_test quota-3.1.1 {
do_test quota-3.1.2 {
sqlite3 db test.db
execsql {
PRAGMA mmap_limit = 0;
PRAGMA page_size = 1024;
PRAGMA journal_mode = delete;
PRAGMA auto_vacuum = off;
@@ -154,6 +156,7 @@ do_test quota-3.1.2 {
do_test quota-3.1.3 {
sqlite3 db2 test.db
set ::quota [list]
execsql { PRAGMA mmap_limit=0 } db2
execsql { CREATE TABLE t2(a, b) } db2
set ::quota
} {}
@@ -179,6 +182,7 @@ do_test quota-3.2.1 {
foreach db {db1a db2a} {
execsql {
PRAGMA mmap_limit=0;
PRAGMA page_size = 1024;
PRAGMA journal_mode = delete;
PRAGMA auto_vacuum = off;
+2 -2
View File
@@ -534,7 +534,7 @@ do_test sqllimits1-7.7.1 {
INSERT INTO abc SELECT b, a, c FROM abc;
INSERT INTO abc SELECT c, b, a FROM abc;
}
expr [file size test.db] / 1024
file_page_count test.db
} $fsize
do_test sqllimits1-7.7.2 {
db close
@@ -550,7 +550,7 @@ do_test sqllimits1-7.7.3 {
execsql {
PRAGMA max_page_count;
}
} $fsize
} [expr [file size test.db] / 1024]
do_test sqllimits1-7.7.4 {
execsql {
DROP TABLE abc;
+30
View File
@@ -1636,6 +1636,7 @@ proc sql36231 {sql} {
set B [hexio_read test.db 92 8]
set A [hexio_read test.db 28 4]
sqlite3 db36231 test.db
db36231 eval { PRAGMA mmap_limit = 0 }
catch { db36231 func a_string a_string }
execsql $sql db36231
db36231 close
@@ -1674,6 +1675,35 @@ proc db_delete_and_reopen {{file test.db}} {
sqlite3 db $file
}
# Return the number of pages in the database file $zFile, according to
# the database header.
#
proc file_page_count {zFile} {
set nPg [hexio_get_int [hexio_read $zFile 28 4]]
set pgsz [file_page_size $zFile]
set filesz [file size $zFile]
set syspgsz 4096
# Check that the file size is consistent with the database page size,
# the page count, and the system page size.
if {($filesz < ($nPg * $pgsz))
|| ($filesz > (((($nPg * $pgsz)+$syspgsz-1) / $syspgsz) * $syspgsz))
} {
error "file_size=$filesz. page_count=$nPg. page_size=$pgsz."
}
return $nPg
}
# Return the page size of database file $zFile, according to the database
# header.
#
proc file_page_size {zFile} {
set pgsz [hexio_get_int [hexio_read $zFile 16 2]]
if {$pgsz==1} {set pgsz 65536}
return $pgsz
}
# If the library is compiled with the SQLITE_DEFAULT_AUTOVACUUM macro set
# to non-zero, then set the global variable $AUTOVACUUM to 1.
set AUTOVACUUM $sqlite_options(default_autovacuum)
+6 -6
View File
@@ -35,20 +35,20 @@ do_test tkt1512-1.1 {
}
} {1 2 3 4}
do_test tkt1512-1.2 {
file size test.db
} {2048}
file_page_count test.db
} {2}
do_test tkt1512-1.3 {
execsql {
DROP TABLE t1;
}
file size test.db
} {2048}
file_page_count test.db
} {2}
do_test tkt1512-1.4 {
execsql {
VACUUM;
}
file size test.db
} {1024}
file_page_count test.db
} {1}
finish_test
+2 -2
View File
@@ -26,8 +26,8 @@ do_test tkt2920-1.1 {
PRAGMA auto_vacuum=0;
CREATE TABLE filler (fill);
}
file size test.db
} {2048}
list [file_page_count test.db] [file_page_size test.db]
} {2 1024}
do_test tkt2920-1.2 {
db eval BEGIN
for {set i 0} {$i<34} {incr i} {
+6 -5
View File
@@ -42,8 +42,8 @@ do_test vacuum3-1.2 {
execsql { PRAGMA page_size }
} {1024}
do_test vacuum3-1.3 {
file size test.db
} {2048}
file_page_count test.db
} {2}
set I 4
foreach {request actual database} [list \
@@ -63,7 +63,8 @@ foreach {request actual database} [list \
execsql { PRAGMA page_size }
} $actual
do_test vacuum3-1.$I.2 {
file size test.db
set nPg [file_page_count test.db]
expr {$nPg * $actual}
} $database
do_test vacuum3-1.$I.3 {
execsql { SELECT * FROM t1 }
@@ -84,8 +85,8 @@ do_test vacuum3-2.1 {
ALTER TABLE t1 ADD COLUMN d;
UPDATE t1 SET d = randomblob(1000);
}
file size test.db
} {3072}
file_page_count test.db
} {3}
do_test vacuum3-2.2 {
execsql { PRAGMA page_size }
} {1024}
+48 -45
View File
@@ -67,8 +67,8 @@ do_test wal-0.1 {
execsql { PRAGMA journal_mode = wal }
} {wal}
do_test wal-0.2 {
file size test.db
} {1024}
file_page_count test.db
} {1}
do_test wal-1.0 {
execsql {
@@ -77,8 +77,8 @@ do_test wal-1.0 {
}
list [file exists test.db-journal] \
[file exists test.db-wal] \
[file size test.db]
} {0 1 1024}
[file_page_count test.db]
} {0 1 1}
do_test wal-1.1 {
execsql COMMIT
list [file exists test.db-journal] [file exists test.db-wal]
@@ -347,8 +347,8 @@ foreach sector {512 4096} {
INSERT INTO t1 VALUES(1, 2);
"
db close
file size test.db
} [expr $pgsz*2]
list [file_page_count test.db] [file_page_size test.db]
} [list 2 $pgsz]
do_test wal-6.$sector.$pgsz.2 {
log_deleted test.db-wal
@@ -364,12 +364,16 @@ do_test wal-7.1 {
CREATE TABLE t1(a, b);
INSERT INTO t1 VALUES(1, 2);
}
list [file size test.db] [file size test.db-wal]
} [list 1024 [wal_file_size 3 1024]]
list [file_page_count test.db] \
[file_page_size test.db] \
[file size test.db-wal]
} [list 1 1024 [wal_file_size 3 1024]]
do_test wal-7.2 {
execsql { PRAGMA wal_checkpoint }
list [file size test.db] [file size test.db-wal]
} [list 2048 [wal_file_size 3 1024]]
list [file_page_count test.db] \
[file_page_size test.db] \
[file size test.db-wal]
} [list 2 1024 [wal_file_size 3 1024]]
# Execute some transactions in auto-vacuum mode to test database file
# truncation.
@@ -428,8 +432,8 @@ do_test wal-9.1 {
INSERT INTO t1 SELECT blob(900) FROM t1; /* 128 */
INSERT INTO t1 SELECT blob(900) FROM t1; /* 256 */
}
file size test.db
} 1024
file_page_count test.db
} 1
do_test wal-9.2 {
sqlite3_wal db2 test.db
execsql {PRAGMA integrity_check } db2
@@ -681,15 +685,15 @@ do_test wal-11.1 {
PRAGMA page_size = 1024;
CREATE TABLE t1(x PRIMARY KEY);
}
list [expr [file size test.db]/1024] [expr [file size test.db-wal]/1044]
list [file_page_count test.db] [expr [file size test.db-wal]/1044]
} {1 3}
do_test wal-11.2 {
execsql { PRAGMA wal_checkpoint }
list [expr [file size test.db]/1024] [file size test.db-wal]
list [file_page_count test.db] [file size test.db-wal]
} [list 3 [wal_file_size 3 1024]]
do_test wal-11.3 {
execsql { INSERT INTO t1 VALUES( blob(900) ) }
list [expr [file size test.db]/1024] [file size test.db-wal]
list [file_page_count test.db] [file size test.db-wal]
} [list 3 [wal_file_size 4 1024]]
do_test wal-11.4 {
@@ -700,7 +704,7 @@ do_test wal-11.4 {
INSERT INTO t1 SELECT blob(900) FROM t1; -- 8
INSERT INTO t1 SELECT blob(900) FROM t1; -- 16
}
list [expr [file size test.db]/1024] [file size test.db-wal]
list [file_page_count test.db] [file size test.db-wal]
} [list 3 [wal_file_size 32 1024]]
do_test wal-11.5 {
execsql {
@@ -710,7 +714,7 @@ do_test wal-11.5 {
} {16 ok}
do_test wal-11.6 {
execsql COMMIT
list [expr [file size test.db]/1024] [file size test.db-wal]
list [file_page_count test.db] [file size test.db-wal]
} [list 3 [wal_file_size 41 1024]]
do_test wal-11.7 {
execsql {
@@ -720,11 +724,11 @@ do_test wal-11.7 {
} {16 ok}
do_test wal-11.8 {
execsql { PRAGMA wal_checkpoint }
list [expr [file size test.db]/1024] [file size test.db-wal]
list [file_page_count test.db] [file size test.db-wal]
} [list 37 [wal_file_size 41 1024]]
do_test wal-11.9 {
db close
list [expr [file size test.db]/1024] [log_deleted test.db-wal]
list [file_page_count test.db] [log_deleted test.db-wal]
} {37 1}
sqlite3_wal db test.db
set nWal 39
@@ -736,7 +740,7 @@ do_test wal-11.10 {
INSERT INTO t1 SELECT blob(900) FROM t1; -- 32
SELECT count(*) FROM t1;
}
list [expr [file size test.db]/1024] [file size test.db-wal]
list [file_page_count test.db] [file size test.db-wal]
} [list 37 [wal_file_size $nWal 1024]]
do_test wal-11.11 {
execsql {
@@ -746,7 +750,7 @@ do_test wal-11.11 {
}
} {32 16}
do_test wal-11.12 {
list [expr [file size test.db]/1024] [file size test.db-wal]
list [file_page_count test.db] [file size test.db-wal]
} [list 37 [wal_file_size $nWal 1024]]
do_test wal-11.13 {
execsql {
@@ -756,7 +760,7 @@ do_test wal-11.13 {
}
} {17 ok}
do_test wal-11.14 {
list [expr [file size test.db]/1024] [file size test.db-wal]
list [file_page_count test.db] [file size test.db-wal]
} [list 37 [wal_file_size $nWal 1024]]
@@ -773,7 +777,7 @@ do_test wal-12.1 {
CREATE TABLE t2(x, y);
INSERT INTO t1 VALUES('A', 1);
}
list [expr [file size test.db]/1024] [file size test.db-wal]
list [file_page_count test.db] [file size test.db-wal]
} [list 1 [wal_file_size 5 1024]]
do_test wal-12.2 {
db close
@@ -782,11 +786,11 @@ do_test wal-12.2 {
PRAGMA synchronous = normal;
UPDATE t1 SET y = 0 WHERE x = 'A';
}
list [expr [file size test.db]/1024] [expr [file size test.db-wal]/1044]
list [file_page_count test.db] [expr [file size test.db-wal]/1044]
} {3 1}
do_test wal-12.3 {
execsql { INSERT INTO t2 VALUES('B', 1) }
list [expr [file size test.db]/1024] [expr [file size test.db-wal]/1044]
list [file_page_count test.db] [expr [file size test.db-wal]/1044]
} {3 2}
do_test wal-12.4 {
forcecopy test.db test2.db
@@ -851,7 +855,6 @@ do_test wal-13.1.2 {
sqlite3 db test.db
execsql { SELECT * FROM t2 }
} {B 2}
breakpoint
do_test wal-13.1.3 {
db close
file exists test.db-wal
@@ -1022,8 +1025,8 @@ do_test wal-15.4.5 {
sqlite3_errmsg db
} {not an error}
do_test wal-15.4.6 {
file size test.db
} [expr 1024*2]
list [file_page_count test.db] [file_page_size test.db]
} {2 1024}
catch { db2 close }
catch { db close }
@@ -1071,21 +1074,21 @@ foreach {tn ckpt_cmd ckpt_res ckpt_main ckpt_aux} {
INSERT INTO t1 SELECT * FROM t2;
}
list [file size test.db] [file size test.db-wal]
} [list [expr 1*1024] [wal_file_size 10 1024]]
list [file_page_count test.db] [file size test.db-wal]
} [list 1 [wal_file_size 10 1024]]
do_test wal-16.$tn.3 {
list [file size test2.db] [file size test2.db-wal]
} [list [expr 1*1024] [wal_file_size 13 1024]]
list [file_page_count test2.db] [file size test2.db-wal]
} [list 1 [wal_file_size 13 1024]]
do_test wal-16.$tn.4 [list eval $ckpt_cmd] $ckpt_res
do_test wal-16.$tn.5 {
list [file size test.db] [file size test.db-wal]
} [list [expr ($ckpt_main ? 7 : 1)*1024] [wal_file_size 10 1024]]
list [file_page_count test.db] [file size test.db-wal]
} [list [expr ($ckpt_main ? 7 : 1)] [wal_file_size 10 1024]]
do_test wal-16.$tn.6 {
list [file size test2.db] [file size test2.db-wal]
} [list [expr ($ckpt_aux ? 7 : 1)*1024] [wal_file_size 13 1024]]
list [file_page_count test2.db] [file size test2.db-wal]
} [list [expr ($ckpt_aux ? 7 : 1)] [wal_file_size 13 1024]]
catch { db close }
}
@@ -1145,13 +1148,13 @@ foreach {tn sectorsize logsize} "
} $logsize
do_test wal-17.$tn.2 {
file size test.db
} 512
file_page_count test.db
} 1
do_test wal-17.$tn.3 {
db close
file size test.db
} [expr 512*171]
file_page_count test.db
} 171
}
sqlite3_test_control_pending_byte $old_pending_byte
@@ -1186,8 +1189,8 @@ do_test wal-18.0 {
forcecopy test.db testX.db
forcecopy test.db-wal testX.db-wal
db close
list [file size testX.db] [file size testX.db-wal]
} [list [expr 3*1024] [wal_file_size 6 1024]]
list [file_page_count testX.db] [file size testX.db-wal]
} [list 3 [wal_file_size 6 1024]]
unset -nocomplain nFrame result
foreach {nFrame result} {
@@ -1267,7 +1270,7 @@ foreach {tn pgsz works} {
#
do_test wal-18.2.$tn.$pg.1 { file exists test.db-wal } 0
do_test wal-18.2.$tn.$pg.2 { file exists test.db } 1
do_test wal-18.2.$tn.$pg.3 { file size test.db } [expr 1024*3]
do_test wal-18.2.$tn.$pg.3 { file_page_count test.db } 3
do_test wal-18.2.$tn.$pg.4 {
@@ -1509,8 +1512,8 @@ do_test wal-23.3 {
db close
set ::log [list]
faultsim_restore_and_reopen
execsql { SELECT * FROM t1 }
} {1 2 3 4}
execsql { SELECT * FROM t1 ; PRAGMA page_size }
} {1 2 3 4 1024}
set nPage [expr 2+$AUTOVACUUM]
do_test wal-23.4 {
set ::log
+3 -3
View File
@@ -21,7 +21,7 @@ ifcapable !wal {finish_test ; return }
set testprefix wal5
proc db_page_count {{file test.db}} { expr [file size $file] / 1024 }
proc db_page_count {{file test.db}} { file_page_count $file }
proc wal_page_count {{file test.db}} { wal_frame_count ${file}-wal 1024 }
@@ -101,8 +101,8 @@ foreach {testprefix do_wal_checkpoint} {
INSERT INTO t1 VALUES(2, zeroblob(1200));
INSERT INTO t1 VALUES(3, zeroblob(1200));
}
expr [file size test.db] / 1024
} {2}
list [file_page_count test.db] [file_page_size test.db]
} {2 1024}
# Have connection 2 grab a read-lock on the current snapshot.
do_test 1.$tn.2 { sql2 { BEGIN; SELECT x FROM t1 } } {1 2 3}
+1 -1
View File
@@ -63,7 +63,7 @@ do_execsql_test 1.2 {
#
# The sizes of various files are slightly different in normal and
# auto-vacuum mode.
do_test 1.3 { file size test.db } {1024}
do_test 1.3 { file_page_count test.db } {1}
do_test 1.4 { expr {[file size test.db-wal]>(1500*1024)} } {1}
do_test 1.5 { expr {[file size test.db-shm]>32768} } {1}
do_test 1.6 {
+4 -4
View File
@@ -50,8 +50,8 @@ do_test walbak-1.0 {
do_test walbak-1.1 {
forcedelete bak.db bak.db-journal bak.db-wal
db backup bak.db
file size bak.db
} [expr 3*1024]
file_page_count bak.db
} 3
do_test walbak-1.2 {
sqlite3 db2 bak.db
execsql {
@@ -73,8 +73,8 @@ do_test walbak-1.4 {
}
} {wal}
do_test walbak-1.5 {
list [file size test.db] [file size test.db-wal]
} [list 1024 [wal_file_size 6 1024]]
list [file_page_count test.db] [file size test.db-wal]
} [list 1 [wal_file_size 6 1024]]
do_test walbak-1.6 {
execsql { PRAGMA wal_checkpoint }
list [file size test.db] [file size test.db-wal]
+6 -6
View File
@@ -176,8 +176,8 @@ foreach endian {big little} {
forcecopy test.db-wal test2.db-wal
db close
list [file size test2.db] [file size test2.db-wal]
} [list [expr 1024*3] [wal_file_size 6 1024]]
list [file_page_count test2.db] [file size test2.db-wal]
} [list 3 [wal_file_size 6 1024]]
# Verify that the checksums are valid for all frames and that they
# are calculated by interpreting data in native byte-order.
@@ -213,8 +213,8 @@ foreach endian {big little} {
PRAGMA synchronous = NORMAL;
INSERT INTO t1 VALUES(34, 'thirtyfour');
}
list [file size test.db] [file size test.db-wal]
} [list [expr 1024*3] [wal_file_size 8 1024]]
list [file_page_count test.db] [file size test.db-wal]
} [list 3 [wal_file_size 8 1024]]
for {set f 1} {$f <= 8} {incr f} {
do_test walcksum-1.$endian.5.$f {
log_checksum_verify test.db-wal $f $endian
@@ -237,8 +237,8 @@ foreach endian {big little} {
PRAGMA synchronous = NORMAL;
INSERT INTO t1 VALUES(55, 'fiftyfive');
} db2
list [file size test.db] [file size test.db-wal]
} [list [expr 1024*3] [wal_file_size 10 1024]]
list [file_page_count test.db] [file size test.db-wal]
} [list 3 [wal_file_size 10 1024]]
for {set f 1} {$f <= 10} {incr f} {
do_test walcksum-1.$endian.7.$f {
log_checksum_verify test.db-wal $f $endian
+2 -2
View File
@@ -49,8 +49,8 @@ do_test walhook-1.2 {
do_test walhook-1.3 {
proc wal_hook {args} { db eval {PRAGMA wal_checkpoint}; return 0 }
execsql { INSERT INTO t1 VALUES(2, 'two') }
file size test.db
} [expr 3*1024]
file_page_count test.db
} 3
do_test walhook-1.4 {
proc wal_hook {zDb nEntry} {
execsql { PRAGMA wal_checkpoint }
+4 -4
View File
@@ -42,8 +42,8 @@ do_test walmode-1.1 {
execsql { PRAGMA journal_mode = wal }
} {wal}
do_test walmode-1.2 {
file size test.db
} {1024}
file_page_count test.db
} {1}
set expected_sync_count 3
if {$::tcl_platform(platform)!="windows"} {
@@ -60,8 +60,8 @@ do_test walmode-1.4 {
} {0}
do_test walmode-1.5 {
execsql { CREATE TABLE t1(a, b) }
file size test.db
} {1024}
file_page_count test.db
} {1}
do_test walmode-1.6 {
file exists test.db-wal
} {1}