SQLite

Check-in [ecab208333]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add test cases to fts4merge.test.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | fts4-incr-merge
Files: files | file ages | folders
SHA1: ecab2083334dcdde24a3c56864114979b7a6f25a
User & Date: dan 2012-03-22 17:48:00.732
Context
2012-03-23
11:07
Update a couple of existing test cases. (check-in: dcb8fa0f77 user: dan tags: fts4-incr-merge)
2012-03-22
17:48
Add test cases to fts4merge.test. (check-in: ecab208333 user: dan tags: fts4-incr-merge)
16:48
Following an incr-merge operation that does not completely consume its input segments, store context in the rowid==1 row of the %_stat table that allows the next incr-merge to pick up where the previous left off. (check-in: ab0a4f44fb user: dan tags: fts4-incr-merge)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/fts4merge.test.
157
158
159
160
161
162
163





























































































164
165
166
} {X'0006'}

do_execsql_test 4.4.2 {
  DELETE FROM t4_stat WHERE rowid=1;
  INSERT INTO t4(t4) VALUES('merge=1,12');
  SELECT level, group_concat(idx, ' ') FROM t4_segdir GROUP BY level;
} "0 {0 1 2 3 4 5}                     1 0"































































































finish_test







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>



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
250
251
252
253
254
255
256
257
258
259
} {X'0006'}

do_execsql_test 4.4.2 {
  DELETE FROM t4_stat WHERE rowid=1;
  INSERT INTO t4(t4) VALUES('merge=1,12');
  SELECT level, group_concat(idx, ' ') FROM t4_segdir GROUP BY level;
} "0 {0 1 2 3 4 5}                     1 0"

#-------------------------------------------------------------------------
# Test cases 5.*
#
# Test that if a crisis-merge occurs that disrupts an ongoing incremental
# merge, the next call to "merge=A,B" identifies this and starts a new
# incremental merge. There are two scenarios:
#
#   * There are less segments on the input level that the disrupted
#     incremental merge operated on, or
#   
#   * Sufficient segments exist on the input level but the segments 
#     contain keys smaller than the largest key in the potential output 
#     segment.
# 
do_test 5.1 {
  reset_db
  fts3_build_db_1 1000
} {}

do_execsql_test 5.2 {
  SELECT level, group_concat(idx, ' ') FROM t1_segdir GROUP BY level;
} {
  0 {0 1 2 3 4 5 6 7} 
  1 {0 1 2 3 4 5 6 7 8 9 10 11 12 13} 
  2 {0 1 2}
}

do_execsql_test 5.3 {
  INSERT INTO t1(t1) VALUES('merge=1,4');
  SELECT level, group_concat(idx, ' ') FROM t1_segdir GROUP BY level;
} {
  0 {0 1 2 3 4 5 6 7} 
  1 {0 1 2 3 4 5 6 7 8 9 10 11 12 13} 
  2 {0 1 2 3}
}

do_execsql_test 5.4 {SELECT quote(value) from t1_stat WHERE rowid=1} {X'0104'}
do_test 5.5 {
  foreach docid [execsql {SELECT docid FROM t1}] {
    execsql {INSERT INTO t1 SELECT * FROM t1 WHERE docid=$docid}
  }
} {}

do_execsql_test 5.6 {SELECT quote(value) from t1_stat WHERE rowid=1} {X'0104'}

do_execsql_test 5.7 {
  SELECT level, group_concat(idx, ' ') FROM t1_segdir GROUP BY level;
  SELECT quote(value) from t1_stat WHERE rowid=1;
} {
  0 {0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15} 
  1 {0 1 2 3 4 5 6 7 8 9 10 11} 
  2 {0 1 2 3 4 5 6 7}
  X'0104'
}

do_execsql_test 5.8 {
  INSERT INTO t1(t1) VALUES('merge=1,4');
  SELECT level, group_concat(idx, ' ') FROM t1_segdir GROUP BY level;
  SELECT quote(value) from t1_stat WHERE rowid=1;
} {
  0 {0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15} 
  1 {0 1 2 3 4 5 6 7 8 9 10 11} 
  2 {0 1 2 3 4 5 6 7}
  3 {0}
  X'0204'
}

do_test 5.9 {
  set L [expr 16*16*8 + 16*4 + 1]
  foreach docid [execsql {
      SELECT docid FROM t1 UNION ALL SELECT docid FROM t1 LIMIT $L
  }] {
    execsql {INSERT INTO t1 SELECT * FROM t1 WHERE docid=$docid}
  }
} {}

do_execsql_test 5.10 {
  SELECT level, group_concat(idx, ' ') FROM t1_segdir GROUP BY level;
  SELECT quote(value) from t1_stat WHERE rowid=1;
} {
  0 0   1 0   2 0   3 {0 1}
  X'0204'
}

do_execsql_test 5.11 {
  INSERT INTO t1(t1) VALUES('merge=10,4');
  SELECT level, group_concat(idx, ' ') FROM t1_segdir GROUP BY level;
  SELECT quote(value) from t1_stat WHERE rowid=1;
} {
  0 0   1 0   2 0   3 {0 1}
  X'0000'
}


finish_test