Skip to content
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

feat(common): support switching from pg jdbc to pg native sinks #19703

Conversation

kwannoel
Copy link
Contributor

@kwannoel kwannoel commented Dec 6, 2024

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

What's changed and what's your intention?

We can switch from jdbc:postgres to native postgres sink by enabling a config under [streaming.developer].

See Release Notes below for more details.

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • I have added test labels as necessary. See details.
  • I have added fuzzing tests or opened an issue to track them. (Optional, recommended for new SQL features Sqlsmith: Sql feature generation #7934).
  • My PR contains breaking changes. (If it deprecates some features, please create a tracking issue to remove them in the future).
  • All checks passed in ./risedev check (or alias, ./risedev c)
  • My PR changes performance-critical code. (Please run macro/micro-benchmarks and show the results.)
  • My PR contains critical fixes that are necessary to be merged into the latest release. (Please check out the details)

Documentation

  • My PR needs documentation updates. (Please use the Release note section below to summarize the impact on users)

Release note

We support switching from connector='jdbc' for jdbc postgres sinks to connector='postgres'.

This can be done by enabling a streaming developer config:

[streaming.developer]
stream_switch_jdbc_pg_to_native = true

Copy link
Contributor Author

kwannoel commented Dec 6, 2024

@kwannoel kwannoel marked this pull request as ready for review December 6, 2024 13:07
@kwannoel kwannoel requested a review from a team as a code owner December 6, 2024 13:07
@kwannoel kwannoel requested a review from cyliu0 December 6, 2024 13:07
@kwannoel kwannoel force-pushed the 12-06-feat_common_support_switching_from_pg_jdbc_to_pg_native_sinks branch from 2249c24 to e7ed9d3 Compare December 6, 2024 13:43
@graphite-app graphite-app bot requested a review from a team December 7, 2024 09:29
@kwannoel kwannoel requested review from StrikeW and chenzl25 December 9, 2024 07:56
Copy link
Contributor

@chenzl25 chenzl25 left a comment

Choose a reason for hiding this comment

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

LGTM

src/stream/src/from_proto/sink.rs Show resolved Hide resolved
Copy link
Contributor

@StrikeW StrikeW left a comment

Choose a reason for hiding this comment

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

LGTM!

@kwannoel kwannoel enabled auto-merge December 9, 2024 11:26
@kwannoel kwannoel disabled auto-merge December 9, 2024 11:26
Comment on lines 335 to 343
if !url.contains("jdbc:postgres") {
bail!("invalid jdbc url")
}

let url = url.replace("jdbc:", "");
let url = Url::parse(&url).map_err(|e| anyhow!(e).context("failed to parse jdbc url"))?;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if !url.contains("jdbc:postgres") {
bail!("invalid jdbc url")
}
let url = url.replace("jdbc:", "");
let url = Url::parse(&url).map_err(|e| anyhow!(e).context("failed to parse jdbc url"))?;
if !url.starts_with("jdbc:") {
bail!("invalid jdbc url")
}
let url = Url::parse(&url[5..]).map_err(|e| anyhow!(e).context("failed to parse jdbc url"))?;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Replace jdbc is a lot more explicit, than trimming the string after 5 chars.

src/stream/src/from_proto/sink.rs Outdated Show resolved Hide resolved
src/common/src/config.rs Show resolved Hide resolved
@kwannoel kwannoel force-pushed the 12-06-feat_common_support_switching_from_pg_jdbc_to_pg_native_sinks branch from e01f6d2 to 0062ecd Compare December 11, 2024 00:12
@kwannoel
Copy link
Contributor Author

Need review for Cargo.lock

Copy link
Contributor Author

Merge activity

  • Dec 11, 8:30 PM EST: Graphite couldn't merge this PR because it failed for an unknown reason (This repository has GitHub's merge queue enabled, which is currently incompatible with Graphite).

@kwannoel kwannoel added this pull request to the merge queue Dec 12, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 12, 2024
@kwannoel kwannoel added this pull request to the merge queue Dec 12, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 12, 2024
@kwannoel kwannoel force-pushed the 12-06-feat_common_support_switching_from_pg_jdbc_to_pg_native_sinks branch from e78d259 to 2e302e9 Compare December 12, 2024 13:00
@kwannoel kwannoel added this pull request to the merge queue Dec 12, 2024
Merged via the queue into main with commit 9cd0453 Dec 12, 2024
30 of 31 checks passed
@kwannoel kwannoel deleted the 12-06-feat_common_support_switching_from_pg_jdbc_to_pg_native_sinks branch December 12, 2024 15:01
@lmatz lmatz added the user-facing-changes Contains changes that are visible to users label Dec 22, 2024
Copy link
Contributor

Hi, there.

📝 Telemetry Reminder:
If you're implementing this feature, please consider adding telemetry metrics to track its usage. This helps us understand how the feature is being used and improve it further.
You can find the function report_event of telemetry reporting in the following files. Feel free to ask questions if you need any guidance!

  • src/frontend/src/telemetry.rs
  • src/meta/src/telemetry.rs
  • src/stream/src/telemetry.rs
  • src/storage/compactor/src/telemetry.rs
    Or calling report_event_common (src/common/telemetry_event/src/lib.rs) as if finding it hard to implement.
    ✨ Thank you for your contribution to RisingWave! ✨

This is an automated comment created by the peaceiris/actions-label-commenter. Responding to the bot or mentioning it won't have any effect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/feature user-facing-changes Contains changes that are visible to users
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants