Skip to content

Commit

Permalink
Removing RefreshPlan loop.
Browse files Browse the repository at this point in the history
The RefreshPlan loop is not necessary since after we moved to
the control plane as a metastore proxy world, the control
plan cannot miss any Index/Source event.
  • Loading branch information
fulmicoton committed Oct 5, 2023
1 parent 9b8ce21 commit d17bfae
Showing 1 changed file with 9 additions and 36 deletions.
45 changes: 9 additions & 36 deletions quickwit/quickwit-control-plane/src/control_plane.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,6 @@ pub(crate) const CONTROL_PLAN_LOOP_INTERVAL: Duration = if cfg!(any(test, featur
Duration::from_secs(3)
};

/// Interval between two scheduling of indexing plans. No need to be faster than the
/// control plan loop.
// Note: it's currently not possible to define a const duration with
// `CONTROL_PLAN_LOOP_INTERVAL * number`.
pub(crate) const REFRESH_PLAN_LOOP_INTERVAL: Duration = if cfg!(any(test, feature = "testsuite")) {
Duration::from_secs(3)
} else {
Duration::from_secs(60)
};

#[derive(Debug)]
struct RefreshPlanLoop;

#[derive(Debug)]
struct ControlPlanLoop;

Expand Down Expand Up @@ -134,7 +121,15 @@ impl Actor for ControlPlane {
.await
.context("failed to initialize ingest controller")?;

self.handle(RefreshPlanLoop, ctx).await?;
if let Err(error) = self
.indexing_scheduler
.schedule_indexing_plan_if_needed()
.await
{
// TODO inspect error.
error!("Error when scheduling indexing plan: `{}`.", error);
}

ctx.schedule_self_msg(CONTROL_PLAN_LOOP_INTERVAL, ControlPlanLoop)
.await;

Expand Down Expand Up @@ -218,28 +213,6 @@ impl Handler<DeleteIndexRequest> for ControlPlane {
}
}

#[async_trait]
impl Handler<RefreshPlanLoop> for ControlPlane {
type Reply = ();

async fn handle(
&mut self,
_message: RefreshPlanLoop,
ctx: &ActorContext<Self>,
) -> Result<(), ActorExitStatus> {
if let Err(error) = self
.indexing_scheduler
.schedule_indexing_plan_if_needed()
.await
{
error!("Error when scheduling indexing plan: `{}`.", error);
}
ctx.schedule_self_msg(REFRESH_PLAN_LOOP_INTERVAL, RefreshPlanLoop)
.await;
Ok(())
}
}

#[async_trait]
impl Handler<AddSourceRequest> for ControlPlane {
type Reply = ControlPlaneResult<EmptyResponse>;
Expand Down

0 comments on commit d17bfae

Please sign in to comment.