Skip to content

Add parallel incremental snapshot for relational connectors #1829

@MrIvv

Description

@MrIvv

Feature Request

Description

Add support for parallel incremental snapshots, with table-level workers running concurrent chunk reads inside a single DBLog watermark window.

Motivation

The current incremental snapshot implementation has two scaling limitations:

  1. Single-threaded: Tables are processed one at a time, leaving CPU and I/O bandwidth underutilized on multi-core hosts.
  2. Idle workers in batch-and-wait scheduling: When tables within a parallel batch have different sizes, faster workers sit idle until the slowest table completes before the next batch can start.

Proposed Changes

  1. Parallel snapshot infrastructure: ParallelIncrementalSnapshotCoordinator (per-table window buffers + JDBC connection pool + worker activation policy), TableSnapshotContext, TableSnapshotWorker. The per-round worker pool lives in AbstractIncrementalSnapshotChangeEventSource using a fixed-size ExecutorService + CompletionService, scoped to the round and shut down at its end.
  2. Work-queue scheduler: Replaces batch-and-wait with a shared ConcurrentLinkedQueue — workers pick the next table immediately upon completing the current one, eliminating cross-table idle time. JDBC connections are held by the worker across all its tables.
  3. Retry policy with exponential backoff: New RetryExecutor in debezium-util. Generic over Callable/Runnable, accepts any retryable predicate, exponential backoff with jitter, configurable cap. Used by the parallel chunk round to recover from transient JDBC failures (lock timeout, deadlock victim, broken connection in the pool) without aborting the snapshot.
  4. PostgreSQL read-only support: Parallel-safe JDBC connections via createSnapshotConnection() override in PostgresReadOnlyIncrementalSnapshotChangeEventSource.

Backward Compatibility

  • Default snapshot.max.threads=1 preserves original single-threaded behavior
  • createSnapshotConnection() throws UnsupportedOperationException by default (graceful degradation for connectors that don't yet support parallel snapshots)
  • Notification format unchanged (same aggregateType="Incremental Snapshot" and per-type schema)
  • No breaking API changes

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    In progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions