8000 feat: Add support for altering source connector properties by tabVersion · Pull Request #20780 · risingwavelabs/risingwave · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: Add support for altering source connector properties #20780

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 27 commits into
base: main
Choose a base branch
from

Conversation

tabVersion
Copy link
Contributor
@tabVersion tabVersion commented Mar 7, 2025

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

What's changed and what's your intention?

This commit introduces the ability to alter connector properties for sources using the ALTER SOURCE ... CONNECTOR WITH syntax.

related #20691

Checklist

  • I have written necessary rustdoc comments.
  • I have added necessary unit tests and integration tests.
  • I have added test labels as necessary.
  • I have added fuzzing tests or opened an issue to track them.
  • My PR contains breaking changes.
  • My PR changes performance-critical code, so I will run (micro) benchmarks and present the results.
  • My PR contains critical fixes that are necessary to be merged into the latest release.

Documentation

  • My PR needs documentation updates.
Release note

support new syntax

ALTER [ TABLE / SOURCE ] <object name> CONNECTOR WITH ( ... delta props ...);

to alter the connector props

Note that the props defined in CONNECTION should be altered by ALTER CONNECTION

This is a new feature and we just allow altering props within the whitelist & not change the state table

only alter kafka props allowed:

- properties.client.id
- properties.sync.call.timeout
- properties.enable.auto.commit
- properties.enable.ssl.certificate.verification
- properties.fetch.max.bytes
- properties.fetch.queue.backoff.ms
- properties.fetch.wait.max.ms
- properties.message.max.bytes
- properties.queued.max.messages.kbytes
- properties.queued.min.messages
- properties.receive.message.max.bytes
- properties.statistics.interval.ms
- properties.ssl.endpoint.identification.algorithm
- properties.security.protocol
- properties.sasl.mechanism
- properties.sasl.username
- properties.sasl.password

This commit introduces the ability to alter connector properties for sources using the `ALTER SOURCE ... CONNECTOR WITH` syntax. It includes:

- Adding a new handler for altering source connector properties
- Updating the SQL parser to support the new syntax
- Implementing validation checks to prevent modifying connection-defined properties
@github-actions github-actions bot added the type/feature Type: New feature. label Mar 7, 2025
tabVersion and others added 8 commits March 17, 2025 15:21
- Added `alter_source_connector_props` method to `FrontendMetaClient` and its implementation in `FrontendMetaClientImpl`.
- Introduced a mock implementation in `MockFrontendMetaClient`.
- Created a new handler `handle_alter_source_connector_props` to manage altering source connector properties.
- Removed the obsolete `alter_connector_props.rs` file and updated references to the new handler.
- Enhanced `resolve_connection_ref_and_secret_ref` utility to support the new functionality.
@tabVersion tabVersion requested a review from Copilot May 27, 2025 23:07
Copy link
Contributor
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces support for altering source connector properties using the new syntax "ALTER SOURCE ... CONNECTOR WITH (...)" and updates the related parsing, AST representation, metadata handling, RPC services, and front-end handlers.

  • Added a new parsing branch and AST variant for ALTER CONNECTOR properties in the SQL parser.
  • Expanded the meta client, controller, and streaming job management to support updating connector properties for sources.
  • Updated front-end handlers and utility functions to integrate with the new ALTER SOURCE CONNECTOR functionality.

Reviewed Changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/sqlparser/src/parser.rs Added parsing branch for the CONNECTOR keyword and updated error messages.
src/sqlparser/src/ast/ddl.rs Introduced the new AST variant for AlterConnectorProps and its Display implementation.
src/rpc_client/src/meta_client.rs Added an async function to call alter_source_connector_props with the appropriate parameters.
src/meta/src/stream/source_manager.rs Updated comments for connector parameters to reflect changes for source_id usage.
src/meta/src/manager/metadata.rs Added update_source_props_by_source_id for updating source properties with new connector props.
src/meta/src/controller/streaming_job.rs Extended logic for updating source properties and connector properties in streaming jobs; contains a naming issue.
src/meta/service/src/stream_service.rs Updated service branch to handle both sink and source connector property alterations.
src/frontend/src/utils/with_options.rs Adjusted comments and logic when merging connection properties with provided options.
src/frontend/* Added new handler module and updated meta client and catalog functions to support the ALTER SOURCE CONNECTOR feature.
src/connector/* Enhanced with_options resolution and added a new const to support source alter config list.
Comments suppressed due to low confidence (1)

src/meta/src/controller/streaming_job.rs:1664

  • The variable name 'rewrirte_sql' appears to be misspelled. Consider renaming it to 'rewrite_sql' for clarity.
let rewrirte_sql = {

@hzxa21 hzxa21 requested review from xxhZs and hzxa21 May 28, 2025 02:33
@tabVersion tabVersion marked this pull request as ready for review June 2, 2025 20:01
@graphite-app graphite-app bot requested a review from a team June 2, 2025 20:23
@tabVersion tabVersion requested review from wenym1 and Copilot June 2, 2025 20:32
Copy link
Contributor
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for altering source connector properties via a new ALTER SOURCE … CONNECTOR WITH SQL syntax, wiring changes from frontend parsing through RPC, metadata updates, and worker propagation.

  • Introduce alter_source_connector_props RPC and client methods
  • Implement metadata update (update_source_props_by_source_id) and fragment rewriting
  • Extend source manager and worker to apply updated connector properties at runtime
  • Add frontend handler and SQL plumbing for ALTER SOURCE/SINK … CONNECTOR WITH

Reviewed Changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/rpc_client/src/meta_client.rs Exposed alter_source_connector_props on MetaClient
src/meta/src/stream/source_manager/worker.rs Handle UpdateProps command in ConnectorSourceWorker
src/meta/src/stream/source_manager.rs Enqueue UpdateSourceProps in SourceManagerCore
src/meta/src/controller/streaming_job.rs Added update_source_props_by_source_id and SQL rewrite
src/meta/service/src/stream_service.rs Route AlterConnectorPropsRequest for sources and sinks
src/frontend/src/handler/alter_source_props.rs Frontend SQL handler for ALTER SOURCE CONNECTOR
src/frontend/src/utils/with_options.rs Updated doc comments for option resolution
src/connector/src/source/mod.rs Defined allowed alterable props whitelist via LazyLock
Comments suppressed due to low confidence (2)

src/meta/src/stream/source_manager.rs:114

  • Typo in variable name ‘reccreate_source_id_map_new_props’; consider renaming to ‘recreate_source_id_map_new_props’ for clarity.
let mut reccreate_source_id_map_new_props: Vec<(u32, HashMap<String, String>)> =

src/rpc_client/src/meta_client.rs:1326

  • The new RPC method alter_source_connector_props lacks unit or integration tests; consider adding coverage to verify request dispatch and error scenarios.
pub async fn alter_source_connector_props(

@@ -2086,3 +2336,55 @@ pub struct SinkIntoTableContext {
/// otherwise empty.
pub updated_sink_catalogs: Vec<SinkId>,
}

async fn update_connector_props_fragaments<F>(
Copy link
Preview
Copilot AI Jun 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function name ‘update_connector_props_fragaments’ is misspelled; rename to ‘update_connector_props_fragments’.

Suggested change
async fn update_connector_props_fragaments<F>(
async fn update_connector_props_fragments<F>(

Copilot uses AI. Check for mistakes.

@@ -145,6 +145,15 @@ impl CommandContext {
.unregister_table_ids(unregistered_state_table_ids.iter().cloned())
.await?;
}
Command::ConnectorPropsChange(obj_id_map_props) => {
Copy link
Preview
Copilot AI Jun 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Barrier command handler only applies UpdateSourceProps and ignores sinks or connections; update the command to carry object type and dispatch accordingly.

Copilot uses AI. Check for mistakes.

@@ -703,6 +705,17 @@ impl MetadataManager {
.collect())
}

pub async fn update_source_props_by_source_id(
Copy link
Preview
Copilot AI Jun 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Public method lacks a doc comment; please add Rustdoc describing purpose, arguments, and return value of update_source_props_by_source_id.

Copilot uses AI. Check for mistakes.

@@ -86,6 +87,8 @@ pub trait SourceProperties:
type SplitEnumerator: SplitEnumerator<Properties = Self, Split = Self::Split>;
type SplitReader: SplitReader<Split = Self::Split, Properties = Self>;

const SOURCE_ALTER_CONFIG_LIST: Set<&'static str> = phf_set! {};

Copy link
Preview
Copilot AI Jun 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SOURCE_ALTER_CONFIG_LIST is defined but never used; remove or integrate it where connector alterable props are checked.

Suggested change
/// Checks if a given property is alterable.
fn is_alterable_property(key: &str) -> bool {
Self::SOURCE_ALTER_CONFIG_LIST.contains(key)
}

Copilot uses AI. Check for mistakes.

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.

1 participant
0