<@U0A71G31CDV> when using starRocks load routine i...
# questions-and-troubleshooting
e
@Rocky when using starRocks load routine in order to ingest messages from Kafka, is it possible to some how have the failed messages go to a DLQ or some table ?
r
StarRocks does not have a native "Dead Letter Queue" (DLQ) feature that automatically redirects failed messages to another Kafka topic or a specific "rejected table" in real-time. However, you can manage and inspect failed messages using the following mechanisms: 1. Accessing Error Logs StarRocks automatically captures records that fail due to data quality issues (e.g., parsing errors, data type mismatches). *
ErrorLogUrls
: When you run
SHOW ROUTINE LOAD FOR <job_name>\G
, you will see a field called
ErrorLogUrls
. This provides a URL (hosted on the BE nodes) where you can view or download the specific rows that failed and the reason for the failure. *
REJECTED_RECORD_PATH
(v3.1+): You can query the
information_schema.loads
view to find the path to rejected records. * Retention: By default, these logs are kept for 48 hours. You can adjust this via the BE configuration
load_error_log_reserve_hours
. 2. Controlling Error Tolerance You can decide how many failed messages are allowed before the Routine Load job automatically pauses: *
max_error_number
: The maximum number of error rows allowed within a window (default is
0
, meaning any error will pause the job if
max_filter_ratio
isn't set). *
max_filter_ratio
: The percentage of failed rows allowed (0.0 to 1.0). If you set this to
1.0
, the job will continue even if all rows fail, though this is generally not recommended for production. 3. Logging Failed Records Starting from StarRocks v3.1, you can explicitly enable logging for rejected records by setting
log_rejected_record_num
in the
PROPERTIES
of your Routine Load job: * `-1`: Log all rejected records. * `0`: Do not log (default). * `n`: Log up to
n
records. Workarounds for a "DLQ Table" If you strictly need the failed messages in a StarRocks table for analysis: 1. Staging Table Strategy: Load everything from Kafka into a "staging" table where all columns are defined as
STRING/VARCHAR
. This prevents parsing errors. Then, use an
INSERT INTO ... SELECT ...
with transformation logic to move data to the final table, and catch failures there. 2. External Script: Write a small script to periodically fetch the data from the
ErrorLogUrls
and insert it into a dedicated "DLQ" table. 3. Upstream Handling: Use a tool like Flink or Kafka Streams to validate data before it reaches StarRocks, sending invalid messages to a Kafka DLQ topic. Referencessql-reference/sql-statements/loading_unloading/routine_load/CREATE_ROUTINE_LOAD.mdloading/RoutineLoad.mdquick_start/routine-load.md
StarRocks does not have a native "Dead Letter Queue" (DLQ) feature that automatically redirects failed Kafka messages to another topic or a specific user-defined table in real-time. However, StarRocks provides several mechanisms to capture, log, and query failed messages for troubleshooting. 1. Accessing Failed Messages via URL By default, Routine Load captures records that fail due to data quality issues (e.g., parsing errors, data type mismatches). *
ErrorLogUrls
: When you run
SHOW ROUTINE LOAD FOR <job_name>\G
, you will see a field called
ErrorLogUrls
. This provides a URL (hosted on the BE nodes) where you can view or download the specific rows that failed and the reason for the failure. * Retention: By default, these logs are kept for 48 hours (controlled by the BE config
load_error_log_reserve_hours
). 2. Querying Failed Records with SQL (v3.1+) Starting from StarRocks v3.1, you can query failed records directly using system views: *
information_schema.loads
: This view contains a
TRACKING_SQL
field. If a load has failed rows, this field provides a pre-constructed SQL query that you can run to view the error logs. *
information_schema.load_tracking_logs
: You can query this view directly by filtering on the
LABEL
or
ID
of your load job to see the
TRACKING_LOG
(the specific data and error reason). *
log_rejected_record_num
: In your
CREATE ROUTINE LOAD
properties, set this to
-1
to log all failed records, or a specific positive integer
n
to log up to
n
records. 3. Error Tolerance Settings You can control how many failed messages are allowed before the job pauses: *
max_error_number
: The maximum number of error rows allowed before the job pauses (default is
0
). *
max_filter_ratio
: The percentage of failed rows allowed (0.0 to 1.0). If you want the job to keep running regardless of errors, you can set this to
1.0
. Common Workarounds for a "DLQ Table" If you strictly need failed messages in a StarRocks table for automated processing: 1. The "Varchar Staging" Strategy: Define a staging table where every column is a `VARCHAR`/`STRING`. Load everything from Kafka into this table (which prevents parsing errors). Then, use a SQL
INSERT INTO ... SELECT ...
with transformation logic to move valid data to your final table. You can then identify "failed" rows in the staging table using SQL filters. 2. External Scripting: Use a small script or cron job to fetch the data from the
ErrorLogUrls
or
load_tracking_logs
and insert it into a dedicated "dead letter table." 3. Upstream Processing: Handle DLQ logic before the data reaches StarRocks using a tool like Flink or a Kafka Streams application, which can branch invalid data to a separate "error" topic. Referencessql-reference/sql-statements/loading_unloading/routine_load/CREATE_ROUTINE_LOAD.mdsql-reference/information_schema/load_tracking_logs.mdloading/RoutineLoad.mdloading/loading_introduction/troubleshooting_loading.md Referencessql-reference/information_schema/loads.mdloading/loading_introduction/troubleshooting_loading.mdsql-reference/information_schema/load_tracking_logs.md
e
@Rocky would a redpanda connector be better ?
r
Whether a "Redpanda connector" is better depends on which one you mean, as there are two main ways to connect Redpanda to StarRocks beyond the standard Routine Load. If your goal is a true Dead Letter Queue (DLQ) where failed messages are automatically routed to a different Kafka topic, using an external connector is generally better than Routine Load. 1. Redpanda Connect (Recommended for DLQ) Redpanda Connect (formerly Benthos) is a high-performance stream processor. It is significantly more powerful than Routine Load for error handling. * Why it's better for DLQ: It has native
fallback
and
catch
processors. If a message fails to be written to StarRocks, you can configure it to automatically send that specific message to a DLQ topic or a secondary storage (like S3). * Trade-off: It is an external component you must manage. It typically interacts with StarRocks via the HTTP Stream Load API. 2. StarRocks Sink Connector (via Kafka Connect) Since Redpanda is Kafka-compatible, you can use the official StarRocks Connector for Apache Kafka running on a Kafka Connect cluster. * Why it's better for DLQ: Kafka Connect has a built-in DLQ feature. By setting
errors.deadletterqueue.topic.name
in the connector config, any messages that fail during conversion or transformation are automatically sent to your specified DLQ topic. * Trade-off: The DLQ primarily catches "pre-sink" errors (like invalid JSON or schema mismatches). If StarRocks itself rejects a batch of data (e.g., a constraint violation), the Kafka Connect framework doesn't always handle it as a single-message DLQ event without custom logic. Summary Comparison Feature | Routine Load (Native) | Kafka Connect (Sink Connector) | Redpanda Connect DLQ Support | No (Manual inspection only) | Yes (Framework level) | Yes (Advanced logic) Ease of Use | Highest (SQL-based) | Medium (Needs Kafka Connect) | Medium (Needs YAML config) Error Handling |
ErrorLogUrls
/ Tracking SQL | Kafka Connect DLQ topic | Fallback topics, Retries, S3 Management | Inside StarRocks | External | External Recommendation * Use Routine Load if you just need to occasionally check why a few rows failed (using
TrackingSQL
) and don't need automated reprocessing. * Use the StarRocks Sink Connector if you already use the Kafka Connect ecosystem and want standard DLQ behavior for malformed data. * Use Redpanda Connect if you need the most robust "Dead Letter" logic, such as routing to different topics based on the type of error or performing complex transformations before the DLQ-side. Referencesloading/Kafka-connector-starrocks.mdloading/RoutineLoad.mdquick_start/routine-load.md Referencesquick_start/routine-load.mdloading/Kafka-connector-starrocks.md