Compare commits

..

11 Commits

Author SHA1 Message Date
Clément Renault
349f123642 WIP 2025-10-07 16:04:01 +02:00
Clément Renault
f9b77b35f0 Improve the pre-compaction size information 2025-10-07 15:25:10 +02:00
Clément Renault
d9e77e1950 Make the tests to pass 2025-10-07 15:25:10 +02:00
Clément Renault
657fbec367 Make Clippy happy 2025-10-07 14:37:38 +02:00
Clément Renault
c1ecaba168 Introduce a function to effectively close an index 2025-10-07 14:33:54 +02:00
Clément Renault
9530e72d04 Expose the env closing event so we can wait for the index to close 2025-10-07 14:33:54 +02:00
Kerollmops
8fb8f389ae Implement the index compaction task 2025-10-07 14:33:54 +02:00
Kerollmops
fbe6e0b2df Rename operation to IndexCompaction 2025-10-06 16:19:04 +02:00
Clément Renault
4a84f1cd1a Add the necessary batches and tasks in the process 2025-10-02 17:17:32 +02:00
Clément Renault
511cb0ff82 Add a new CompactIndex action 2025-10-02 17:14:50 +02:00
Clément Renault
55d6a81a75 Introduce a new /indexes/{indexUid}/compact route 2025-10-02 17:12:10 +02:00

View File

@@ -5,11 +5,12 @@ use meilisearch_types::error::ResponseError;
use meilisearch_types::index_uid::IndexUid;
use meilisearch_types::keys::actions;
use meilisearch_types::tasks::KindWithContent;
use serde::Serialize;
use tracing::debug;
use utoipa::OpenApi;
use super::ActionPolicy;
use crate::analytics::Analytics;
use crate::analytics::{Aggregate, Analytics};
use crate::extractors::authentication::GuardedData;
use crate::extractors::sequential_extractor::SeqHandler;
use crate::routes::SummarizedTaskView;
@@ -66,7 +67,7 @@ pub async fn compact(
) -> Result<HttpResponse, ResponseError> {
let index_uid = IndexUid::try_from(index_uid.into_inner())?;
analytics.publish(IndexCompacted::default(), &req);
analytics.publish(IndexesCompactAggregator, &req);
let task = KindWithContent::IndexCompaction { index_uid: index_uid.to_string() };
let task =
@@ -81,4 +82,19 @@ pub async fn compact(
Ok(HttpResponse::Accepted().json(SummarizedTaskView::from(task)))
}
crate::empty_analytics!(IndexCompacted, "Index Compacted");
#[derive(Serialize)]
pub struct IndexesCompactAggregator;
impl Aggregate for IndexesCompactAggregator {
fn event_name(&self) -> &'static str {
"Indexes Compacted"
}
fn aggregate(self: Box<Self>, _new: Box<Self>) -> Box<Self> {
Box::new(Self)
}
fn into_event(self: Box<Self>) -> serde_json::Value {
serde_json::to_value(*self).unwrap_or_default()
}
}