Skip to content
Merged
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 asap-query-engine/src/bin/bench_precompute_sketch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ async fn start_engine(
pass_raw_samples: false,
raw_mode_aggregation_id: 0,
late_data_policy: LateDataPolicy::Drop,
wall_clock_grace_period_ms: 5_000,
};
let sources: Vec<Box<dyn IngestSource>> =
vec![Box::new(HttpIngestSource::new(HttpIngestConfig { port }))];
Expand Down
1 change: 1 addition & 0 deletions asap-query-engine/src/bin/e2e_quickstart_resource_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
pass_raw_samples: false,
raw_mode_aggregation_id: 0,
late_data_policy: LateDataPolicy::Drop,
wall_clock_grace_period_ms: 5_000,
};
let output_sink = Arc::new(StoreOutputSink::new(store.clone()));
let sources: Vec<Box<dyn IngestSource>> =
Expand Down
6 changes: 6 additions & 0 deletions asap-query-engine/src/bin/precompute_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ struct Args {
#[arg(long, value_enum, default_value_t = LateDataPolicy::Drop)]
late_data_policy: LateDataPolicy,

/// Wall-clock grace period (ms) for the flush fallback that force-closes
/// idle windows when event-time stagnates. Set to <= 0 to disable.
#[arg(long, default_value_t = 5000)]
wall_clock_grace_period_ms: i64,

// --- CSV file ingest (alternative to HTTP) ---
/// Path to a local CSV file to ingest instead of listening for HTTP writes
#[arg(long)]
Expand Down Expand Up @@ -170,6 +175,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
pass_raw_samples: args.pass_raw_samples,
raw_mode_aggregation_id: args.raw_mode_aggregation_id,
late_data_policy: args.late_data_policy,
wall_clock_grace_period_ms: args.wall_clock_grace_period_ms,
};

// Create the output sink (writes directly to the store)
Expand Down
3 changes: 3 additions & 0 deletions asap-query-engine/src/bin/test_e2e_precompute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
pass_raw_samples: false,
raw_mode_aggregation_id: 0,
late_data_policy: LateDataPolicy::Drop,
wall_clock_grace_period_ms: 5000,
};
let output_sink = Arc::new(StoreOutputSink::new(store.clone()));
let sources: Vec<Box<dyn IngestSource>> =
Expand Down Expand Up @@ -299,6 +300,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
pass_raw_samples: true,
raw_mode_aggregation_id: raw_agg_id,
late_data_policy: LateDataPolicy::Drop,
wall_clock_grace_period_ms: 5000,
};
let raw_sink = Arc::new(RawPassthroughSink::new(store.clone()));
let raw_sources: Vec<Box<dyn IngestSource>> =
Expand Down Expand Up @@ -655,6 +657,7 @@ async fn run_single_bench(
pass_raw_samples: false,
raw_mode_aggregation_id: 0,
late_data_policy: LateDataPolicy::Drop,
wall_clock_grace_period_ms: 5000,
};
let sources: Vec<Box<dyn IngestSource>> =
vec![Box::new(HttpIngestSource::new(HttpIngestConfig { port }))];
Expand Down
7 changes: 7 additions & 0 deletions asap-query-engine/src/engine_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,12 @@ pub struct PrecomputeSettings {
pub flush_interval_ms: u64,
pub channel_buffer_size: usize,
pub dump_precomputes: bool,
/// Wall-clock grace period (ms) for the flush fallback that force-closes
/// idle windows when event-time stagnates (e.g. one-shot batch ingest
/// where every record shares a timestamp). Set to <= 0 to disable and
/// keep strict event-time-only semantics. See
/// `PrecomputeEngineConfig::wall_clock_grace_period_ms`.
pub wall_clock_grace_period_ms: i64,
}

impl Default for PrecomputeSettings {
Expand All @@ -321,6 +327,7 @@ impl Default for PrecomputeSettings {
flush_interval_ms: 1000,
channel_buffer_size: 10000,
dump_precomputes: false,
wall_clock_grace_period_ms: 5000,
}
}
}
Expand Down
1 change: 1 addition & 0 deletions asap-query-engine/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ async fn main() -> Result<()> {
pass_raw_samples: false,
raw_mode_aggregation_id: 0,
late_data_policy: LateDataPolicy::Drop,
wall_clock_grace_period_ms: config.precompute_engine.wall_clock_grace_period_ms,
};
let output_sink = Arc::new(StoreOutputSink::new(store.clone()));
let sources: Vec<Box<dyn IngestSource>> = match &config.ingest {
Expand Down
19 changes: 19 additions & 0 deletions asap-query-engine/src/precompute_engine/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,19 @@ pub struct PrecomputeEngineConfig {
pub raw_mode_aggregation_id: u64,
/// Policy for handling late samples that arrive after their window has closed.
pub late_data_policy: LateDataPolicy,
/// Wall-clock grace period (milliseconds) for the watermark fallback in
/// `flush_all`. When event-time stagnates (e.g. a one-shot batch where
/// every record carries the same timestamp), `flush_all`'s `+1ms`
/// watermark advance is a no-op and idle windows never close. The
/// wall-clock fallback closes a pane whose creation has been older
/// than `window_size_ms + wall_clock_grace_period_ms` of *wall-clock*
/// time, regardless of where event-time is. The grace period tolerates
/// late-arriving events that would otherwise be evicted as "the window
/// already closed". Set to `<= 0` to opt out and keep strict
/// event-time-only semantics. Default: 5000 ms (matches
/// `allowed_lateness_ms` default).
#[serde(default = "default_wall_clock_grace_period_ms")]
pub wall_clock_grace_period_ms: i64,
}

impl Default for PrecomputeEngineConfig {
Expand All @@ -43,10 +56,15 @@ impl Default for PrecomputeEngineConfig {
pass_raw_samples: false,
raw_mode_aggregation_id: 0,
late_data_policy: LateDataPolicy::Drop,
wall_clock_grace_period_ms: default_wall_clock_grace_period_ms(),
}
}
}

fn default_wall_clock_grace_period_ms() -> i64 {
5_000
}

#[cfg(test)]
mod tests {
use super::*;
Expand All @@ -62,5 +80,6 @@ mod tests {
assert!(!config.pass_raw_samples);
assert_eq!(config.raw_mode_aggregation_id, 0);
assert_eq!(config.late_data_policy, LateDataPolicy::Drop);
assert_eq!(config.wall_clock_grace_period_ms, 5_000);
}
}
1 change: 1 addition & 0 deletions asap-query-engine/src/precompute_engine/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ impl PrecomputeEngine {
pass_raw_samples: self.config.pass_raw_samples,
raw_mode_aggregation_id: self.config.raw_mode_aggregation_id,
late_data_policy: self.config.late_data_policy,
wall_clock_grace_period_ms: self.config.wall_clock_grace_period_ms,
},
self.diagnostics.worker_group_counts[id].clone(),
self.diagnostics.worker_watermarks[id].clone(),
Expand Down
Loading
Loading