@@ -74,71 +74,6 @@ impl<RT: Runtime> VectorIndexFlusher<RT> {
7474 self . flusher . step ( ) . await
7575 }
7676
77- #[ cfg( any( test, feature = "testing" ) ) ]
78- pub async fn build_index_in_test (
79- index_name : TabletIndexName ,
80- table_name : value:: TableName ,
81- runtime : RT ,
82- database : Database < RT > ,
83- reader : Arc < dyn PersistenceReader > ,
84- storage : Arc < dyn Storage > ,
85- ) -> anyhow:: Result < ( ) > {
86- use anyhow:: Context ;
87- use common:: types:: IndexName ;
88- use keybroker:: Identity ;
89- use value:: TableNamespace ;
90-
91- use crate :: {
92- index_workers:: {
93- index_meta:: SearchIndexConfigParser ,
94- search_flusher:: IndexBuild ,
95- BuildReason ,
96- } ,
97- IndexModel ,
98- } ;
99-
100- let mut tx = database. begin ( Identity :: system ( ) ) . await ?;
101- let index_name_ = IndexName :: new ( table_name. clone ( ) , index_name. descriptor ( ) . clone ( ) ) ?;
102- let mut index_model = IndexModel :: new ( & mut tx) ;
103- let namespace = TableNamespace :: Global ;
104- let pending_metadata = index_model. pending_index_metadata ( namespace, & index_name_) ?;
105- let enabled_metadata = index_model. enabled_index_metadata ( namespace, & index_name_) ?;
106- let metadata = pending_metadata. unwrap_or_else ( || enabled_metadata. unwrap ( ) ) ;
107- let index_config = VectorIndexConfigParser :: get_config ( metadata. config . clone ( ) )
108- . context ( "Not a vector index?" ) ?;
109- let by_id = IndexName :: by_id ( table_name. clone ( ) ) ;
110- let Some ( by_id_metadata) =
111- IndexModel :: new ( & mut tx) . enabled_index_metadata ( namespace, & by_id) ?
112- else {
113- anyhow:: bail!( "Missing by_id index for {index_name:?}" ) ;
114- } ;
115- let writer = SearchIndexMetadataWriter :: new (
116- runtime. clone ( ) ,
117- database. clone ( ) ,
118- storage. clone ( ) ,
119- SearchType :: Vector ,
120- ) ;
121- let worker = Self :: new ( runtime, database, reader, storage, writer) ;
122- let job = IndexBuild {
123- index_name,
124- index_id : metadata. clone ( ) . into_id_and_value ( ) . 0 . internal_id ( ) ,
125- by_id : by_id_metadata. id ( ) . internal_id ( ) ,
126- index_config,
127- metadata_id : metadata. clone ( ) . id ( ) ,
128- build_reason : BuildReason :: TooLarge ,
129- } ;
130- worker
131- . flusher
132- . build_one (
133- job,
134- BuildVectorIndexArgs {
135- full_scan_threshold_bytes : * VECTOR_INDEX_SIZE_SOFT_LIMIT ,
136- } ,
137- )
138- . await ?;
139- Ok ( ( ) )
140- }
141-
14277 /// Backfills all search indexes that are in a "backfilling" state.
14378 #[ cfg( any( test, feature = "testing" ) ) ]
14479 pub async fn backfill_all_in_test (
0 commit comments