Skip to content

dump_data_to_clickhouse: machine-readable report and retry of failed batches #273

Open

Description

@bmtcril

dump_data_to_clickhouse: machine-readable report and retry of failed batches

Part of openedx/tutor-contrib-aspects#1373

Why

dump_data_to_clickhouse is the backstop for event sink data (enrollments, users, courses), and some operators run it hourly or daily. At scale it needs to report results in a form automation can act on, and to survive the occasional failed insert into ClickHouse.

Current behaviour

  • Progress is logged as Last ID: <pk> after each batch. Resuming means reading the log by hand and passing --start_pk.
  • If a batch's HTTP insert fails, the exception propagates (base_sink.py) and the whole command stops. Nothing retries that batch.
  • Skipped objects are logged one by one (Skipping object <pk>, reason: ...), with no totals.
  • The final output is only Dumped N objects to ClickHouse.

Proposal

  • Retry a failed batch N times with backoff (--max_retries, --retry_backoff_secs) before giving up
  • --report_json PATH: per sink: objects considered, skipped (by reason), submitted, failed, first and last pk, batches, duration, exit status
  • --checkpoint PATH: write the last committed pk per sink after each batch, and accept it as the resume point
  • Exit non-zero if any batch fails after retries, with the failing pk range in the report

Acceptance criteria

  • Injecting a ClickHouse 5xx on one batch: the command retries and succeeds, and the report shows the retry
  • Killing the command and resuming from the checkpoint inserts every object exactly once (after ReplacingMergeTree dedup)
  • The report's counts add up: considered = skipped + submitted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions