Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Merge the latest changes from trunk. |
---|---|
Timelines: | family | ancestors | descendants | both | bind-pointer |
Files: | files | file ages | folders |
SHA3-256: |
a54be6e041a9185787a22b86603dcb06 |
User & Date: | drh 2017-07-13 17:34:46.253 |
Context
2017-07-13
| ||
17:48 | Update the FTS3 extension to use sqlite3_result_pointer() and sqlite3_value_pointer() for passing FTS3 cursor objects from the table into functions such as snippet(). (check-in: 0fa2e170e5 user: drh tags: bind-pointer) | |
17:34 | Merge the latest changes from trunk. (check-in: a54be6e041 user: drh tags: bind-pointer) | |
2017-07-12
| ||
20:43 | Smaller and faster implementation for vdbeFreeOpArray() and freeP4(). (check-in: 0c80593520 user: drh tags: trunk) | |
2017-07-07
| ||
14:26 | Merge recent enhancements from trunk. (check-in: 73d0fc027d user: drh tags: bind-pointer) | |
Changes
Changes to Makefile.msc.
︙ | |||
2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 | 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 | + | del /Q mkkeywordhash.* keywordhash.h 2>NUL del /Q notasharedlib.* 2>NUL -rmdir /Q/S .deps 2>NUL -rmdir /Q/S .libs 2>NUL -rmdir /Q/S tsrc 2>NUL del /Q .target_source 2>NUL del /Q tclsqlite3.exe $(SQLITETCLH) $(SQLITETCLDECLSH) 2>NUL del /Q lsm.dll lsmtest.exe 2>NUL del /Q testloadext.dll 2>NUL del /Q testfixture.exe test.db 2>NUL del /Q LogEst.exe fts3view.exe rollback-test.exe showdb.exe dbdump.exe 2>NUL del /Q changeset.exe 2>NUL del /Q showjournal.exe showstat4.exe showwal.exe speedtest1.exe 2>NUL del /Q mptester.exe wordcount.exe rbu.exe srcck1.exe 2>NUL del /Q sqlite3.c sqlite3-*.c 2>NUL |
︙ |
Changes to README.md.
︙ | |||
30 31 32 33 34 35 36 | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | - + + + | to locate the check-in desired, click on its information page link, then click on the "Tarball" or "ZIP Archive" links on the information page. If you do want to use Fossil to check out the source tree, first install Fossil version 2.0 or later. (Source tarballs and precompiled binaries available |
︙ | |||
102 103 104 105 106 107 108 | 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | - - - - - - + + + + + + + + + + - - - + + + - | SQLite does not require [Tcl](http://www.tcl.tk/) to run, but a Tcl installation is required by the makefiles (including those for MSVC). SQLite contains a lot of generated code and Tcl is used to do much of that code generation. The makefiles also require AWK. ## Source Code Tour |
︙ | |||
138 139 140 141 142 143 144 | 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | - + - - + + - + + + + + + + - + - + - + - + + - + | The "target_source" make target will create a subdirectory "tsrc/" and fill it with all the source files needed to build SQLite, both manually-edited files and automatically-generated files. The SQLite interface is defined by the **sqlite3.h** header file, which is generated from src/sqlite.h.in, ./manifest.uuid, and ./VERSION. The [Tcl script](http://www.tcl.tk) at tool/mksqlite3h.tcl does the conversion. |
︙ | |||
256 257 258 259 260 261 262 | 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | - + - + | is the file that, when linked against sqlite3.a, generates the "sqlite3.exe" command-line shell. * **tclsqlite.c** - This file implements the Tcl bindings for SQLite. It is not part of the core SQLite library. But as most of the tests in this repository are written in Tcl, the Tcl language bindings are important. |
Changes to ext/fts5/test/fts5aa.test.
︙ | |||
437 438 439 440 441 442 443 | 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 | - + | # exception. But since bm25() can now used the cached structure record, # it never sees the corruption introduced by funk() and so the following # statement no longer fails. # do_catchsql_test 16.2 { SELECT funk(), bm25(n1), funk() FROM n1 WHERE n1 MATCH 'a+b+c+d' } {0 {{} -1e-06 {}}} |
︙ | |||
591 592 593 594 595 596 597 | 591 592 593 594 595 596 597 | - - | SELECT rowid FROM t9('a*') } {1} } finish_test |
Changes to ext/fts5/test/fts5ab.test.
︙ | |||
290 291 292 293 294 295 296 | 290 291 292 293 294 295 296 | - | INSERT INTO x1 VALUES($doc); } } ;# foreach_detail_mode... finish_test |
Changes to ext/fts5/test/fts5ac.test.
︙ | |||
272 273 274 275 276 277 278 | 272 273 274 275 276 277 278 | - | } { do_execsql_test 2.3.$tn { SELECT fts5_expr_tcl($expr, 'N $x') } [list $tclexpr] } finish_test |
Changes to ext/fts5/test/fts5ad.test.
︙ | |||
238 239 240 241 242 243 244 | 238 239 240 241 242 243 244 | - | catchsql COMMIT } } finish_test |
Changes to ext/fts5/test/fts5ae.test.
︙ | |||
305 306 307 308 309 310 311 | 305 306 307 308 309 310 311 | - | SELECT fts5_test_phrasecount(t9) FROM t9 WHERE t9 MATCH $q LIMIT 1 } $cnt } } finish_test |
Changes to ext/fts5/test/fts5af.test.
︙ | |||
174 175 176 177 178 179 180 | 174 175 176 177 178 179 180 | - | do_execsql_test 5.1 { SELECT snippet(p1, 0, '[', ']', '...', 6) FROM p1('x'); } {{[x] a a a a a...}} } ;# foreach_detail_mode finish_test |
Changes to ext/fts5/test/fts5ag.test.
︙ | |||
138 139 140 141 142 143 144 | 138 139 140 141 142 143 144 | - | } } } ;# foreach_detail_mode finish_test |
Changes to ext/fts5/test/fts5ah.test.
︙ | |||
163 164 165 166 167 168 169 | 163 164 165 166 167 168 169 | - | } {10000} } ;# foreach_detail_mode #db eval {SELECT rowid, fts5_decode(rowid, block) aS r FROM t1_data} {puts $r} finish_test |
Changes to ext/fts5/test/fts5ai.test.
︙ | |||
51 52 53 54 55 56 57 | 51 52 53 54 55 56 57 | - | do_execsql_test 1.2 { INSERT INTO t1(t1) VALUES('integrity-check'); } } finish_test |
Changes to ext/fts5/test/fts5aj.test.
︙ | |||
62 63 64 65 66 67 68 | 62 63 64 65 66 67 68 | - | } } do_execsql_test 2.0 { INSERT INTO t1(t1) VALUES('integrity-check') } finish_test |
Changes to ext/fts5/test/fts5ak.test.
︙ | |||
143 144 145 146 147 148 149 | 143 144 145 146 147 148 149 | - | {[a b c] [c d e]} {[a b c d e]} } } finish_test |
Changes to ext/fts5/test/fts5al.test.
︙ | |||
73 74 75 76 77 78 79 | 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | - + | 1 "" 2 "fname" 3 "fname(X'234ab')" 4 "myfunc(-1.,'abc')" } { do_test 2.2.$tn { catchsql { INSERT INTO ft1(ft1, rank) VALUES('rank', $defn) } |
︙ | |||
293 294 295 296 297 298 299 | 293 294 295 296 297 298 299 | - | SELECT *, rank FROM t3 WHERE t3 MATCH 'a' AND rank MATCH NULL } {1 {parse error in rank function: }} } ;# foreach_detail_mode finish_test |
Changes to ext/fts5/test/fts5alter.test.
︙ | |||
96 97 98 99 100 101 102 | 96 97 98 99 100 101 102 | - | do_execsql_test 3.3 { COMMIT; SELECT rowid FROM abc WHERE abc MATCH 'a'; } {1 2} finish_test |
Changes to ext/fts5/test/fts5auto.test.
︙ | |||
338 339 340 341 342 343 344 | 338 339 340 341 342 343 344 | - | } { do_auto_test 4.$tn yy $expr } finish_test |
Changes to ext/fts5/test/fts5aux.test.
︙ | |||
275 276 277 278 279 280 281 | 275 276 277 278 279 280 281 | - | } { 9 10 } finish_test |
Changes to ext/fts5/test/fts5auxdata.test.
︙ | |||
108 109 110 111 112 113 114 | 108 109 110 111 112 113 114 | - | db eval { SELECT aux_function_2(f1, 2, 'A'), aux_function_2(f1, 2, 'B') FROM f1 WHERE f1 MATCH 'a' ORDER BY rowid ASC } finish_test |
Changes to ext/fts5/test/fts5bigpl.test.
︙ | |||
57 58 59 60 61 62 63 | 57 58 59 60 61 62 63 | - | set doc [string repeat "$t " 150000000] execsql { INSERT INTO t1 VALUES($doc) } } execsql { INSERT INTO t1(t1) VALUES('integrity-check') } } {} finish_test |
Changes to ext/fts5/test/fts5bigtok.test.
︙ | |||
60 61 62 63 64 65 66 | 60 61 62 63 64 65 66 | - - | do_execsql_test 2.[string range $v 0 0] { SELECT rowid FROM t1($v) ORDER BY rowid DESC } [lsort -integer -decr $res] } } finish_test |
Changes to ext/fts5/test/fts5colset.test.
︙ | |||
80 81 82 83 84 85 86 | 80 81 82 83 84 85 86 | - - | do_catchsql_test 4.1 { SELECT * FROM t1 WHERE rowid MATCH 'a' } {1 {unable to use function MATCH in the requested context}} } finish_test |
Changes to ext/fts5/test/fts5config.test.
︙ | |||
62 63 64 65 66 67 68 | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | - + | 5 "f1(x':;')" 6 "f1(x'[]')" 7 "f1(x'{}')" 8 "f1('abc)" } { do_catchsql_test 3.$tn { INSERT INTO t1(t1, rank) VALUES('rank', $val); |
︙ | |||
165 166 167 168 169 170 171 | 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | - + - + - + - + - + - + - + - + - + - + - + | # 9.5.* 'hashsize' options. # do_execsql_test 9.0 { CREATE VIRTUAL TABLE abc USING fts5(a, b); } {} do_catchsql_test 9.1.1 { INSERT INTO abc(abc, rank) VALUES('pgsz', -5); |
︙ | |||
241 242 243 244 245 246 247 | 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | - + - + - | } { set res [list 1 {malformed detail=... directive}] do_catchsql_test 11.$tn "CREATE VIRTUAL TABLE f1 USING fts5(x, $opt)" $res } do_catchsql_test 12.1 { INSERT INTO t1(t1, rank) VALUES('rank', NULL);; |
Changes to ext/fts5/test/fts5conflict.test.
︙ | |||
62 63 64 65 66 67 68 | 62 63 64 65 66 67 68 | - - | REPLACE INTO tbl VALUES(1, '4 5 6', '3 2 1'); DELETE FROM tbl WHERE a=100; INSERT INTO fts_idx(fts_idx) VALUES('integrity-check'); } finish_test |
Changes to ext/fts5/test/fts5content.test.
︙ | |||
251 252 253 254 255 256 257 | 251 252 253 254 255 256 257 | - | do_execsql_test 6.2 { DROP TABLE xx; SELECT name FROM sqlite_master; } {} finish_test |
Changes to ext/fts5/test/fts5corrupt.test.
︙ | |||
92 93 94 95 96 97 98 | 92 93 94 95 96 97 98 | - | do_catchsql_test 3.1 { DELETE FROM t3_content WHERE rowid = 3; SELECT * FROM t3 WHERE t3 MATCH 'o'; } {1 {database disk image is malformed}} finish_test |
Changes to ext/fts5/test/fts5corrupt2.test.
︙ | |||
265 266 267 268 269 270 271 | 265 266 267 268 269 270 271 | - | do_catchsql_test 6.2 { SELECT colsize(x5, 0) FROM x5 WHERE x5 MATCH 'a' } {1 SQLITE_CORRUPT_VTAB} sqlite3_fts5_may_be_corrupt 0 finish_test |
Changes to ext/fts5/test/fts5corrupt3.test.
︙ | |||
405 406 407 408 409 410 411 | 405 406 407 408 409 410 411 | - | } {} do_catchsql_test 9.2.2 { SELECT * FROM t1('one AND two'); } {1 {database disk image is malformed}} sqlite3_fts5_may_be_corrupt 0 finish_test |
Changes to ext/fts5/test/fts5delete.test.
︙ | |||
47 48 49 50 51 52 53 | 47 48 49 50 51 52 53 | - | for {set i 0} {$i < 5} {incr i} { execsql { INSERT INTO t1(t1, rank) VALUES('merge', 1) } execsql { INSERT INTO t1(t1) VALUES('integrity-check') } } } {} finish_test |
Changes to ext/fts5/test/fts5detail.test.
︙ | |||
237 238 239 240 241 242 243 | 237 238 239 240 241 242 243 | - | (SELECT sum(length(block)) from t2_data) < (SELECT sum(length(block)) from t3_data) } {1} finish_test |
Changes to ext/fts5/test/fts5determin.test.
︙ | |||
59 60 61 62 63 64 65 | 59 60 61 62 63 64 65 | - - | } {} do_determin_test 1.4 } finish_test |
Changes to ext/fts5/test/fts5dlidx.test.
︙ | |||
193 194 195 196 197 198 199 | 193 194 195 196 197 198 199 | - | } } ;# foreach_detail_mode finish_test |
Changes to ext/fts5/test/fts5doclist.test.
︙ | |||
40 41 42 43 44 45 46 | 40 41 42 43 44 45 46 | - | do_execsql_test 1.2 { INSERT INTO ccc(ccc) VALUES('integrity-check'); } finish_test |
Changes to ext/fts5/test/fts5eb.test.
︙ | |||
77 78 79 80 81 82 83 | 77 78 79 80 81 82 83 | - - - | do_execsql_test 3.3 { SELECT rowid, bm25(e1) FROM e1 WHERE e1 MATCH '"/" OR "just"' ORDER BY rank; } {1 -1e-06} finish_test |
Changes to ext/fts5/test/fts5fault1.test.
︙ | |||
347 348 349 350 351 352 353 | 347 348 349 350 351 352 353 | - | if {$ls != "2 0"} { error "fts5_level_segs says {$ls}" } } } finish_test |
Changes to ext/fts5/test/fts5fault2.test.
︙ | |||
133 134 135 136 137 138 139 | 133 134 135 136 137 138 139 | - | ); } } -test { faultsim_test_result {0 {}} } finish_test |
Changes to ext/fts5/test/fts5fault3.test.
︙ | |||
106 107 108 109 110 111 112 | 106 107 108 109 110 111 112 | - | } -test { faultsim_test_result [list 0 {}] } finish_test |
Changes to ext/fts5/test/fts5fault4.test.
︙ | |||
391 392 393 394 395 396 397 | 391 392 393 394 395 396 397 | - | } -body { db eval { ALTER TABLE "tbl one" RENAME TO "tbl two" } } -test { faultsim_test_result {0 {}} } finish_test |
Changes to ext/fts5/test/fts5fault5.test.
︙ | |||
126 127 128 129 130 131 132 | 126 127 128 129 130 131 132 | - | 9 x 1 {} ]] } finish_test |
Changes to ext/fts5/test/fts5fault6.test.
︙ | |||
288 289 290 291 292 293 294 | 288 289 290 291 292 293 294 | - | faultsim_test_result {0 {}} {1 {initialization of fts5 failed: }} if {$testrc==0} { db eval { CREATE VIRTUAL TABLE temp.t1 USING fts5(x) } } db close } finish_test |
Changes to ext/fts5/test/fts5fault7.test.
︙ | |||
112 113 114 115 116 117 118 | 112 113 114 115 116 117 118 | - | do_faultsim_test 2.2 -faults oom-* -body { db eval { SELECT * FROM xy('""') } } -test { faultsim_test_result {0 {}} } finish_test |
Changes to ext/fts5/test/fts5fault8.test.
︙ | |||
78 79 80 81 82 83 84 | 78 79 80 81 82 83 84 | - | execsql { INSERT INTO x2(x2) VALUES('optimize') } } -test { faultsim_test_result {0 {}} {1 SQLITE_NOMEM} } finish_test |
Changes to ext/fts5/test/fts5fault9.test.
︙ | |||
149 150 151 152 153 154 155 | 149 150 151 152 153 154 155 | - | faultsim_test_result [list 0 {1 3}] } } ;# foreach_detail_mode... finish_test |
Changes to ext/fts5/test/fts5faultA.test.
︙ | |||
57 58 59 60 61 62 63 | 57 58 59 60 61 62 63 | - | sqlite3 db test.db } -body { execsql { SELECT rowid FROM o2('a+b+c NOT xyz') } } -test { faultsim_test_result {0 {1 2}} } finish_test |
Changes to ext/fts5/test/fts5faultB.test.
︙ | |||
128 129 130 131 132 133 134 | 128 129 130 131 132 133 134 | - | execsql { SELECT rowid FROM t1('{a b c} : (a AND d)') } } -test { faultsim_test_result {0 {2 3}} } finish_test |
Changes to ext/fts5/test/fts5full.test.
︙ | |||
36 37 38 39 40 41 42 | 36 37 38 39 40 41 42 | - | execsql { INSERT INTO x8 VALUES( rnddoc(5) ); } } } msg] $msg } {1 {database or disk is full}} finish_test |
Changes to ext/fts5/test/fts5fuzz1.test.
︙ | |||
86 87 88 89 90 91 92 | 86 87 88 89 90 91 92 | - | reset_db do_catchsql_test 4.1 { CREATE VIRTUAL TABLE f2 USING fts5(o, t); SELECT * FROM f2('(8 AND 9)`AND 10'); } {1 {fts5: syntax error near "`"}} finish_test |
Changes to ext/fts5/test/fts5hash.test.
︙ | |||
126 127 128 129 130 131 132 | 126 127 128 129 130 131 132 | - | INSERT INTO t2 VALUES($small || ' ' || $big); } } {} } ;# foreach_detail_mode finish_test |
Changes to ext/fts5/test/fts5integrity.test.
︙ | |||
206 207 208 209 210 211 212 | 206 207 208 209 210 211 212 | - | if {$res == [lsort -integer $res2]} { incr ok } } set ok } {1000} } finish_test |
Changes to ext/fts5/test/fts5lastrowid.test.
︙ | |||
66 67 68 69 70 71 72 | 66 67 68 69 70 71 72 | - | do_execsql_test 1.6 { INSERT INTO t1(rowid, str) SELECT rowid+10, x FROM x1; SELECT last_insert_rowid(); } {14} finish_test |
Changes to ext/fts5/test/fts5leftjoin.test.
︙ | |||
37 38 39 40 41 42 43 | 37 38 39 40 41 42 43 | - - | } {1 1 abc 2 {} {}} do_execsql_test 1.2 { SELECT * FROM t1 LEFT JOIN vt ON (vt MATCH 'abc') } {1 abc 2 abc} finish_test |
Changes to ext/fts5/test/fts5matchinfo.test.
︙ | |||
488 489 490 491 492 493 494 | 488 489 490 491 492 493 494 | - | } {} do_catchsql_test 14.2 { SELECT matchinfo(x1, 'd') FROM x1('a b c'); } {1 {unrecognized matchinfo flag: d}} finish_test |
Changes to ext/fts5/test/fts5merge.test.
︙ | |||
237 238 239 240 241 242 243 | 237 238 239 240 241 242 243 | - | do_execsql_test 6.3 { INSERT INTO g1(g1) VALUES('integrity-check'); } finish_test |
Changes to ext/fts5/test/fts5merge2.test.
︙ | |||
51 52 53 54 55 56 57 | 51 52 53 54 55 56 57 | - | do_execsql_test 1.2 { INSERT INTO t1(t1) VALUES('integrity-check'); } } finish_test |
Changes to ext/fts5/test/fts5multiclient.test.
︙ | |||
41 42 43 44 45 46 47 | 41 42 43 44 45 46 47 | - | sql1 { INSERT INTO t1 VALUES('a b c') } sql3 { INSERT INTO t1(t1) VALUES('integrity-check') } } {} };# do_multiclient_test };# foreach_detail_mode finish_test |
Changes to ext/fts5/test/fts5near.test.
︙ | |||
64 65 66 67 68 69 70 | 64 65 66 67 68 69 70 | - | do_near_test 1.23 "a b c d e f g h i" { NEAR(a+b+c+d i b+c, 4) } 0 do_near_test 1.24 "a b c d e f g h i" { NEAR(i a+b+c+d b+c, 5) } 1 do_near_test 1.25 "a b c d e f g h i" { NEAR(i a+b+c+d b+c, 4) } 0 finish_test |
Changes to ext/fts5/test/fts5onepass.test.
︙ | |||
174 175 176 177 178 179 180 | 174 175 176 177 178 179 180 | - | UPDATE ttt SET x = 'A B C' WHERE rowid = 4; INSERT INTO ttt(rowid, x) VALUES(6, 'd e f'); COMMIT; } {} do_test 4.2.2 { fts5_level_segs ttt } {3} finish_test |
Changes to ext/fts5/test/fts5optimize.test.
︙ | |||
102 103 104 105 106 107 108 | 102 103 104 105 106 107 108 | - | do_execsql_test 2.$tn.5 { INSERT INTO t1(t1) VALUES('integrity-check'); } do_test 2.$tn.6 { fts5_segcount t1 } 1 } finish_test |
Changes to ext/fts5/test/fts5phrase.test.
︙ | |||
112 113 114 115 116 117 118 | 112 113 114 115 116 117 118 | - | FROM t3('a:f+f') } { 31 {h *f f*} {i j g e c} {j j f c a i j} 50 {*f f* c} {f f b i i} {f f a j e c i} } finish_test |
Changes to ext/fts5/test/fts5plan.test.
︙ | |||
60 61 62 63 64 65 66 | 60 61 62 63 64 65 66 | - | 0 0 0 {SCAN TABLE f1 VIRTUAL TABLE INDEX 2:} } finish_test |
Changes to ext/fts5/test/fts5porter.test.
︙ | |||
11799 11800 11801 11802 11803 11804 11805 | 11799 11800 11801 11802 11803 11804 11805 | - | lindex [sqlite3_fts5_tokenize db porter $in] 0 } $out incr i } finish_test |
Changes to ext/fts5/test/fts5porter2.test.
︙ | |||
63 64 65 66 67 68 69 | 63 64 65 66 67 68 69 | - | lindex [sqlite3_fts5_tokenize db porter $in] 0 } $out incr i } finish_test |
Changes to ext/fts5/test/fts5prefix.test.
︙ | |||
337 338 339 340 341 342 343 | 337 338 339 340 341 342 343 | - - | do_execsql_test 7.$tn { SELECT md5sum(id, block) FROM tt_data } [list $::checksum] } } finish_test |
Changes to ext/fts5/test/fts5query.test.
︙ | |||
75 76 77 78 79 80 81 | 75 76 77 78 79 80 81 | - - | } {} incr ret } } finish_test |
Changes to ext/fts5/test/fts5rank.test.
︙ | |||
148 149 150 151 152 153 154 | 148 149 150 151 152 153 154 | - | VTest MATCH 'wrinkle in time OR a wrinkle in time' ORDER BY rank; } {{wrinkle in time} {Bill Smith}} finish_test |
Changes to ext/fts5/test/fts5rebuild.test.
︙ | |||
60 61 62 63 64 65 66 | 60 61 62 63 64 65 66 | - | CREATE VIRTUAL TABLE nc USING fts5(doc, content=); } do_catchsql_test 2.2 { INSERT INTO nc(nc) VALUES('rebuild'); } {1 {'rebuild' may not be used with a contentless fts5 table}} finish_test |
Changes to ext/fts5/test/fts5restart.test.
︙ | |||
145 146 147 148 149 150 151 | 145 146 147 148 149 150 151 | - | } set res } {500 400 300} finish_test |
Changes to ext/fts5/test/fts5rowid.test.
︙ | |||
212 213 214 215 216 217 218 | 212 213 214 215 216 217 218 | - | } {36} #db eval {SELECT rowid, fts5_decode_none(rowid, block) aS r FROM x5_data} {puts $r} finish_test |
Changes to ext/fts5/test/fts5simple2.test.
︙ | |||
366 367 368 369 370 371 372 | 366 367 368 369 370 371 372 | - | do_execsql_test 17.6 { SELECT * FROM t2('x:b* OR y:a*') WHERE rowid>55 } #db eval {SELECT rowid, fts5_decode_none(rowid, block) aS r FROM t2_data} {puts $r} finish_test |
Changes to ext/fts5/test/fts5simple3.test.
︙ | |||
112 113 114 115 116 117 118 | 112 113 114 115 116 117 118 | - | } do_execsql_test 4.6 { SELECT * FROM t2('ab + xyz'); } finish_test |
Changes to ext/fts5/test/fts5synonym.test.
︙ | |||
417 418 419 420 421 422 423 | 417 418 419 420 421 422 423 | - | do_execsql_test 7.1.2 { INSERT INTO t2(t2) VALUES('integrity-check'); } } ;# foreach_detail_mode finish_test |
Changes to ext/fts5/test/fts5synonym2.test.
︙ | |||
157 158 159 160 161 162 163 | 157 158 159 160 161 162 163 | - | } } } finish_test |
Changes to ext/fts5/test/fts5tok1.test.
︙ | |||
105 106 107 108 109 110 111 | 105 106 107 108 109 110 111 112 113 114 115 | - + | do_catchsql_test 2.0 { CREATE VIRTUAL TABLE tX USING fts5tokenize(nosuchtokenizer); } {1 {vtable constructor failed: tX}} do_catchsql_test 2.1 { CREATE VIRTUAL TABLE t4 USING fts5tokenize; SELECT * FROM t4; |
Changes to ext/fts5/test/fts5tokenizer.test.
︙ | |||
298 299 300 301 302 303 304 | 298 299 300 301 302 303 304 | - | set ::flags [list] do_execsql_test 9.5.1 { SELECT * FROM t1('"abc xyz*"'); } {} do_test 9.5.2 { set ::flags } {query} finish_test |
Changes to ext/fts5/test/fts5unicode.test.
︙ | |||
55 56 57 58 59 60 61 | 55 56 57 58 59 60 61 | - | SELECT 't1' FROM t1 WHERE t1 MATCH '\xE0\xE8\xEC'; SELECT 't2' FROM t2 WHERE t2 MATCH '\xE0\xE8\xEC'; SELECT 't3' FROM t3 WHERE t3 MATCH '\xE0\xE8\xEC'; " {t1 t2} finish_test |
Changes to ext/fts5/test/fts5unicode3.test.
︙ | |||
122 123 124 125 126 127 128 | 122 123 124 125 126 127 128 | - | } append str {'");} execsql $str } {} finish_test |
Changes to ext/fts5/test/fts5unindexed.test.
︙ | |||
72 73 74 75 76 77 78 | 72 73 74 75 76 77 78 | - | INSERT INTO t4(t4, rowid, a, b, c) VALUES('delete', 20, 'j k l', '', 'p q r'); DELETE FROM x4 WHERE rowid=20; INSERT INTO t4(t4) VALUES('integrity-check'); } {} finish_test |
Changes to ext/fts5/test/fts5update.test.
︙ | |||
113 114 115 116 117 118 119 | 113 114 115 116 117 118 119 | - - | } {} do_execsql_test 2.2.integrity { INSERT INTO x2(x2) VALUES('integrity-check'); } } finish_test |
Changes to ext/fts5/test/fts5version.test.
︙ | |||
57 58 59 60 61 62 63 | 57 58 59 60 61 62 63 | - | db close sqlite3 db test.db catchsql { SELECT * FROM t1 WHERE t1 MATCH 'a' } } {1 {invalid fts5 file format (found 0, expected 4) - run 'rebuild'}} finish_test |
Changes to ext/lsm1/Makefile.msc.
1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 | - - + + - - + + | # |
︙ | |||
35 36 37 38 39 40 41 | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | - + - + + + + + + + + + | $(LSMDIR)\lsm-test\lsmtest9.c \ $(LSMDIR)\lsm-test\lsmtest_datasource.c \ $(LSMDIR)\lsm-test\lsmtest_func.c $(LSMDIR)\lsm-test\lsmtest_io.c \ $(LSMDIR)\lsm-test\lsmtest_main.c $(LSMDIR)\lsm-test\lsmtest_mem.c \ $(LSMDIR)\lsm-test\lsmtest_tdb.c $(LSMDIR)\lsm-test\lsmtest_tdb3.c \ $(LSMDIR)\lsm-test\lsmtest_util.c $(LSMDIR)\lsm-test\lsmtest_win32.c |
︙ | |||
84 85 86 87 88 89 90 | 92 93 94 95 96 97 98 99 100 | - - + + | lsm_vtab.lo: $(LSMDIR)\lsm_vtab.c $(LSMHDR) $(SQLITE3H) $(LTCOMPILE) $(LSMOPTS) -c $(LSMDIR)\lsm_vtab.c lsm.dll: $(LSMOBJ) $(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL /OUT:$@ $(LSMOBJ) |
Changes to ext/lsm1/lsm-test/lsmtest.h.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | + + + + + + + + + + - + | #ifndef __WRAPPER_INT_H_ #define __WRAPPER_INT_H_ #include "lsmtest_tdb.h" #include "sqlite3.h" #include "lsm.h" #include <assert.h> #include <stdarg.h> #include <stdlib.h> #include <string.h> #include <stdio.h> #ifndef _WIN32 # include <unistd.h> #endif #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <ctype.h> #include <stdlib.h> #include <errno.h> #ifdef __cplusplus extern "C" { #endif #ifdef _WIN32 # include "windows.h" # define gettimeofday win32GetTimeOfDay # define F_OK (0) # define sleep(sec) Sleep(1000 * (sec)) |
︙ | |||
47 48 49 50 51 52 53 54 55 56 57 58 59 60 | 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | + + + + | #define MIN(x,y) ((x)<(y) ? (x) : (y)) #define MAX(x,y) ((x)>(y) ? (x) : (y)) #define unused_parameter(x) (void)(x) #define TESTDB_DEFAULT_PAGE_SIZE 4096 #define TESTDB_DEFAULT_CACHE_SIZE 2048 #ifndef _O_BINARY # define _O_BINARY (0) #endif /* ** Ideally, these should be in wrapper.c. But they are here instead so that ** they can be used by the C++ database wrappers in wrapper2.cc. */ typedef struct DatabaseMethods DatabaseMethods; struct TestDb { |
︙ |
Changes to ext/lsm1/lsm-test/lsmtest1.c.
︙ | |||
92 93 94 95 96 97 98 | 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | - + | return zRet; } int testControlDb(TestDb **ppDb){ #ifdef HAVE_KYOTOCABINET return tdb_open("kyotocabinet", "tmp.db", 1, ppDb); #else |
︙ |
Changes to ext/lsm1/lsm-test/lsmtest6.c.
︙ | |||
196 197 198 199 200 201 202 | 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | - + | int nScan, int *pRc ){ if( *pRc==0 ){ int rc; int iScan = 0; lsm_cursor *pCsr; |
︙ | |||
236 237 238 239 240 241 242 | 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | - - - - - - - - + - - + + + - + + + + + + - - - + + + | lsm_csr_close(pCsr); *pRc = rc; } } #define LSMTEST6_TESTDB "testdb.lsm" |
︙ | |||
318 319 320 321 322 323 324 | 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 | - - + + - - + + - + - + | void testSaveDb(const char *zFile, const char *zAux){ char *zLog = testMallocPrintf("%s-%s", zFile, zAux); char *zFileSave = testMallocPrintf("%s-save", zFile); char *zLogSave = testMallocPrintf("%s-%s-save", zFile, zAux); unlink(zFileSave); unlink(zLogSave); |
︙ | |||
408 409 410 411 412 413 414 | 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 | - + | ** Set up a database file with the following properties: ** ** * Page size is 1024 bytes. ** * Block size is 64 KB. ** * Contains 5000 key-value pairs starting at 0 from the ** datasource returned getDatasource(). */ |
︙ |
Changes to ext/lsm1/lsm-test/lsmtest8.c.
︙ | |||
81 82 83 84 85 86 87 | 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | - + + - + - + + - + | } } #include <stdio.h> void testReadFile(const char *zFile, int iOff, void *pOut, int nByte, int *pRc){ if( *pRc==0 ){ FILE *fd; |
︙ | |||
151 152 153 154 155 156 157 | 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | + - - - - - - + + + + + + - + - - - - - - - + + + + + + + - - + + - - - - - - + + + + + + - - - - - - - - + + + + + + + + - - - + + + - - - - + + + + + | ** 1) Check that the checksum of the database is zCksum. ** 2) Write a few keys to the database. Then delete the same keys. ** 3) Check that the checksum is zCksum. ** 4) Flush the db to disk and run a checkpoint. ** 5) Check once more that the checksum is still zCksum. */ static void doLiveRecovery(const char *zDb, const char *zCksum, int *pRc){ if( *pRc==LSM_OK ){ |
︙ |
Changes to ext/lsm1/lsm-test/lsmtest_io.c.
︙ | |||
51 52 53 54 55 56 57 | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | - - - - - - - - | ** $ echo "2M@6M 1492K@4M S 4096@4K S" | lsmtest io testfile.db 4096 ** 3544K written in 127 ms ** */ #include "lsmtest.h" |
︙ | |||
151 152 153 154 155 156 157 | 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | - + - + | if( safe_isdigit(c) ){ i64 iOff = 0; int nByte = 0; int rc = 0; int nPg; int iPg; |
︙ | |||
215 216 217 218 219 220 221 | 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | - + - + | if( nArg<2 ){ testPrintUsage("FILE PGSZ ?CMD-1 ...?"); return -1; } zFile = azArg[0]; zPgsz = azArg[1]; |
︙ |
Changes to ext/lsm1/lsm-test/lsmtest_main.c.
1 | 1 2 3 4 5 6 7 8 9 10 | - - - - - - - - - - - - - - - |
|
︙ | |||
913 914 915 916 917 918 919 | 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 | - + | pLog = fopen("/tmp/speed.log", "w"); tdb_lsm_write_hook(pDb, do_speed_write_hook2, (void *)pLog); #endif testTimeInit(); for(i=0; i<nRow; i+=nStep){ int iStep; |
︙ | |||
1235 1236 1237 1238 1239 1240 1241 | 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 | - + | }else{ printf("Sync after each %d blocks.\n", nSync); } printf("Preparing file... "); fflush(stdout); unlink("writer.out"); |
︙ |
Changes to ext/lsm1/lsm-test/lsmtest_mem.c.
︙ | |||
41 42 43 44 45 46 47 | 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | - - - + + + | /* Mutex to protect pFirst and aHash */ void (*xEnterMutex)(TmGlobal*); /* Call this to enter the mutex */ void (*xLeaveMutex)(TmGlobal*); /* Call this to leave mutex */ void (*xDelMutex)(TmGlobal*); /* Call this to delete mutex */ void *pMutex; /* Mutex handle */ |
︙ | |||
179 180 181 182 183 184 185 | 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | - + | static void tmFree(TmGlobal *pTm, void *p){ if( p ){ TmBlockHdr *pHdr; u8 *pUser = (u8 *)p; tmEnterMutex(pTm); |
︙ | |||
214 215 216 217 218 219 220 | 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | - + | static void *tmRealloc(TmGlobal *pTm, void *p, int nByte){ void *pNew; pNew = tmMalloc(pTm, nByte); if( pNew && p ){ TmBlockHdr *pHdr; u8 *pUser = (u8 *)p; |
︙ | |||
351 352 353 354 355 356 357 | 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 | - - - + + + | pMutex->pEnv = pEnv; pEnv->xMutexStatic(pEnv, LSM_MUTEX_HEAP, &pMutex->pMutex); pGlobal->xEnterMutex = tmLsmMutexEnter; pGlobal->xLeaveMutex = tmLsmMutexLeave; pGlobal->xDelMutex = tmLsmMutexDel; pGlobal->pMutex = (void *)pMutex; |
︙ |
Changes to ext/lsm1/lsm-test/lsmtest_tdb.c.
︙ | |||
763 764 765 766 767 768 769 | 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 | + - + | nLib++; } zSpec = &zLib[nLib]; while( *zSpec==' ' ) zSpec++; if( *zSpec=='\0' ) zSpec = 0; for(i=0; i<ArraySize(aLib); i++){ if( (int)strlen(aLib[i].zName)==nLib |
︙ |
Changes to ext/lsm1/lsm-test/lsmtest_tdb3.c.
︙ | |||
195 196 197 198 199 200 201 | 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | - + - - + + - + - - + + - - + + - + - + - + | lsm_env *pRealEnv = tdb_lsm_env(); LsmFile *p = (LsmFile *)pFile; LsmDb *pDb = p->pDb; if( pDb->bCrashed ) return LSM_IOERR; if( pDb->bPrepareCrash ){ |
︙ | |||
543 544 545 546 547 548 549 | 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 | - - - + + + | static int waitOnWorker(LsmDb *pDb){ int rc; int nLimit = -1; int nSleep = 0; rc = lsm_config(pDb->db, LSM_CONFIG_AUTOFLUSH, &nLimit); do { |
︙ | |||
884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 | 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 | + + | testPrintError("syntax error at: \"%s\"\n", z); return 1; } int tdb_lsm_config_str(TestDb *pDb, const char *zStr){ int rc = 0; if( tdb_lsm(pDb) ){ #ifdef LSM_MUTEX_PTHREADS int i; #endif LsmDb *pLsm = (LsmDb *)pDb; rc = test_lsm_config_str(pLsm, pLsm->db, 0, zStr, 0); #ifdef LSM_MUTEX_PTHREADS for(i=0; rc==0 && i<pLsm->nWorker; i++){ rc = test_lsm_config_str(0, pLsm->aWorker[i].pWorker, 1, zStr, 0); } |
︙ |
Changes to ext/lsm1/lsm-test/lsmtest_win32.c.
︙ | |||
8 9 10 11 12 13 14 | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | - + - - + + - - - - - + + + + + | #define TICKS_UNIX_EPOCH (116444736000000000LL) int win32GetTimeOfDay( struct timeval *tp, void *tzp ){ FILETIME fileTime; |
Changes to ext/lsm1/lsmInt.h.
︙ | |||
585 586 587 588 589 590 591 | 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 | - + | u32 nWrite; /* Total number of pages written to disk */ }; #define LSM_INITIAL_SNAPSHOT_ID 11 /* ** Functions from file "lsm_ckpt.c". */ |
︙ | |||
691 692 693 694 695 696 697 698 699 700 701 702 703 704 | 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 | + + | /************************************************************************** ** Start of functions from "lsm_file.c". */ int lsmFsOpen(lsm_db *, const char *, int); int lsmFsOpenLog(lsm_db *, int *); void lsmFsCloseLog(lsm_db *); void lsmFsClose(FileSystem *); int lsmFsUnmap(FileSystem *); int lsmFsConfigure(lsm_db *db); int lsmFsBlockSize(FileSystem *); void lsmFsSetBlockSize(FileSystem *, int); int lsmFsMoveBlock(FileSystem *pFS, Segment *pSeg, int iTo, int iFrom); |
︙ |
Changes to ext/lsm1/lsm_ckpt.c.
︙ | |||
218 219 220 221 222 223 224 | 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | - + | ** ** The value of the nCkpt parameter includes the two checksum values at ** the end of the checkpoint. They are not used as inputs to the checksum ** calculation. The checksum is based on the array of (nCkpt-2) integers ** at aCkpt[]. */ static void ckptChecksum(u32 *aCkpt, u32 nCkpt, u32 *piCksum1, u32 *piCksum2){ |
︙ | |||
507 508 509 510 511 512 513 | 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 | - + | Segment *pSegment /* Populate this structure */ ){ assert( pSegment->iFirst==0 && pSegment->iLastPg==0 ); assert( pSegment->nSize==0 && pSegment->iRoot==0 ); pSegment->iFirst = ckptGobble64(aIn, piIn); pSegment->iLastPg = ckptGobble64(aIn, piIn); pSegment->iRoot = ckptGobble64(aIn, piIn); |
︙ | |||
1013 1014 1015 1016 1017 1018 1019 | 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 | - - - + + + | if( rc==LSM_OK && bInclFreelist ){ nFree = aCkpt[iIn++]; if( nFree ){ pNew->freelist.aEntry = (FreelistEntry *)lsmMallocZeroRc( pDb->pEnv, sizeof(FreelistEntry)*nFree, &rc ); if( rc==LSM_OK ){ |
︙ |
Changes to ext/lsm1/lsm_file.c.
︙ | |||
536 537 538 539 540 541 542 | 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 | - + | return ((i64)iReal*pFS->nPagesize <= pFS->nMapLimit); } /* ** Given that there are currently nHash slots in the hash table, return ** the hash key for file iFile, page iPg. */ |
︙ | |||
918 919 920 921 922 923 924 | 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 | - + - + | /* ** Return the block number of the block that page iPg is located on. ** Blocks are numbered starting from 1. */ static int fsPageToBlock(FileSystem *pFS, Pgno iPg){ if( pFS->pCompress ){ |
︙ | |||
1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 | 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 | + + + + + + + + + + + | pFix->aData += iOff; } lsmSortedRemap(pFS->pDb); } *pRc = rc; } } /* ** If it is mapped, unmap the database file. */ int lsmFsUnmap(FileSystem *pFS){ int rc = LSM_OK; if( pFS ){ rc = lsmEnvRemap(pFS->pEnv, pFS->fdDb, -1, &pFS->pMap, &pFS->nMap); } return rc; } /* ** fsync() the database file. */ int lsmFsSyncDb(FileSystem *pFS, int nBlock){ return lsmEnvSync(pFS->pEnv, pFS->fdDb); } |
︙ | |||
1282 1283 1284 1285 1286 1287 1288 | 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 | - + | i64 iEob; /* End of block */ int nRead; int rc; assert( pFS->pCompress ); iEob = fsLastPageOnPagesBlock(pFS, iOff) + 1; |
︙ | |||
1718 1719 1720 1721 1722 1723 1724 | 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 | - - + + | static int fsFreeBlock( FileSystem *pFS, /* File system object */ Snapshot *pSnapshot, /* Worker snapshot */ Segment *pIgnore, /* Ignore this run when searching */ int iBlk /* Block number of block to free */ ){ int rc = LSM_OK; /* Return code */ |
︙ | |||
1852 1853 1854 1855 1856 1857 1858 | 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 | - + - + - + | int iBlk; assert( pRun->nSize>0 ); assert( 0==fsSegmentRedirects(pFS, pRun) ); assert( nPgno>0 && 0==fsPageRedirects(pFS, pRun, aPgno[0]) ); iBlk = fsPageToBlock(pFS, pRun->iFirst); |
︙ | |||
2083 2084 2085 2086 2087 2088 2089 | 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 | - - + + - + | Snapshot *pSnapshot, Level *pLvl, int bDefer, Page **ppOut ){ int rc = LSM_OK; Page *pPg = 0; |
︙ | |||
2112 2113 2114 2115 2116 2117 2118 | 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 | - - + + - + | pPg->nRef = 1; pFS->nOut++; } }else{ if( iPrev==0 ){ iApp = findAppendPoint(pFS, pLvl); }else if( fsIsLast(pFS, iPrev) ){ |
︙ | |||
2453 2454 2455 2456 2457 2458 2459 | 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 | - - + + - + | int nData, /* Size of buffer aData[] in bytes */ int *pRc /* IN/OUT: Error code */ ){ Pgno iRet = 0; int rc = *pRc; assert( pFS->pCompress ); if( rc==LSM_OK ){ |
︙ | |||
2796 2797 2798 2799 2800 2801 2802 | 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 | - + | Pgno iLast2; Pgno iLast = pSeg->iLastPg; /* Current last page of segment */ int nPad; /* Bytes of padding required */ u8 aSz[3]; iLast2 = (1 + iLast/pFS->szSector) * pFS->szSector - 1; assert( fsPageToBlock(pFS, iLast)==fsPageToBlock(pFS, iLast2) ); |
︙ | |||
3253 3254 3255 3256 3257 3258 3259 | 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 | - + - - + + | ** builds, this probably means the user is running an OOM injection test. ** Regardless, it will not be possible to run the integrity-check at this ** time, so assume the database is Ok and return non-zero. */ return 1; } for(pLevel=pWorker->pLevel; pLevel; pLevel=pLevel->pNext){ |
︙ |
Changes to ext/lsm1/lsm_log.c.
︙ | |||
541 542 543 544 545 546 547 | 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 | - + | if( nPad ){ u8 aPad[7] = {0,0,0,0,0,0,0}; nPad = 8-nPad; if( nPad==1 ){ aPad[0] = LSM_LOG_PAD1; }else{ aPad[0] = LSM_LOG_PAD2; |
︙ | |||
623 624 625 626 627 628 629 | 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 | - + - + | while( nPad ){ if( nPad==1 ){ pLog->buf.z[pLog->buf.n++] = LSM_LOG_PAD1; nPad = 0; }else{ int n = LSM_MIN(200, nPad-2); pLog->buf.z[pLog->buf.n++] = LSM_LOG_PAD2; |
︙ | |||
768 769 770 771 772 773 774 | 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 | - + | LogWriter *pLog; if( pDb->bUseLog==0 ) return; pLog = pDb->pLogWriter; assert( pMark->iOff<=pLog->iOff+pLog->buf.n ); if( (pMark->iOff & 0xFFFFFFF8)>=pLog->iOff ){ |
︙ |
Changes to ext/lsm1/lsm_shared.c.
︙ | |||
93 94 95 96 97 98 99 | 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | - + | #else # define assertNotInFreelist(x,y) #endif /* ** Append an entry to the free-list. If (iId==-1), this is a delete. */ |
︙ | |||
226 227 228 229 230 231 232 | 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | - + | ** contains data. */ ctx.nBlock = pDb->pWorker->nBlock; ctx.iInUse = -1; rc = lsmWalkFreelist(pDb, 1, dbTruncateCb, (void *)&ctx); /* If the last block that contains data is not already the last block in ** the database file, truncate the database file so that it is. */ |
︙ | |||
248 249 250 251 252 253 254 255 256 257 258 259 260 261 | 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | + + | if( pDb->bReadonly ){ lsmShmLock(pDb, LSM_LOCK_DMS3, LSM_LOCK_UNLOCK, 0); }else{ /* Block for an exclusive lock on DMS1. This lock serializes all calls ** to doDbConnect() and doDbDisconnect() across all processes. */ rc = lsmShmLock(pDb, LSM_LOCK_DMS1, LSM_LOCK_EXCL, 1); if( rc==LSM_OK ){ lsmShmLock(pDb, LSM_LOCK_DMS2, LSM_LOCK_UNLOCK, 0); /* Try an exclusive lock on DMS2. If successful, this is the last ** connection to the database. In this case flush the contents of the ** in-memory tree to disk and write a checkpoint. */ rc = lsmShmTestLock(pDb, LSM_LOCK_DMS2, 1, LSM_LOCK_EXCL); if( rc==LSM_OK ){ rc = lsmShmTestLock(pDb, LSM_LOCK_CHECKPOINTER, 1, LSM_LOCK_EXCL); |
︙ | |||
287 288 289 290 291 292 293 | 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 | - + + - | bReadonly = 1; rc = LSM_OK; } } /* Write a checkpoint to disk. */ if( rc==LSM_OK ){ |
︙ | |||
473 474 475 476 477 478 479 480 | 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 | + + + + + - + + + | ** attempt to take the exclusive lock on DMS2. */ if( rc==LSM_OK ){ int bReadonly = (pDb->bReadonly && pDb->bMultiProc); rc = dbOpenSharedFd(pDb->pEnv, p, bReadonly); } if( rc==LSM_OK && p->bMultiProc==0 ){ /* Hold an exclusive lock DMS1 while grabbing DMS2. This ensures ** that any ongoing call to doDbDisconnect() (even one in another ** process) is finished before proceeding. */ assert( p->bReadonly==0 ); rc = lsmEnvLock(pDb->pEnv, p->pFile, LSM_LOCK_DMS1, LSM_LOCK_EXCL); if( rc==LSM_OK ){ |
︙ | |||
556 557 558 559 560 561 562 563 564 565 566 567 568 569 | 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 | + | if( p ){ lsm_db **ppDb; if( pDb->pShmhdr ){ doDbDisconnect(pDb); } lsmFsUnmap(pDb->pFS); lsmMutexEnter(pDb->pEnv, p->pClientMutex); for(ppDb=&p->pConn; *ppDb!=pDb; ppDb=&((*ppDb)->pNext)); *ppDb = pDb->pNext; dbDeferClose(pDb); lsmMutexLeave(pDb->pEnv, p->pClientMutex); enterGlobalMutex(pDb->pEnv); |
︙ | |||
627 628 629 630 631 632 633 634 635 636 | 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 | + - - + + - + | */ static int walkFreelistCb(void *pCtx, int iBlk, i64 iSnapshot){ WalkFreelistCtx *p = (WalkFreelistCtx *)pCtx; const int iDir = (p->bReverse ? -1 : 1); Freelist *pFree = p->pFreelist; assert( p->bDone==0 ); assert( iBlk>=0 ); if( pFree ){ while( (p->iFree < pFree->nEntry) && p->iFree>=0 ){ FreelistEntry *pEntry = &pFree->aEntry[p->iFree]; |
︙ | |||
901 902 903 904 905 906 907 | 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 | - + | ** database itself. ** ** The WORKER lock must not be held when this is called. This is because ** this function may indirectly call fsync(). And the WORKER lock should ** not be held that long (in case it is required by a client flushing an ** in-memory tree to disk). */ |
︙ | |||
925 926 927 928 929 930 931 | 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 | - + | /* Check if this checkpoint has already been written to the database ** file. If so, set variable bDone to true. */ if( pShm->iMetaPage ){ MetaPage *pPg; /* Meta page */ u8 *aData; /* Meta-page data buffer */ int nData; /* Size of aData[] in bytes */ i64 iCkpt; /* Id of checkpoint just loaded */ |
︙ | |||
956 957 958 959 960 961 962 | 967 968 969 970 971 972 973 974 975 976 977 978 979 980 | - - - - | } #ifdef LSM_LOG_WORK lsmLogMessage(pDb, 0, "finish checkpoint %d", (int)lsmCheckpointId(pDb->aSnapshot, 0) ); #endif } |
︙ | |||
1743 1744 1745 1746 1747 1748 1749 | 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 | - + + + + | for(i=iLock; i<(iLock+nLock); i++){ mask |= ((u64)1 << (iLock-1)); if( eOp==LSM_LOCK_EXCL ) mask |= ((u64)1 << (iLock+32-1)); } lsmMutexEnter(db->pEnv, p->pClientMutex); for(pIter=p->pConn; pIter; pIter=pIter->pNext){ |
︙ | |||
1871 1872 1873 1874 1875 1876 1877 | 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 | - + | ** follows: ** ** (eOp==LSM_LOCK_UNLOCK) -> true if db has no lock on iLock ** (eOp==LSM_LOCK_SHARED) -> true if db has at least a SHARED lock on iLock. ** (eOp==LSM_LOCK_EXCL) -> true if db has an EXCLUSIVE lock on iLock. */ int lsmShmAssertLock(lsm_db *db, int iLock, int eOp){ |
︙ | |||
1950 1951 1952 1953 1954 1955 1956 | 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 | - + | int lsm_checkpoint(lsm_db *pDb, int *pnKB){ int rc; /* Return code */ u32 nWrite = 0; /* Number of pages checkpointed */ /* Attempt the checkpoint. If successful, nWrite is set to the number of ** pages written between this and the previous checkpoint. */ |
Changes to ext/lsm1/lsm_sorted.c.
︙ | |||
658 659 660 661 662 663 664 | 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 | - + - + | } static int btreeCursorPtr(u8 *aData, int nData, int iCell){ int nCell; nCell = pageGetNRec(aData, nData); if( iCell>=nCell ){ |
︙ | |||
747 748 749 750 751 752 753 | 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 | - + | } static int btreeCursorFirst(BtreeCursor *pCsr){ int rc; Page *pPg = 0; FileSystem *pFS = pCsr->pFS; |
︙ | |||
775 776 777 778 779 780 781 | 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 | - + | } } if( rc==LSM_OK ){ assert( pCsr->aPg[pCsr->nDepth].iCell==0 ); pCsr->aPg[pCsr->nDepth].pPage = pPg; pCsr->nDepth++; |
︙ | |||
867 868 869 870 871 872 873 | 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 | - + - - - + + + - + - + - - - + + + - + - - + + - - + + | /* Populate any other aPg[] array entries */ if( rc==LSM_OK && nDepth>1 ){ Blob blob = {0,0,0}; void *pSeek; int nSeek; int iTopicSeek; int iPg = 0; |
︙ | |||
997 998 999 1000 1001 1002 1003 | 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 | - + | static void segmentPtrSetPage(SegmentPtr *pPtr, Page *pNext){ lsmFsPageRelease(pPtr->pPg); if( pNext ){ int nData; u8 *aData = fsPageData(pNext, &nData); pPtr->nCell = pageGetNRec(aData, nData); |
︙ | |||
1633 1634 1635 1636 1637 1638 1639 | 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 | - + | int iTopic, /* Key topic to seek to */ void *pKey, int nKey, /* Key to seek to */ int eSeek, /* Search bias - see above */ int *piPtr, /* OUT: FC pointer */ int *pbStop ){ int (*xCmp)(void *, int, void *, int) = pCsr->pDb->xCmp; |
︙ | |||
1755 1756 1757 1758 1759 1760 1761 | 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 | - + - + | ){ assert( eSeek!=LSM_SEEK_EQ ); rc = segmentPtrAdvance(pCsr, pPtr, eSeek==LSM_SEEK_LE); } } assert( rc!=LSM_OK || assertSeekResult(pCsr,pPtr,iTopic,pKey,nKey,eSeek) ); |
︙ | |||
1795 1796 1797 1798 1799 1800 1801 | 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 | - + | int nRec; int flags; aData = fsPageData(pPg, &nData); flags = pageGetFlags(aData, nData); if( (flags & SEGMENT_BTREE_FLAG)==0 ) break; |
︙ | |||
1821 1822 1823 1824 1825 1826 1827 | 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 | - + | i++; } res = sortedKeyCompare( pCsr->pDb->xCmp, iTopic, pKey, nKey, iTopicT, pKeyT, nKeyT ); if( res<0 ){ |
︙ | |||
1862 1863 1864 1865 1866 1867 1868 | 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 | - + | if( pPtr->pSeg->iRoot ){ Page *pPg; assert( pPtr->pSeg->iRoot!=0 ); rc = seekInBtree(pCsr, pPtr->pSeg, iTopic, pKey, nKey, 0, &pPg); if( rc==LSM_OK ) segmentPtrSetPage(pPtr, pPg); }else{ if( iPtr==0 ){ |
︙ | |||
1919 1920 1921 1922 1923 1924 1925 | 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 | - + - + | } /* If (res<0), then key pKey/nKey is smaller than the split-key (or this ** is not a composite level and there is no split-key). Search the ** left-hand-side of the level in this case. */ if( res<0 ){ int iPtr = 0; |
︙ | |||
2003 2004 2005 2006 2007 2008 2009 | 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 | - + - + - + - + - + - + - + | case CURSOR_DATA_SYSTEM: { Snapshot *pWorker = pCsr->pDb->pWorker; if( pWorker && (pCsr->flags & CURSOR_FLUSH_FREELIST) ){ int nEntry = pWorker->freelist.nEntry; if( pCsr->iFree < (nEntry*2) ){ FreelistEntry *aEntry = pWorker->freelist.aEntry; int i = nEntry - 1 - (pCsr->iFree / 2); |
︙ | |||
2613 2614 2615 2616 2617 2618 2619 | 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 | - + | rc = lsmMCursorLast(pCsr); }else{ rc = lsmMCursorSeek(pCsr, 1, "", 0, LSM_SEEK_GE); } while( rc==LSM_OK && lsmMCursorValid(pCsr) && rtIsSystem(pCsr->eType) ){ void *pKey; int nKey; |
︙ | |||
3471 3472 3473 3474 3475 3476 3477 | 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 | - + | p = &pMW->hier; if( p->apHier==0 && pSeg->iRoot!=0 ){ FileSystem *pFS = pMW->pDb->pFS; lsm_env *pEnv = pMW->pDb->pEnv; Page **apHier = 0; int nHier = 0; |
︙ | |||
3497 3498 3499 3500 3501 3502 3503 | 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 | - + | break; } apHier = apNew; memmove(&apHier[1], &apHier[0], sizeof(Page *) * nHier); nHier++; apHier[0] = pPg; |
︙ | |||
3616 3617 3618 3619 3620 3621 3622 | 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 | - + - + | /* If the key will fit on this page, break out of the loop here. ** The new entry will be written to page apHier[iLevel]. */ pOld = p->apHier[iLevel]; assert( lsmFsPageWritable(pOld) ); aData = fsPageData(pOld, &nData); if( eType==0 ){ |
︙ | |||
3659 3660 3661 3662 3663 3664 3665 | 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 | - - + + - - + + - + | } } /* Write the key into page apHier[iLevel]. */ aData = fsPageData(p->apHier[iLevel], &nData); iOff = mergeWorkerPageOffset(aData, nData); nRec = pageGetNRec(aData, nData); |
︙ | |||
3914 3915 3916 3917 3918 3919 3920 | 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 | - + - + | int iFPtr = 0; /* Pointer value read from footer of pPg */ MultiCursor *pCsr = pMW->pCsr; assert( pMW->pPage==0 ); if( pCsr->pBtCsr ){ rc = LSM_OK; |
︙ | |||
3949 3950 3951 3952 3953 3954 3955 | 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 | - - - + + + - + - + | int iPtr /* Absolute value of page pointer, or 0 */ ){ int rc = LSM_OK; /* Return code */ Merge *pMerge; /* Persistent part of level merge state */ int nHdr; /* Space required for this record header */ Page *pPg; /* Page to write to */ u8 *aData; /* Data buffer for page pWriter->pPage */ |
︙ | |||
3995 3996 3997 3998 3999 4000 4001 | 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 | - + | nHdr = 1 + lsmVarintLen32(iRPtr) + lsmVarintLen32(nKey); if( rtIsWrite(eType) ) nHdr += lsmVarintLen32(nVal); /* If the entire header will not fit on page pPg, or if page pPg is ** marked read-only, advance to the next page of the output run. */ iOff = pMerge->iOutputOff; if( iOff<0 || pPg==0 || iOff+nHdr > SEGMENT_EOF(nData, nRec+1) ){ |
︙ | |||
4029 4030 4031 4032 4033 4034 4035 | 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 | - - - + + + - + | } /* Update the output segment */ if( rc==LSM_OK ){ aData = fsPageData(pPg, &nData); /* Update the page footer. */ |
︙ | |||
4256 4257 4258 4259 4260 4261 4262 | 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 | - + | rc = multiCursorGetVal(pCsr, iVal, &pVal, &nVal); if( pVal && rc==LSM_OK ){ assert( nVal>=0 ); rc = sortedBlobSet(pDb->pEnv, &pCsr->val, pVal, nVal); pVal = pCsr->val.pData; } if( rc==LSM_OK ){ |
︙ | |||
4577 4578 4579 4580 4581 4582 4583 | 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 | - + | int i; for(i=0; rc==LSM_OK && i<pCsr->nPtr; i++){ MergeInput *pInput = &pMerge->aInput[i]; if( pInput->iPg ){ SegmentPtr *pPtr; assert( pCsr->aPtr[i].pPg==0 ); pPtr = &pCsr->aPtr[i]; |
︙ | |||
5180 5181 5182 5183 5184 5185 5186 | 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 | - + | u32 nUnsync; int nPgsz; lsmCheckpointSynced(pDb, 0, 0, &nSync); nUnsync = lsmCheckpointNWrite(pDb->pShmhdr->aSnap1, 0); nPgsz = lsmCheckpointPgsz(pDb->pShmhdr->aSnap1); |
︙ | |||
5518 5519 5520 5521 5522 5523 5524 | 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 | - + - + | int flags; u8 *aData; int nData; aData = fsPageData(pPg, &nData); nRec = pageGetNRec(aData, nData); |
︙ | |||
5589 5590 5591 5592 5593 5594 5595 | 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 | - + | int *piPgPtr, u8 **paKey, int *pnKey, u8 **paVal, int *pnVal, Blob *pBlob ){ u8 *aData; int nData; /* Page data */ u8 *aKey; int nKey = 0; /* Key */ |
︙ | |||
5695 5696 5697 5698 5699 5700 5701 | 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 | - + - - + + - + | if( rc==LSM_OK ){ Blob blob = {0, 0, 0, 0}; int nKeyWidth = 0; LsmString str; int nRec; int iPtr; |
︙ | |||
5731 5732 5733 5734 5735 5736 5737 | 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 | - + | int eType; Pgno iAbsPtr; char zFlags[8]; infoCellDump(pDb, pSeg, bIndirect, pPg, iCell, &eType, &iPgPtr, &aKey, &nKey, &aVal, &nVal, &blob ); |
︙ |
Changes to ext/lsm1/lsm_tree.c.
︙ | |||
274 275 276 277 278 279 280 281 | 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | + - + - + | /* ** The pointer passed as the first argument points to an interior node, ** not a leaf. This function returns the offset of the iCell'th child ** sub-tree of the node. */ static u32 getChildPtr(TreeNode *p, int iVersion, int iCell){ assert( iVersion>=0 ); assert( iCell>=0 && iCell<=array_size(p->aiChildPtr) ); |
︙ | |||
515 516 517 518 519 520 521 | 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 | - + | printf("% 6d %.*sleaf%.*s: %s\n", iNode, nPath, zPath, 20-nPath-4, zSpace, s.z ); lsmStringClear(&s); }else{ for(i=0; i<4 && nHeight>0; i++){ u32 iPtr = getChildPtr(pNode, pDb->treehdr.root.iTransId, i); |
︙ | |||
640 641 642 643 644 645 646 | 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 | - + | iWrite = (iWrite + 3) & ~0x0003; assert( (iWrite % 4)==0 ); } assert( iWrite ); iChunk = treeOffsetToChunk(iWrite-1); iEof = (iChunk+1) * CHUNK_SIZE; |
︙ | |||
753 754 755 756 757 758 759 | 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 | - + | while( nRem>0 ){ u8 *aAlloc; int nAlloc; u32 iWrite; iWrite = (pDb->treehdr.iWrite & (LSM_SHM_CHUNK_SIZE-1)); iWrite = LSM_MAX(iWrite, LSM_SHM_CHUNK_HDR); |
︙ | |||
1205 1206 1207 1208 1209 1210 1211 | 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 | - + | } }else{ p = 0; } nVisit++; } |
︙ | |||
1255 1256 1257 1258 1259 1260 1261 | 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 | - + - + - + - + | int i; ShmChunk *p; ShmChunk *pMin = 0; u32 iMin = 0; /* Iterate through all shm chunks. Find the smallest shm-id present in ** the shared-memory region. */ |
︙ | |||
1371 1372 1373 1374 1375 1376 1377 | 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 | - + | TreeRoot *p = &db->treehdr.root; TreeNode *pNew; u32 iNew; TreeNode *pNode = pCsr->apTreeNode[pCsr->iNode]; int iCell = pCsr->aiCell[pCsr->iNode]; /* Create a copy of this node */ |
︙ | |||
1394 1395 1396 1397 1398 1399 1400 | 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 | - + - + | } static int treeNextIsEndDelete(lsm_db *db, TreeCursor *pCsr){ int iNode = pCsr->iNode; int iCell = pCsr->aiCell[iNode]+1; /* Cursor currently points to a leaf node. */ |
︙ | |||
1446 1447 1448 1449 1450 1451 1452 | 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 | - + | int nVal /* Bytes in value data (or -ve for delete) */ ){ int rc = LSM_OK; /* Return Code */ TreeKey *pTreeKey; /* New key-value being inserted */ u32 iTreeKey; TreeRoot *p = &pDb->treehdr.root; TreeCursor csr; /* Cursor to seek to pKey/nKey */ |
︙ | |||
1593 1594 1595 1596 1597 1598 1599 | 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 | - + - + | int iSlot = pCsr->aiCell[pCsr->iNode]; int bLeaf; int rc = LSM_OK; assert( pNode->aiKeyPtr[1] ); assert( pNode->aiKeyPtr[iSlot] ); assert( iSlot==0 || iSlot==1 || iSlot==2 ); |
︙ | |||
1760 1761 1762 1763 1764 1765 1766 | 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 | - + | } } } if( iDir==-1 ){ iPSlot--; pNew1->aiKeyPtr[iKOut++] = pParent->aiKeyPtr[iPSlot]; if( bLeaf==0 ) pNew1->aiChildPtr[iPOut++] = iNewptr; |
︙ | |||
1835 1836 1837 1838 1839 1840 1841 | 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 | - + - + | bDone = 1; if( lsmTreeCursorValid(&csr) ){ lsmTreeCursorKey(&csr, 0, &pDel, &nDel); if( treeKeycmp(pDel, nDel, pKey2, nKey2)<0 ) bDone = 0; } if( bDone==0 ){ |
︙ | |||
2024 2025 2026 2027 2028 2029 2030 | 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 | - + - + - + | pTreeKey = (TreeKey*)treeShmptrUnsafe(pDb, iTreeKey); if( !(pTreeKey->flags & LSM_CONTIGUOUS) ){ pTreeKey = treeShmkey(pDb, iTreeKey, TKV_LOADKEY, &b, &rc); if( rc ) break; } res = treeKeycmp((void *)&pTreeKey[1], pTreeKey->nKey, pKey, nKey); if( res==0 ){ |
︙ | |||
2163 2164 2165 2166 2167 2168 2169 | 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 | - + - + | u32 iNodePtr; pCsr->iNode++; iNodePtr = getChildPtr(pNode, pRoot->iTransId, iCell); pNode = (TreeNode *)treeShmptr(pDb, iNodePtr); if( rc!=LSM_OK ) break; pCsr->apTreeNode[pCsr->iNode] = pNode; iCell = 1 + (pNode->aiKeyPtr[2]!=0) + (pCsr->iNode < iLeaf); |
︙ | |||
2220 2221 2222 2223 2224 2225 2226 | 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 | - + - + | iCell = ((pNode->aiKeyPtr[2]==0) ? 2 : 3); }else{ iCell = ((pNode->aiKeyPtr[0]==0) ? 1 : 0); } pCsr->iNode++; pCsr->apTreeNode[pCsr->iNode] = pNode; |
︙ |
Changes to ext/lsm1/lsm_varint.c.
︙ | |||
172 173 174 175 176 177 178 | 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | - + | } if( z[0]==250 ){ *piVal = (z[1]<<16) + (z[2]<<8) + z[3]; return 4; } ret = lsmSqlite4GetVarint64(z, &i); |
︙ |
Changes to ext/lsm1/lsm_vtab.c.
︙ | |||
153 154 155 156 157 158 159 | 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | - + | /* ** Advance a lsm1_cursor to its next row of output. */ static int lsm1Next(sqlite3_vtab_cursor *cur){ lsm1_cursor *pCur = (lsm1_cursor*)cur; |
︙ | |||
364 365 366 367 368 369 370 | 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 | - + - + | pVal = (const void*)sqlite3_value_text(pValue); if( pVal==0 ) return SQLITE_NOMEM; } if( nVal+1>nSpace ){ pSpace = sqlite3_malloc( nVal+1 ); if( pSpace==0 ) return SQLITE_NOMEM; } |
︙ | |||
593 594 595 596 597 598 599 | 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 | - + | sqlite3_value **argv, sqlite_int64 *pRowid ){ lsm1_vtab *p = (lsm1_vtab*)pVTab; const void *pKey; int nKey; int eType; |
︙ | |||
650 651 652 653 654 655 656 | 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 | - + | pVal = (unsigned char*)sqlite3_value_blob(pValue); } nVal = sqlite3_value_bytes(pValue); pData = sqlite3_malloc( nVal+1 ); if( pData==0 ){ rc = SQLITE_NOMEM; }else{ |
︙ | |||
673 674 675 676 677 678 679 | 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 | - + | assert( sizeof(r)==sizeof(x) ); memcpy(&x, &r, sizeof(r)); } for(i=8; x>0 && i>=1; i--){ aVal[i] = x & 0xff; x >>= 8; } |
︙ |
Changes to ext/lsm1/lsm_win32.c.
︙ | |||
43 44 45 46 47 48 49 | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | - + - - + + - + | LPVOID pMap; /* Pointer to mapping of file fd */ size_t nMap; /* Size of mapping at pMap in bytes */ int nShm; /* Number of entries in ahShm[]/apShm[] */ LPHANDLE ahShm; /* Array of handles for shared mappings */ LPVOID *apShm; /* Array of 32K shared memory segments */ }; |
︙ | |||
249 250 251 252 253 254 255 | 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | - + | int rc = LSM_OK; Win32File *pWin32File; pWin32File = lsmMallocZero(pEnv, sizeof(Win32File)); if( pWin32File==0 ){ rc = LSM_NOMEM_BKPT; }else{ |
︙ | |||
375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 | 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 | + + + + + + + + + + + + - - - - - + + + - - - + - | return rc; } static int lsmWin32OsSectorSize(lsm_file *pFile){ return 512; } static void win32Unmap(Win32File *pWin32File){ if( pWin32File->pMap!=NULL ){ UnmapViewOfFile(pWin32File->pMap); pWin32File->pMap = NULL; pWin32File->nMap = 0; } if( pWin32File->hMap!=NULL ){ CloseHandle(pWin32File->hMap); pWin32File->hMap = NULL; } } static int lsmWin32OsRemap( lsm_file *pFile, lsm_i64 iMin, void **ppOut, lsm_i64 *pnOut ){ Win32File *pWin32File = (Win32File *)pFile; /* If the file is between 0 and 2MB in size, extend it in chunks of 256K. ** Thereafter, in chunks of 1MB at a time. */ const int aIncrSz[] = {256*1024, 1024*1024}; int nIncrSz = aIncrSz[iMin>(2*1024*1024)]; |
︙ | |||
576 577 578 579 580 581 582 | 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 | - - + + + + + + + - + - + - + - + - + - - + - - - - - - - - - - - - + + + + + - - - - - + - | } #if !defined(win32IsLockBusy) #define win32IsLockBusy(a) (((a)==ERROR_LOCK_VIOLATION) || \ ((a)==ERROR_IO_PENDING)) #endif |
︙ | |||
674 675 676 677 678 679 680 | 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 | - + - - - + - + - - + - + + | if( fileSize.QuadPart<nReq ){ rc = win32Truncate(pWin32File->hShmFile, nReq); if( rc!=LSM_OK ){ return rc; } } |
︙ | |||
757 758 759 760 761 762 763 | 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 | - - - - + - - - - - | #define MX_CLOSE_ATTEMPT 3 static int lsmWin32OsClose(lsm_file *pFile){ int rc; int nRetry = 0; Win32File *pWin32File = (Win32File *)pFile; lsmWin32OsShmUnmap(pFile, 0); |
︙ | |||
950 951 952 953 954 955 956 | 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 | - + | } static int lsmWin32OsMutexNotHeld(lsm_mutex *p){ Win32Mutex *pMutex = (Win32Mutex *)p; return pMutex ? pMutex->owner!=GetCurrentThreadId() : 1; } #endif /* |
︙ |
Added ext/misc/completion.c.