(report: &PreparedUpdateReport)
| 2697 | } |
| 2698 | |
| 2699 | fn validate_prepared_update_gate(report: &PreparedUpdateReport) -> Result<()> { |
| 2700 | let scale = report.rows as f64 / 25_000_f64; |
| 2701 | for run in &report.runs { |
| 2702 | let Some(base_limit_micros) = prepared_update_limit_micros(run.mode) else { |
| 2703 | continue; |
| 2704 | }; |
| 2705 | let limit = (base_limit_micros as f64 * scale).ceil() as u128; |
| 2706 | for test in &run.tests { |
| 2707 | ensure!( |
| 2708 | test.elapsed_micros <= limit, |
| 2709 | "prepared-update gate failed for {} {}: {:.3}ms > {:.3}ms", |
| 2710 | run.mode, |
| 2711 | test.id, |
| 2712 | test.elapsed_micros as f64 / 1_000.0, |
| 2713 | limit as f64 / 1_000.0 |
| 2714 | ); |
| 2715 | } |
| 2716 | if let Some(stats) = run.protocol_stats.as_ref() { |
| 2717 | ensure!( |
| 2718 | stats.streaming_copy_handoffs == 0, |
| 2719 | "prepared-update gate failed for {}: non-COPY traffic used streaming handoff", |
| 2720 | run.mode |
| 2721 | ); |
| 2722 | } |
| 2723 | if run.mode.contains("pipelined") { |
| 2724 | let stats = run |
| 2725 | .protocol_stats |
| 2726 | .as_ref() |
| 2727 | .context("missing protocol stats for pipelined prepared-update run")?; |
| 2728 | ensure!( |
| 2729 | stats.protocol_batches < 1_000, |
| 2730 | "prepared-update gate failed for {}: pipelined traffic was not batched ({} protocol batches)", |
| 2731 | run.mode, |
| 2732 | stats.protocol_batches |
| 2733 | ); |
| 2734 | } |
| 2735 | } |
| 2736 | Ok(()) |
| 2737 | } |
| 2738 | |
| 2739 | fn prepared_update_limit_micros(mode: &str) -> Option<u128> { |
| 2740 | if mode.starts_with("native_") { |
no test coverage detected