mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-03 03:47:02 +02:00
Compute the size of the auth-controller, index-scheduler and all update files in the global stats
This commit is contained in:
parent
b3c2a4ae27
commit
c92948b143
8 changed files with 67 additions and 22 deletions
|
@ -1,3 +1,4 @@
|
|||
use std::collections::BTreeSet;
|
||||
use std::fmt::Write;
|
||||
|
||||
use meilisearch_types::heed::types::{OwnedType, SerdeBincode, SerdeJson, Str};
|
||||
|
@ -92,7 +93,9 @@ pub fn snapshot_index_scheduler(scheduler: &IndexScheduler) -> String {
|
|||
|
||||
pub fn snapshot_file_store(file_store: &file_store::FileStore) -> String {
|
||||
let mut snap = String::new();
|
||||
for uuid in file_store.__all_uuids() {
|
||||
// we store the uuid in a `BTreeSet` to keep them ordered.
|
||||
let all_uuids = file_store.all_uuids().unwrap().collect::<Result<BTreeSet<_>, _>>().unwrap();
|
||||
for uuid in all_uuids {
|
||||
snap.push_str(&format!("{uuid}\n"));
|
||||
}
|
||||
snap
|
||||
|
|
|
@ -452,6 +452,10 @@ impl IndexScheduler {
|
|||
&self.index_mapper.indexer_config
|
||||
}
|
||||
|
||||
pub fn size(&self) -> Result<u64> {
|
||||
Ok(self.env.real_disk_size()?)
|
||||
}
|
||||
|
||||
/// Return the index corresponding to the name.
|
||||
///
|
||||
/// * If the index wasn't opened before, the index will be opened.
|
||||
|
@ -898,6 +902,11 @@ impl IndexScheduler {
|
|||
Ok(self.file_store.new_update_with_uuid(uuid)?)
|
||||
}
|
||||
|
||||
/// List the update files contained in the IndexScheduler.
|
||||
pub fn update_file_size(&self) -> Result<u64> {
|
||||
Ok(self.file_store.update_total_size()?)
|
||||
}
|
||||
|
||||
/// Delete a file from the index scheduler.
|
||||
///
|
||||
/// Counterpart to the [`create_update_file`](IndexScheduler::create_update_file) method.
|
||||
|
|
|
@ -508,14 +508,23 @@ impl IndexScheduler {
|
|||
if let KindWithContent::DocumentAdditionOrUpdate { content_file, .. } = kind {
|
||||
match status {
|
||||
Status::Enqueued | Status::Processing => {
|
||||
assert!(
|
||||
self.file_store.__all_uuids().contains(&content_file),
|
||||
"Could not find uuid `{content_file}` in the file_store. Available uuids are {:?}.",
|
||||
self.file_store.__all_uuids(),
|
||||
assert!(self
|
||||
.file_store
|
||||
.all_uuids()
|
||||
.unwrap()
|
||||
.find(|uuid| uuid.as_ref().unwrap() == &content_file)
|
||||
.is_some(),
|
||||
"Could not find uuid `{content_file}` in the file_store. Available uuids are {:?}.",
|
||||
self.file_store.all_uuids().unwrap().collect::<Result<Vec<_>>>(),
|
||||
);
|
||||
}
|
||||
Status::Succeeded | Status::Failed | Status::Canceled => {
|
||||
assert!(!self.file_store.__all_uuids().contains(&content_file));
|
||||
assert!(self
|
||||
.file_store
|
||||
.all_uuids()
|
||||
.unwrap()
|
||||
.find(|uuid| uuid.as_ref().unwrap() == &content_file)
|
||||
.is_none());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue