mirror of
https://github.com/quickwit-oss/tantivy.git
synced 2026-05-30 15:10:40 +00:00
undo changes to segment_updater.rs
This commit is contained in:
@@ -264,6 +264,7 @@ pub(crate) struct InnerSegmentUpdater {
|
||||
//
|
||||
// This should be up to date as all update happen through
|
||||
// the unique active `SegmentUpdater`.
|
||||
active_index_meta: RwLock<Arc<IndexMeta>>,
|
||||
pool: ThreadPool,
|
||||
merge_thread_pool: ThreadPool,
|
||||
|
||||
@@ -313,6 +314,7 @@ impl SegmentUpdater {
|
||||
})?;
|
||||
let index_meta = index.load_metas()?;
|
||||
Ok(SegmentUpdater(Arc::new(InnerSegmentUpdater {
|
||||
active_index_meta: RwLock::new(Arc::new(index_meta)),
|
||||
pool,
|
||||
merge_thread_pool,
|
||||
index,
|
||||
@@ -418,6 +420,7 @@ impl SegmentUpdater {
|
||||
};
|
||||
// TODO add context to the error.
|
||||
save_metas(&index_meta, directory.box_clone().borrow_mut())?;
|
||||
self.store_meta(&index_meta);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@@ -458,8 +461,12 @@ impl SegmentUpdater {
|
||||
})
|
||||
}
|
||||
|
||||
fn store_meta(&self, index_meta: &IndexMeta) {
|
||||
*self.active_index_meta.write().unwrap() = Arc::new(index_meta.clone());
|
||||
}
|
||||
|
||||
fn load_meta(&self) -> Arc<IndexMeta> {
|
||||
Arc::new(self.index.load_metas().expect("Failed to load meta"))
|
||||
self.active_index_meta.read().unwrap().clone()
|
||||
}
|
||||
|
||||
pub(crate) fn make_merge_operation(&self, segment_ids: &[SegmentId]) -> MergeOperation {
|
||||
|
||||
Reference in New Issue
Block a user