Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/matrix-sdk-search/changelog.d/6731.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`bulk_execute` now waits for the index writers merge threads before dropping it, avoiding spurious `couldn't find segment in SegmentManager` warnings and index fragmentation

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`bulk_execute` now waits for the index writers merge threads before dropping it, avoiding spurious `couldn't find segment in SegmentManager` warnings and index fragmentation
`RoomIndex::bulk_execute` now waits for the index writers merge threads before dropping it, avoiding spurious couldn't find segment in SegmentManager` warnings and index fragmentation

1 change: 1 addition & 0 deletions crates/matrix-sdk-search/src/index/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ impl RoomIndex {
}

self.commit_and_reload(&mut writer)?;
writer.wait_merging_threads()?;

Ok(())
}
Expand Down
4 changes: 4 additions & 0 deletions crates/matrix-sdk-search/src/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,8 @@ impl SearchIndexWriter {
self.last_commit_opstamp = self.inner.commit()?; // TODO: This is blocking. Handle it.
Ok(self.last_commit_opstamp)
}

pub(crate) fn wait_merging_threads(self) -> Result<(), TantivyError> {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method and all the other on this type can be pub. Since the type is pub(crate) first, it cannot outreach it.

Also, we probably don't need pub(crate) for the type. Just use pub and do not re-export it in lib.rs is fine.

Can you change that please?

self.inner.wait_merging_threads()
}
}
Loading