Skip to main content

Module sink

Module sink 

Source
Expand description

PostgreSQL sink connector implementation.

PostgresSink implements SinkConnector, writing Arrow RecordBatch data to PostgreSQL tables via two strategies:

  • Append mode: COPY BINARY for maximum throughput (>500K rows/sec)
  • Upsert mode: INSERT ... ON CONFLICT DO UPDATE with UNNEST arrays

Exactly-once semantics use co-transactional offset storage: data and epoch markers are committed in the same PostgreSQL transaction.

§Ring Architecture

  • Ring 0: No sink code. Data arrives via SPSC channel (~5ns push).
  • Ring 1: Batch buffering, COPY/INSERT writes, transaction management.
  • Ring 2: Connection pool, table creation, epoch recovery.

Structs§

PostgresSink
PostgreSQL sink connector.