Schedule icon
Webhook icon
Assert icon
Query icon
Script icon
Set icon
If icon
SlackIncomingWebhook icon
Pause icon
Log icon

Apache Doris Routine Load Ingestion Stall and Auto-Resume Gate

Audit Apache Doris Kafka Routine Load streaming jobs, safely alter error limits with approval gates, resume ingestion, and verify recovery in Kestra.

Categories
DataInfrastructure

Production analytical platforms powered by Apache Doris rely heavily on Kafka Routine Load jobs for real-time data ingestion. A Routine Load continuously streams events from Apache Kafka topics directly into Doris tables using Frontend (FE) coordinator scheduling and Backend (BE) execution tasks.

However, when upstream microservices publish malformed payloads, unparseable JSON rows, or schema incompatibilities, Doris increments its internal error_rows counter. If error_rows exceeds the configured max_error_number threshold, Doris automatically pauses the Routine Load job.

When a Routine Load enters the PAUSED state, ingestion halts completely. Kafka consumer partition lag accumulates exponentially, dashboards serve stale analytics, and real-time reporting SLAs are breached. Furthermore, blindly resuming the job without adjusting error thresholds causes Doris to immediately re-pause on the next batch of error rows.

This blueprint provides an automated Apache Doris Routine Load guard. It queries the Doris Frontend via MySQL JDBC to inspect Routine Load job states and Kafka partition offsets, tracks progress against historical snapshots in Kestra KV, detects poison pill stalls, alerts the data platform team, halts for operator approval, dynamically adjusts max_error_number tolerances, executes RESUME ROUTINE LOAD, and verifies that the job transitions back to RUNNING.

How it works

  1. Pre-flight Assertion: The workflow asserts that JDBC connection URLs, database names, job identifiers, and error thresholds satisfy operational sanity limits.
  2. Job Telemetry Query: io.kestra.plugin.jdbc.mysql.Query queries SHOW ROUTINE LOAD FOR db.job_name via MySQL wire protocol to fetch State, Statistic, Progress, and ReasonOfStateChanged.
  3. Differential Progress Classification: An isolated Python script compares current partition offsets and error counts against historical snapshots in Kestra KV (doris_routine_load_tracker_{job_name}). It detects if offsets are frozen and parses error log diagnostics.
  4. State Tracking: io.kestra.plugin.core.kv.Set persists current job state, partition offsets, and error statistics in Kestra KV for longitudinal stall detection.
  5. Team Escalation: io.kestra.plugin.slack.notifications.SlackIncomingWebhook delivers a structured alert summarizing job state, error row deltas, pause reason, and rejected row URLs.
  6. Safe Remediation with Approval Gate: When dry_run is disabled:
    • Workflow execution pauses (io.kestra.plugin.core.flow.Pause) for data engineer sign-off.
    • io.kestra.plugin.jdbc.mysql.Query executes ALTER ROUTINE LOAD to increase error tolerance (max_error_number) in one task, then RESUME ROUTINE LOAD in a second task (MySQL JDBC connections don't support multiple semicolon-separated statements in a single query).
  7. Post-Remediation Verification: The workflow re-queries SHOW ROUTINE LOAD and executes io.kestra.plugin.core.execution.Assert to verify that State == 'RUNNING'.

What you get

  • Automated detection of stalled or paused Apache Doris Kafka Routine Load streaming jobs.
  • Elimination of silent Kafka partition lag accumulation caused by poison pill records.
  • Safe adjustment of error row tolerances (max_error_number) to bypass rejected records.
  • Operator approval gates and dry-run preview to prevent unintended job configuration updates.
  • Longitudinal partition offset tracking stored across runs in Kestra KV.
  • Post-remediation assertions confirming that Routine Load ingestion is active.

Who it's for

  • Data Platform Engineers and Analytics Engineers operating Apache Doris data warehouses.
  • Streaming Infrastructure Engineers managing real-time Kafka-to-Doris ingestion pipelines.
  • Site Reliability Engineers (SREs) monitoring analytical freshness and database health.

Why orchestrate this with Kestra

Apache Doris provides SQL commands to inspect and alter Routine Load jobs, but lacks native mechanisms to diff partition offsets across runs, store historical error progression, enforce human approval gates, or dispatch multi-channel alerts. Writing unmanaged cron scripts creates unmonitored failure points without execution audit trails, retry policies, or credential masking.

Orchestrating this recovery gate with Kestra provides a declarative workflow with integrated KV state tracking, native MySQL JDBC execution, pause-and-resume approval gates, structured Slack notifications, and post-action verification.

Prerequisites

  • An accessible Apache Doris cluster (version 1.2 or higher) with Frontend (FE) query port accessible (port 9030).
  • Database user credentials with privileges to execute SHOW and ALTER ROUTINE LOAD.
  • A Slack Incoming Webhook URL to receive triage alerts.

Secrets

  • SLACK_WEBHOOK_URL: Slack Incoming Webhook endpoint URL used for analytics operations alerts.
  • DORIS_PASSWORD: Database user password for Apache Doris Frontend authentication.
  • DORIS_ROUTINE_LOAD_WEBHOOK_KEY: Secret authentication key protecting the on-demand webhook trigger.

Quick start

  1. Configure SLACK_WEBHOOK_URL, DORIS_PASSWORD, and DORIS_ROUTINE_LOAD_WEBHOOK_KEY in your Kestra namespace secrets.
  2. Import this blueprint and configure jdbc_url, database_name, and job_name to match your Doris environment.
  3. Run a manual execution with dry_run: true to record an initial baseline and review identified offsets.
  4. When ready to alter properties and resume stalled jobs, run with dry_run: false and approve the paused execution.
  5. Enable the periodic_routine_load_audit schedule trigger to monitor Routine Load health automatically every 10 minutes.

How to extend

  • Error Log Harvester: Add an io.kestra.plugin.core.http.Request task to download the rejected row snippet from ErrorLogUrl and archive it to Amazon S3 or Google Cloud Storage.
  • Kafka Lag Cross-Check: Add an io.kestra.plugin.kafka.ConsumerGroupDescribe task to cross-reference Doris Routine Load committed offsets with Kafka broker high-watermark offsets.
  • PagerDuty Emergency Escalation: Add io.kestra.plugin.pagerduty.notifications.PagerDutyAlert if the Routine Load job enters CANCELLED or fails repeatedly.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.