Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: third_party/sqlite/src/test/fts4growth.test

Issue 2751253002: [sql] Import SQLite 3.17.0. (Closed)
Patch Set: also clang on Linux i386 Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # 2014 May 12 1 # 2014 May 12
2 # 2 #
3 # The author disclaims copyright to this source code. In place of 3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing: 4 # a legal notice, here is a blessing:
5 # 5 #
6 # May you do good and not evil. 6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others. 7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give. 8 # May you share freely, never taking more than you give.
9 # 9 #
10 #************************************************************************* 10 #*************************************************************************
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 {There's nothing walks or jumps, or runs, on axle, hoof, or wheel,} 52 {There's nothing walks or jumps, or runs, on axle, hoof, or wheel,}
53 {But what I'll sit, while hide will hold and girths and straps are tight:} 53 {But what I'll sit, while hide will hold and girths and straps are tight:}
54 {I'll ride this here two-wheeled concern right straight away at sight."} 54 {I'll ride this here two-wheeled concern right straight away at sight."}
55 } { 55 } {
56 execsql { INSERT INTO x1 VALUES($L) } 56 execsql { INSERT INTO x1 VALUES($L) }
57 } 57 }
58 execsql { 58 execsql {
59 INSERT INTO x1(x1) VALUES('merge=4,4'); 59 INSERT INTO x1(x1) VALUES('merge=4,4');
60 SELECT level, end_block, length(root) FROM x1_segdir; 60 SELECT level, end_block, length(root) FROM x1_segdir;
61 } 61 }
62 } {0 {0 110} 110 0 {0 132} 132 0 {0 129} 129 1 {128 658} 2} 62 } {1 {224 921} 2}
63 63
64 do_execsql_test 1.5 { 64 do_execsql_test 1.5 {
65 SELECT length(block) FROM x1_segments; 65 SELECT length(block) FROM x1_segments;
66 } {658 {}} 66 } {921 {}}
67 67
68 do_test 1.6 { 68 do_test 1.6 {
69 foreach L { 69 foreach L {
70 {'Twas Mulga Bill, from Eaglehawk, that sought his own abode,} 70 {'Twas Mulga Bill, from Eaglehawk, that sought his own abode,}
71 {That perched above Dead Man's Creek, beside the mountain road.} 71 {That perched above Dead Man's Creek, beside the mountain road.}
72 {He turned the cycle down the hill and mounted for the fray,} 72 {He turned the cycle down the hill and mounted for the fray,}
73 {But 'ere he'd gone a dozen yards it bolted clean away.} 73 {But 'ere he'd gone a dozen yards it bolted clean away.}
74
74 {It left the track, and through the trees, just like a silver steak,} 75 {It left the track, and through the trees, just like a silver steak,}
75 {It whistled down the awful slope towards the Dead Man's Creek.} 76 {It whistled down the awful slope towards the Dead Man's Creek.}
76 {It shaved a stump by half an inch, it dodged a big white-box:} 77 {It shaved a stump by half an inch, it dodged a big white-box:}
77 {The very wallaroos in fright went scrambling up the rocks,} 78 {The very wallaroos in fright went scrambling up the rocks,}
79
78 {The wombats hiding in their caves dug deeper underground,} 80 {The wombats hiding in their caves dug deeper underground,}
79 {As Mulga Bill, as white as chalk, sat tight to every bound.} 81 {As Mulga Bill, as white as chalk, sat tight to every bound.}
80 {It struck a stone and gave a spring that cleared a fallen tree,} 82 {It struck a stone and gave a spring that cleared a fallen tree,}
81 {It raced beside a precipice as close as close could be;} 83 {It raced beside a precipice as close as close could be;}
84
82 {And then as Mulga Bill let out one last despairing shriek} 85 {And then as Mulga Bill let out one last despairing shriek}
83 {It made a leap of twenty feet into the Dead Man's Creek.} 86 {It made a leap of twenty feet into the Dead Man's Creek.}
87 {It shaved a stump by half an inch, it dodged a big white-box:}
88 {The very wallaroos in fright went scrambling up the rocks,}
89 {The wombats hiding in their caves dug deeper underground,}
84 } { 90 } {
85 execsql { INSERT INTO x1 VALUES($L) } 91 execsql { INSERT INTO x1 VALUES($L) }
86 } 92 }
87 execsql { 93 execsql {
88 SELECT level, end_block, length(root) FROM x1_segdir; 94 SELECT level, end_block, length(root) FROM x1_segdir;
89 } 95 }
90 } {1 {128 658} 2 1 {130 1377} 6 0 {0 117} 117} 96 } {1 {224 921} 2 1 {226 1230} 7 0 {0 98} 98}
91 97
92 do_execsql_test 1.7 { 98 do_execsql_test 1.7 {
93 SELECT sum(length(block)) FROM x1_segments WHERE blockid IN (129, 130); 99 SELECT sum(length(block)) FROM x1_segments WHERE blockid IN (224,225,226)
94 } {1377} 100 } {1230}
95 101
96 #------------------------------------------------------------------------- 102 #-------------------------------------------------------------------------
97 # 103 #
98 do_execsql_test 2.1 { 104 do_execsql_test 2.1 {
99 CREATE TABLE t1(docid, words); 105 CREATE TABLE t1(docid, words);
100 CREATE VIRTUAL TABLE x2 USING fts4; 106 CREATE VIRTUAL TABLE x2 USING fts4;
101 } 107 }
102 fts_kjv_genesis 108 fts_kjv_genesis
103 do_test 2.2 { 109 do_test 2.2 {
104 foreach id [db eval {SELECT docid FROM t1}] { 110 foreach id [db eval {SELECT docid FROM t1}] {
(...skipping 19 matching lines...) Expand all
124 SELECT count(*) FROM x2_segdir WHERE level=2; 130 SELECT count(*) FROM x2_segdir WHERE level=2;
125 SELECT count(*) FROM x2_segdir WHERE level=3; 131 SELECT count(*) FROM x2_segdir WHERE level=3;
126 } {6 1} 132 } {6 1}
127 133
128 do_execsql_test 2.5 { 134 do_execsql_test 2.5 {
129 SELECT end_block FROM x2_segdir WHERE level=3; 135 SELECT end_block FROM x2_segdir WHERE level=3;
130 INSERT INTO x2(x2) VALUES('merge=4,4'); 136 INSERT INTO x2(x2) VALUES('merge=4,4');
131 SELECT end_block FROM x2_segdir WHERE level=3; 137 SELECT end_block FROM x2_segdir WHERE level=3;
132 INSERT INTO x2(x2) VALUES('merge=4,4'); 138 INSERT INTO x2(x2) VALUES('merge=4,4');
133 SELECT end_block FROM x2_segdir WHERE level=3; 139 SELECT end_block FROM x2_segdir WHERE level=3;
134 } {{3828 -3430} {3828 -10191} {3828 -14109}} 140 } {{5588 -3950} {5588 -11766} {5588 -15541}}
135 141
136 do_execsql_test 2.6 { 142 do_execsql_test 2.6 {
137 SELECT sum(length(block)) FROM x2_segdir, x2_segments WHERE 143 SELECT sum(length(block)) FROM x2_segdir, x2_segments WHERE
138 blockid BETWEEN start_block AND leaves_end_block 144 blockid BETWEEN start_block AND leaves_end_block
139 AND level=3 145 AND level=3
140 } {14109} 146 } {15541}
141 147
142 do_execsql_test 2.7 { 148 do_execsql_test 2.7 {
143 INSERT INTO x2(x2) VALUES('merge=1000,4'); 149 INSERT INTO x2(x2) VALUES('merge=1000,4');
144 SELECT end_block FROM x2_segdir WHERE level=3; 150 SELECT end_block FROM x2_segdir WHERE level=3;
145 } {{3828 86120}} 151 } {{5588 127563}}
146 152
147 do_execsql_test 2.8 { 153 do_execsql_test 2.8 {
148 SELECT sum(length(block)) FROM x2_segdir, x2_segments WHERE 154 SELECT sum(length(block)) FROM x2_segdir, x2_segments WHERE
149 blockid BETWEEN start_block AND leaves_end_block 155 blockid BETWEEN start_block AND leaves_end_block
150 AND level=3 156 AND level=3
151 } {86120} 157 } {127563}
152 158
153 #-------------------------------------------------------------------------- 159 #--------------------------------------------------------------------------
154 # Test that delete markers are removed from FTS segments when possible. 160 # Test that delete markers are removed from FTS segments when possible.
155 # It is only possible to remove delete markers when the output of the 161 # It is only possible to remove delete markers when the output of the
156 # merge operation will become the oldest segment in the index. 162 # merge operation will become the oldest segment in the index.
157 # 163 #
158 # 3.1 - when the oldest segment is created by an 'optimize'. 164 # 3.1 - when the oldest segment is created by an 'optimize'.
159 # 3.2 - when the oldest segment is created by an incremental merge. 165 # 3.2 - when the oldest segment is created by an incremental merge.
160 # 3.3 - by a crisis merge. 166 # 3.3 - by a crisis merge.
161 # 167 #
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 0 0 {118 117483} 0 1 {238 118006} 0 2 {358 118006} 390 0 0 {118 117483} 0 1 {238 118006} 0 2 {358 118006}
385 0 3 {478 118006} 0 4 {598 118006} 0 5 {718 118006} 391 0 3 {478 118006} 0 4 {598 118006} 0 5 {718 118006}
386 } 392 }
387 393
388 do_execsql_test 7.2 { 394 do_execsql_test 7.2 {
389 INSERT INTO x6(x6) VALUES('merge=25,4'); 395 INSERT INTO x6(x6) VALUES('merge=25,4');
390 SELECT level, idx, end_block FROM x6_segdir; 396 SELECT level, idx, end_block FROM x6_segdir;
391 } { 397 } {
392 0 0 {118 117483} 0 1 {238 118006} 0 2 {358 118006} 398 0 0 {118 117483} 0 1 {238 118006} 0 2 {358 118006}
393 0 3 {478 118006} 0 4 {598 118006} 0 5 {718 118006} 399 0 3 {478 118006} 0 4 {598 118006} 0 5 {718 118006}
394 1 0 {16014 -51226} 400 1 0 {23694 -69477}
395 } 401 }
396 402
397 do_execsql_test 7.3 { 403 do_execsql_test 7.3 {
398 UPDATE x6_segdir SET end_block = first(end_block) WHERE level=1; 404 UPDATE x6_segdir SET end_block = first(end_block) WHERE level=1;
399 SELECT level, idx, end_block FROM x6_segdir; 405 SELECT level, idx, end_block FROM x6_segdir;
400 } { 406 } {
401 0 0 {118 117483} 0 1 {238 118006} 0 2 {358 118006} 407 0 0 {118 117483} 0 1 {238 118006} 0 2 {358 118006}
402 0 3 {478 118006} 0 4 {598 118006} 0 5 {718 118006} 408 0 3 {478 118006} 0 4 {598 118006} 0 5 {718 118006}
403 1 0 16014 409 1 0 23694
404 } 410 }
405 411
406 do_execsql_test 7.4 { 412 do_execsql_test 7.4 {
407 INSERT INTO x6(x6) VALUES('merge=25,4'); 413 INSERT INTO x6(x6) VALUES('merge=25,4');
408 SELECT level, idx, end_block FROM x6_segdir; 414 SELECT level, idx, end_block FROM x6_segdir;
409 } { 415 } {
410 0 0 {118 117483} 0 1 {238 118006} 0 2 {358 118006} 416 0 0 {118 117483} 0 1 {238 118006} 0 2 {358 118006}
411 0 3 {478 118006} 0 4 {598 118006} 0 5 {718 118006} 417 0 3 {478 118006} 0 4 {598 118006} 0 5 {718 118006}
412 1 0 16014 418 1 0 23694
413 } 419 }
414 420
415 do_execsql_test 7.5 { 421 do_execsql_test 7.5 {
416 INSERT INTO x6(x6) VALUES('merge=2500,4'); 422 INSERT INTO x6(x6) VALUES('merge=2500,4');
417 SELECT level, idx, end_block FROM x6_segdir; 423 SELECT level, idx, start_block, leaves_end_block, end_block FROM x6_segdir;
418 } { 424 } {
419 0 0 {598 118006} 0 1 {718 118006} 1 0 16014 425 1 0 719 1171 23694
420 } 426 }
421 427
422 do_execsql_test 7.6 { 428 do_execsql_test 7.6 {
423 INSERT INTO x6(x6) VALUES('merge=2500,2'); 429 INSERT INTO x6(x6) VALUES('merge=2500,2');
424 SELECT level, idx, start_block, leaves_end_block, end_block FROM x6_segdir; 430 SELECT level, idx, start_block, leaves_end_block, end_block FROM x6_segdir;
425 } { 431 } {
426 2 0 23695 24147 {41262 633507} 432 1 0 719 1171 23694
427 } 433 }
428 434
429 do_execsql_test 7.7 { 435 do_execsql_test 7.7 {
430 SELECT sum(length(block)) FROM x6_segments 436 SELECT sum(length(block)) FROM x6_segments
431 WHERE blockid BETWEEN 23695 AND 24147 437 } {635247}
432 } {633507}
433
434 438
435 439
436 finish_test 440 finish_test
437
OLDNEW
« no previous file with comments | « third_party/sqlite/src/test/fts4content.test ('k') | third_party/sqlite/src/test/fts4growth2.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698