@@ -15,7 +15,7 @@ use chroma_sysdb::SysDb;
1515use chroma_system:: Handler ;
1616use chroma_system:: { Component , ComponentContext } ;
1717use chroma_types:: {
18- Chunk , CollectionUuid , GetCollectionWithSegmentsError , KnnIndex , LogRecord , SchemaError ,
18+ Chunk , CollectionUuid , GetCollectionWithSegmentsError , KnnIndex , LogRecord , Schema , SchemaError ,
1919} ;
2020use serde:: { Deserialize , Serialize } ;
2121use thiserror:: Error ;
@@ -141,9 +141,15 @@ impl Handler<BackfillMessage> for LocalCompactionManager {
141141 . get_collection_with_segments ( message. collection_id )
142142 . await ?;
143143 let schema_previously_persisted = collection_and_segments. collection . schema . is_some ( ) ;
144- collection_and_segments
145- . collection
146- . reconcile_schema_with_config ( KnnIndex :: Hnsw ) ?;
144+ if !schema_previously_persisted {
145+ collection_and_segments. collection . schema = Some (
146+ Schema :: convert_collection_config_to_schema (
147+ & collection_and_segments. collection . config ,
148+ KnnIndex :: Hnsw ,
149+ )
150+ . map_err ( CompactionManagerError :: SchemaReconcileError ) ?,
151+ ) ;
152+ }
147153 // If collection is uninitialized, that means nothing has been written yet.
148154 let dim = match collection_and_segments. collection . dimension {
149155 Some ( dim) => dim,
@@ -267,7 +273,12 @@ impl Handler<PurgeLogsMessage> for LocalCompactionManager {
267273 . get_collection_with_segments ( message. collection_id )
268274 . await ?;
269275 let mut collection = collection_segments. collection . clone ( ) ;
270- collection. reconcile_schema_with_config ( KnnIndex :: Hnsw ) ?;
276+ if collection. schema . is_none ( ) {
277+ collection. schema = Some (
278+ Schema :: convert_collection_config_to_schema ( & collection. config , KnnIndex :: Hnsw )
279+ . map_err ( CompactionManagerError :: SchemaReconcileError ) ?,
280+ ) ;
281+ }
271282 // If dimension is None, that means nothing has been written yet.
272283 let dim = match collection. dimension {
273284 Some ( dim) => dim,
0 commit comments