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(sink): support jdbc sink async truncate #13190

Merged
merged 23 commits into from
Nov 8, 2023
Merged

Conversation

wenym1
Copy link
Contributor

@wenym1 wenym1 commented Nov 1, 2023

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

What's changed and what's your intention?

After #13137

The return type of the write method of SinkWriter java interface is changed to bool, where true indicates that the batch is persisted in the external sink and is safe to truncate the log reader.

A new item BatchWritten is added to the sink writer response, to indicate that the batch with the batch id has been persisted. The remote sink is refactored to poll the response and truncate asynchronously.

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • 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

If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.

Copy link

gitguardian bot commented Nov 1, 2023

⚠️ GitGuardian has uncovered 2 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id Secret Commit Filename
7648795 Generic CLI Secret 9b8ca15 integration_tests/iceberg-cdc/run_test.sh View secret
7648795 Generic CLI Secret 9b8ca15 integration_tests/iceberg-cdc/docker-compose.yml View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Our GitHub checks need improvements? Share your feedbacks!

@StrikeW StrikeW self-requested a review November 2, 2023 06:29
@wenym1 wenym1 removed the request for review from StrikeW November 2, 2023 10:08
Copy link

codecov bot commented Nov 6, 2023

Codecov Report

Merging #13190 (095d91f) into main (e3c8649) will decrease coverage by 0.02%.
Report is 12 commits behind head on main.
The diff coverage is 3.96%.

@@            Coverage Diff             @@
##             main   #13190      +/-   ##
==========================================
- Coverage   68.00%   67.99%   -0.02%     
==========================================
  Files        1521     1521              
  Lines      257858   257930      +72     
==========================================
+ Hits       175364   175385      +21     
- Misses      82494    82545      +51     
Flag Coverage Δ
rust 67.99% <3.96%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
src/connector/src/sink/remote.rs 27.71% <3.96%> (-2.91%) ⬇️

... and 6 files with indirect coverage changes

📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today!

Copy link
Collaborator

@hzxa21 hzxa21 left a comment

Choose a reason for hiding this comment

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

Rest LGTM

{ ElasticSearch, ElasticSearchSink, "elasticsearch" }
{ Cassandra, CassandraSink, "cassandra" }
{ Jdbc, JdbcSink, "jdbc", |desc| {
desc.sink_type.is_append_only()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are we planning to enable upsert jdbc sink decoupling as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

May keep the same as other sinks like kafka, kinesis for now. Current implementation does not support rewind on failure yet, and enabling it by default does not help resolve much of the current problems.

I think we can enable sink decouple for these sinks by default after rewind on failure is supported.

)),
} => {
if let Some(metadata) = metadata {
warn!("get unexpected non-empty metadata: {:?}", metadata);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this really unexpected? I saw that java iceberg sink will return non-empty metadata.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

iceberg sink uses CoordinatedRemoteSinkWriter and will not be affected by this PR. Sink that use this RemoteLogSinker assume that they are not coordinated and should not return non-empty metadata.

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.

Rest lgtm. I think the related issue is #12060.
Btw I have a quick question about the failure isolation, what is the expected behavior if a sink fails to commit? For the case of JDBC sink fails due to incorrect data, I think we can avoid triggering a recovery with the help of log store. But does the sink will retry its work continuously?

proto/connector_service.proto Show resolved Hide resolved
src/connector/src/sink/remote.rs Outdated Show resolved Hide resolved
@wenym1 wenym1 enabled auto-merge November 8, 2023 06:46
@wenym1 wenym1 added this pull request to the merge queue Nov 8, 2023
Merged via the queue into main with commit 566bacf Nov 8, 2023
7 of 9 checks passed
@wenym1 wenym1 deleted the yiming/jdbc-async-truncate branch November 8, 2023 07:25
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.

3 participants