Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/sqlite/blob/master/ext/vec1/test/vec1fault4.test # sqlite [Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `sqlite / ext / vec1 / test / vec1fault4.test` 149 lines ยท 3401 bytes Raw Blame History 1 # 2026-04-01 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 # 13 14 source [file join [file dirname [info script]] vec1_common.tcl] 15 set testprefix vec1fault4 16 vec1_load db 17 18 do_execsql_test 1.0 { 19 CREATE VIRTUAL TABLE t1 USING vec1(a, b); 20 INSERT INTO t1(cmd, arg) VALUES('rebuild', '{index:"flat"}'); 21 WITH s(i) AS ( 22 SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<10000 23 ) 24 INSERT INTO t1 SELECT random_vector(13), i+0.5 FROM s; 25 } 26 faultsim_save_and_close 27 28 do_faultsim_test 1 -faults oom* -prep { 29 faultsim_restore_and_reopen 30 vec1_load db 31 db eval { PRAGMA table_info = t1 } 32 } -body { 33 execsql { 34 SELECT count(*) FROM t1(random_vector(13), 13); 35 } 36 } -test { 37 faultsim_test_result {0 13} 38 } 39 40 do_faultsim_test 2 -faults oom* -prep { 41 faultsim_restore_and_reopen 42 vec1_load db 43 db eval { PRAGMA table_info = t1 } 44 } -body { 45 execsql { 46 SELECT count(*) FROM t1(random_vector(13), '{K:5000,streaming:true}'); 47 } 48 } -test { 49 faultsim_test_result {0 10000} 50 } 51 52 do_execsql_test 2.1 { 53 INSERT INTO t1(cmd, arg) VALUES('rebuild', ( 54 SELECT vec1_train(a, '{nbucket:8}') FROM t1 WHERE rowid<1000 55 )); 56 } 57 faultsim_save_and_close 58 59 do_faultsim_test 2.2 -faults oom* -prep { 60 faultsim_restore_and_reopen 61 vec1_load db 62 db eval { PRAGMA table_info = t1 } 63 } -body { 64 execsql { 65 SELECT count(*) FROM t1( 66 random_vector(13), '{K:5000,streaming:true,nprobe:2}' 67 ); 68 } 69 } -test { 70 faultsim_test_result {0 10000} 71 } 72 73 74 faultsim_restore_and_reopen 75 vec1_load db 76 do_execsql_test 3.0 { 77 INSERT INTO t1(cmd, arg) VALUES('rebuild', ( 78 SELECT vec1_train(a, '{codesize:13}') FROM t1 WHERE rowid<1000 79 )); 80 } 81 faultsim_save_and_close 82 83 breakpoint 84 do_faultsim_test 3 -faults oom-t* -prep { 85 faultsim_restore_and_reopen 86 vec1_load db 87 db eval { PRAGMA table_info = t1 } 88 } -body { 89 execsql { 90 SELECT count(*) FROM t1(random_vector(13), 13); 91 } 92 } -test { 93 faultsim_test_result {0 13} 94 } 95 96 #------------------------------------------------------------------------- 97 reset_db 98 vec1_load db 99 100 do_execsql_test 4.0 { 101 CREATE VIRTUAL TABLE t1 USING vec1(a, b); 102 INSERT INTO t1(cmd, arg) VALUES('rebuild', '{index:"flat"}'); 103 INSERT INTO t1(a, b) VALUES( random_vector(13), 1.123 ); 104 } 105 faultsim_save_and_close 106 107 do_faultsim_test 4 -faults oom-t* -prep { 108 faultsim_restore_and_reopen 109 vec1_load db 110 db eval { PRAGMA table_info = t1 } 111 } -body { 112 execsql { 113 INSERT INTO t1(a, b) VALUES( random_vector(13), 'text' ); 114 } 115 } -test { 116 faultsim_test_result {0 {}} 117 } 118 119 #------------------------------------------------------------------------- 120 reset_db 121 vec1_load db 122 123 do_execsql_test 5.0 { 124 CREATE TABLE t1(a); 125 WITH s(i) AS ( 126 SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<100 127 ) 128 INSERT INTO t1 SELECT random_vector(12) FROM s; 129 } 130 131 proc progress {args} {} 132 133 faultsim_save_and_close 134 do_faultsim_test 5 -faults oom-t* -prep { 135 faultsim_restore_and_reopen 136 vec1_load db 137 db func progress progress 138 db eval { SELECT count(*) FROM t1 } 139 } -body { 140 execsql { 141 SELECT length( vec1_train(a, '{nbucket:8, progress:"progress"}') ) FROM t1 142 } 143 } -test { 144 faultsim_test_result {0 408} 145 } 146 147 148 finish_test 149