Skip to content

Conversation

shanicky
Copy link
Contributor

@shanicky shanicky commented Jun 24, 2025

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

Introduce protect_drop_table_with_incoming_sink Configuration Option

Summary

This pull request adds a new configuration option, protect_drop_table_with_incoming_sink, to the MetaConfig struct in config.rs. By default, this option is set to false, allowing the drop operation on tables without restrictions. However, when enabled, it prevents the dropping of tables that are currently in use by incoming sinks within the Catalog Controller, as implemented in drop_op.rs.

dev=> create table t(v int);
CREATE_TABLE
dev=> create table m(v int primary key);
CREATE_TABLE
dev=> create sink s1 into m from t;
CREATE_SINK
dev=> create sink s2 into m from t;
CREATE_SINK
dev=> drop table m;
ERROR:  Failed to run the query

Caused by:
  Permission denied: PermissionDenied: Table used by incoming sinks: ["s1", "s2"], please drop them manually

Key changes:

  • Added the protect_drop_table_with_incoming_sink option to MetaConfig in config.rs.
  • Updated the logic in drop_op.rs to check for the new configuration and provide a clear error message if a drop operation is attempted on a table used by incoming sinks.
  • Modified the MetaOpts struct in env.rs to ensure the new option is configurable.

This enhancement not only increases data integrity but also improves user experience by providing informative error messages when avoiding unwanted table drops.

Checklist

  • I have written necessary rustdoc comments.

Documentation

  • My PR needs documentation updates.
Release note

Introduce protect_drop_table_with_incoming_sink Configuration Option

…ocs and example config updates

Signed-off-by: Shanicky Chen <[email protected]>
@shanicky shanicky added this pull request to the merge queue Jun 25, 2025
Merged via the queue into main with commit 8d9fc4f Jun 25, 2025
34 checks passed
@shanicky shanicky deleted the peng/protect-drop-table-with-incoming-sinks branch June 25, 2025 08:39
github-actions bot pushed a commit that referenced this pull request Jun 25, 2025
Copy link
Contributor

✅ Cherry-pick PRs (or issues if encountered conflicts) have been created successfully to all target branches.

kwannoel pushed a commit that referenced this pull request Jun 26, 2025
github-merge-queue bot pushed a commit that referenced this pull request Jul 10, 2025
…22347) (#22361)

Signed-off-by: Peng Chen <[email protected]>
Signed-off-by: Shanicky Chen <[email protected]>
Co-authored-by: Shanicky Chen <[email protected]>
Co-authored-by: lmatz <[email protected]>
Co-authored-by: Chengyou Liu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants