mirror of
https://github.com/quickwit-oss/tantivy.git
synced 2026-01-06 09:12:55 +00:00
issue/96 avoid removing the bitset from segment_entry.
This commit is contained in:
@@ -43,6 +43,10 @@ impl Segment {
|
||||
self.index.schema()
|
||||
}
|
||||
|
||||
pub fn index(&self,) -> &Index {
|
||||
&self.index
|
||||
}
|
||||
|
||||
/// Returns the segment meta-information
|
||||
pub fn meta(&self) -> &SegmentMeta {
|
||||
&self.meta
|
||||
|
||||
@@ -220,9 +220,9 @@ pub fn advance_deletes(
|
||||
let max_doc = segment_reader.max_doc();
|
||||
|
||||
let mut delete_bitset: BitSet =
|
||||
match segment_entry.reset_delete_bitset() {
|
||||
Some(previous_delete_bitset) =>
|
||||
previous_delete_bitset,
|
||||
match segment_entry.delete_bitset() {
|
||||
Some(ref previous_delete_bitset) =>
|
||||
(*previous_delete_bitset).clone(),
|
||||
None =>
|
||||
BitSet::with_capacity(max_doc as usize)
|
||||
};
|
||||
|
||||
@@ -34,7 +34,11 @@ struct DeltaPositionComputer {
|
||||
|
||||
impl DeltaPositionComputer {
|
||||
fn new() -> DeltaPositionComputer {
|
||||
DeltaPositionComputer { buffer: iter::repeat(0u32).take(512).collect::<Vec<u32>>() }
|
||||
DeltaPositionComputer {
|
||||
buffer: iter::repeat(0u32)
|
||||
.take(512)
|
||||
.collect::<Vec<u32>>()
|
||||
}
|
||||
}
|
||||
|
||||
fn compute_delta_positions(&mut self, positions: &[u32]) -> &[u32] {
|
||||
@@ -227,7 +231,7 @@ impl IndexMerger {
|
||||
// We can remove the term if all documents which
|
||||
// contained it have been deleted.
|
||||
if segment_postings.len() > 0 {
|
||||
|
||||
|
||||
// We can now serialize this postings, by pushing each document to the
|
||||
// postings serializer.
|
||||
|
||||
|
||||
@@ -42,8 +42,8 @@ impl SegmentEntry {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn reset_delete_bitset(&mut self,) -> Option<BitSet> {
|
||||
self.delete_bitset.take()
|
||||
pub fn delete_bitset(&self,) -> Option<&BitSet> {
|
||||
self.delete_bitset.as_ref()
|
||||
}
|
||||
|
||||
pub fn set_meta(&mut self, segment_meta: SegmentMeta) {
|
||||
|
||||
@@ -71,13 +71,7 @@ impl SegmentManager {
|
||||
let mut files = HashSet::new();
|
||||
files.insert(META_FILEPATH.clone());
|
||||
files.insert(LOCKFILE_FILEPATH.clone());
|
||||
|
||||
// TODO do new segment
|
||||
// really have at no point a delete file?
|
||||
// that might get garbage collected?
|
||||
//
|
||||
// Consider have new segment matched as a prefix.
|
||||
|
||||
|
||||
let segment_metas: Vec<SegmentMeta> =
|
||||
registers_lock.committed
|
||||
.get_all_segments()
|
||||
|
||||
@@ -119,6 +119,14 @@ fn perform_merge(segment_ids: &[SegmentId],
|
||||
}
|
||||
}
|
||||
|
||||
// TODO REMOVEEEEE THIIIIIS
|
||||
{
|
||||
let living_files = segment_updater.0.segment_manager.list_files();
|
||||
let mut index = merged_segment.index().clone();
|
||||
index.directory_mut().garbage_collect(living_files);
|
||||
}
|
||||
|
||||
|
||||
let delete_cursor = segment_entries[0].delete_cursor().clone();
|
||||
|
||||
let segments: Vec<Segment> = segment_entries
|
||||
@@ -265,9 +273,6 @@ impl SegmentUpdater {
|
||||
let living_files = segment_updater.0.segment_manager.list_files();
|
||||
index.directory_mut().garbage_collect(living_files);
|
||||
segment_updater.consider_merge_options();
|
||||
|
||||
// See #112
|
||||
// index.directory_mut().garbage_collect(living_files);
|
||||
}
|
||||
}).wait()
|
||||
}
|
||||
@@ -283,8 +288,6 @@ impl SegmentUpdater {
|
||||
let merging_thread_id = self.get_merging_thread_id();
|
||||
let (merging_future_send, merging_future_recv) = oneshot();
|
||||
|
||||
// let delete_operations = self.0.delete_queue.snapshot();
|
||||
|
||||
if segment_ids.is_empty() {
|
||||
return merging_future_recv;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user