Skip to main content

assert_write_modes_truthful

Function assert_write_modes_truthful 

Source
pub async fn assert_write_modes_truthful<S, F, Fut>(sink: &S, distinct_count: F)
where S: Sink + ?Sized, F: Fn() -> Fut, Fut: Future<Output = usize>,
Expand description

Check 7. Assert a sink advertising Upsert/Delete in supported_write_modes genuinely upholds those modes:

  • Upsert — re-writing a record with an existing key converges to one row (last-write-wins), it does not append a duplicate.
  • Delete — a record carrying the standard delete marker (DELETE_MARKER_FIELD = DELETE_MARKER_VALUE, matching the cdc_unwrap convention) removes its keyed row. Only run when the sink advertises Delete; the sink under test must be configured with a matching delete_marker.
  • Missing/null keyplan_writes, the shared planner every upsert sink routes through, reports such rows as failed (destined for a DLQ) rather than writing them.

Records are keyed on "id", so the sink under test must be configured write_mode: upsert with key: ["id"]. A sink advertising only Append has nothing to prove and the body is skipped. distinct_count reports the destination’s current distinct-row count.