macro_rules! guard_write_critical_section {
    ($coord:expr, $tx:expr, $session:expr, $plan_to_defer: expr) => { ... };
Expand description

Enforces critical section invariants for functions that perform writes to tables, e.g. INSERT, UPDATE.

If the provided session doesn’t currently hold the write lock, attempts to grant it. If the coord cannot immediately grant the write lock, defers executing the provided plan until the write lock is available, and exits the function.


  • $coord: &mut Coord
  • $tx: ClientTransmitter<ExecuteResponse>
  • mut $session: Session
  • $plan_to_defer: Plan

Note that making this a macro rather than a function lets us avoid taking ownership of e.g. session and lets us unilaterally enforce the return when deferring work.