Skip to content

Row processing logic duplicated three times #3173

@atharvalade

Description

@atharvalade

The core row-processing loop (iterate columns, extract values, build JSON payload, construct ProducedMessage) is duplicated in three places within postgres_source/src/lib.rs (2,394 lines):

  1. process_rows (sequential polling path)
  2. Inline closure inside poll_tables_parallel (non-chunked parallel path)
  3. poll_table_chunked (chunked parallel path)

Every new feature (like flat_json_output) must be wired into all three. Every bug fix must be applied three times. During the benchmark, adding flat JSON output required editing three separate blocks of nearly identical code.

Fix: Extract the row-to-message conversion into a single shared function that all three paths call. The function signature would be roughly:

fn rows_to_messages(rows, table_name, config_flags, ...) -> Result<Vec<ProducedMessage>, Error>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions