fts5merge2.test 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. # 2014 Dec 20
  2. #
  3. # The author disclaims copyright to this source code. In place of
  4. # a legal notice, here is a blessing:
  5. #
  6. # May you do good and not evil.
  7. # May you find forgiveness for yourself and forgive others.
  8. # May you share freely, never taking more than you give.
  9. #
  10. #***********************************************************************
  11. #
  12. # Test that focus on incremental merges of segments.
  13. #
  14. source [file join [file dirname [info script]] fts5_common.tcl]
  15. set testprefix fts5merge2
  16. return_if_no_fts5
  17. proc dump_structure {} {
  18. db eval {SELECT fts5_decode(id, block) AS t FROM t1_data WHERE id=10} {
  19. foreach lvl [lrange $t 1 end] {
  20. set seg [string repeat . [expr [llength $lvl]-2]]
  21. puts "[lrange $lvl 0 1] $seg"
  22. }
  23. }
  24. }
  25. foreach_detail_mode $testprefix {
  26. do_execsql_test 1.0 {
  27. CREATE VIRTUAL TABLE t1 USING fts5(x, detail=%DETAIL%);
  28. INSERT INTO t1(t1, rank) VALUES('pgsz', 32);
  29. INSERT INTO t1(t1, rank) VALUES('crisismerge', 2);
  30. INSERT INTO t1 VALUES('1 2 3 4');
  31. }
  32. expr srand(0)
  33. db func rnddoc fts5_rnddoc
  34. do_test 1.1 {
  35. for {set i 0} {$i < 100} {incr i} {
  36. execsql {
  37. BEGIN;
  38. DELETE FROM t1 WHERE rowid = 1;
  39. INSERT INTO t1(rowid, x) VALUES(1, '1 2 3 4');
  40. INSERT INTO t1 VALUES(rnddoc(10));
  41. COMMIT;
  42. }
  43. }
  44. } {}
  45. do_execsql_test 1.2 {
  46. INSERT INTO t1(t1) VALUES('integrity-check');
  47. }
  48. }
  49. finish_test