risingwavelabs/risingwave · error

ALTER SINK_RATE_LIMIT is not for sink into table

Error message

ALTER SINK_RATE_LIMIT is not for sink into table

What it means

`ALTER SINK ... SINK_RATE_LIMIT` throttles the sink's own egress writing to an external system. When the sink's target is another RisingWave table (sink.target_table is Some), its downstream is internal and does not use the external sink writer path that this throttle controls, so the handler rejects it.

Solutions

  1. Use `ALTER SINK s BACKFILL_RATE_LIMIT ...` or adjust throttling on the target table instead (e.g. DML rate limit on the target table).
  2. Only apply SINK_RATE_LIMIT to external sinks (Kafka, etc.) that do not target a table.
  3. If throttling the internal write is required, throttle the target table's DML rate limit rather than the sink.

Example fix

// before
ALTER SINK table_sink SINK_RATE_LIMIT 100;
// after
ALTER TABLE table_sink DML_RATE_LIMIT 100;
Defensive patterns

Strategy: validation

Validate before calling

-- Skip sinks that target a table before applying SINK_RATE_LIMIT:
SELECT name, target_table
FROM rw_catalog.rw_sinks
WHERE name = 'my_sink';
-- If target_table IS NOT NULL, throttle the target table's DML rate limit instead.

Prevention

When it happens

Trigger: Running `ALTER SINK s SINK_RATE_LIMIT ...` where s is a sink created with `INTO table_name` (sink into table), i.e. sink.target_table is set, in handle_alter_streaming_rate_limit.

Common situations: Applying sink egress throttling to an internal table sink, e.g. to stage data into a table before external export; scripts that enumerate all sinks and apply SINK_RATE_LIMIT uniformly without checking the sink target type.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11). Data as JSON: /api/errors/d2da5b30e6eff66e. Report an issue: GitHub.

Appendix: source

Thrown at src/frontend/src/handler/alter_streaming_rate_limit.rs:117

        }
        (PbThrottleTarget::Table, PbThrottleType::Backfill) => {
            let reader = session.env().catalog_reader().read_guard();
            let table =
                check_table_mismatch(&reader, &session, db_name, schema_path, &real_table_name)?;
            if table.cdc_table_type.is_none() {
                return Err(ErrorCode::InvalidInputSyntax(format!(
                    "\"{table_name}\" is not a CDC table",
                ))
                .into());
            }
            (StatementType::ALTER_TABLE, table.id.as_raw_id())
        }
        (PbThrottleTarget::Sink, PbThrottleType::Sink) => {
            let reader = session.env().catalog_reader().read_guard();
            let (sink, schema_name) =
                reader.get_any_sink_by_name(db_name, schema_path, &real_table_name)?;
            if sink.target_table.is_some() {
                bail!("ALTER SINK_RATE_LIMIT is not for sink into table")
            }
            session.check_privilege_for_drop_alter(schema_name, &**sink)?;
            (StatementType::ALTER_SINK, sink.id.as_raw_id())
        }
        (PbThrottleTarget::Sink, PbThrottleType::Backfill) => {
            let reader = session.env().catalog_reader().read_guard();
            let (sink, schema_name) =
                reader.get_any_sink_by_name(db_name, schema_path, &real_table_name)?;
            session.check_privilege_for_drop_alter(schema_name, &**sink)?;
            (StatementType::ALTER_SINK, sink.id.as_raw_id())
        }
        _ => bail!(
            "Unsupported throttle target: {:?} and throttle type: {:?}",
            throttle_target,
            throttle_type
        ),
    };
    execute_with_long_running_notification(

View on GitHub (pinned to 6469eb736d)