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: Add compression capabilities for StreamNode in PbTableFragments. #13598

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

Conversation

shanicky
Copy link
Contributor

@shanicky shanicky commented Nov 22, 2023

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

What's changed and what's your intention?

This PR attempts to compress duplicate node bodies in PbTableFragments::fragment::actor::nodes. The aim is to possibly reduce the RPC and meta storage to avoid ‘request limit’ errors.

before
image

after
image

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • All checks passed in ./risedev check (or alias, ./risedev c)

@shanicky shanicky marked this pull request as ready for review November 22, 2023 10:48
@shanicky shanicky changed the title feat: Add compression capabilities for StreamNode in PbTableFragments. [wip]feat: Add compression capabilities for StreamNode in PbTableFragments. Nov 22, 2023
Copy link

codecov bot commented Nov 23, 2023

Codecov Report

Attention: 87 lines in your changes are missing coverage. Please review.

Comparison is base (1c453f4) 68.23% compared to head (572947b) 68.20%.
Report is 5 commits behind head on main.

Files Patch % Lines
src/common/src/util/table_fragments_util.rs 44.44% 50 Missing ⚠️
src/meta/src/controller/fragment.rs 33.33% 14 Missing ⚠️
src/meta/src/model/stream.rs 43.75% 9 Missing ⚠️
src/meta/src/dashboard/mod.rs 0.00% 8 Missing ⚠️
src/rpc_client/src/meta_client.rs 0.00% 5 Missing ⚠️
src/meta/src/controller/catalog.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13598      +/-   ##
==========================================
- Coverage   68.23%   68.20%   -0.03%     
==========================================
  Files        1525     1526       +1     
  Lines      262188   262319     +131     
==========================================
+ Hits       178899   178920      +21     
- Misses      83289    83399     +110     
Flag Coverage Δ
rust 68.20% <39.16%> (-0.03%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@yezizp2012 yezizp2012 left a comment

Choose a reason for hiding this comment

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

Please add some tests since this PR will introduce some breaking changes about the metadata format. Rest LGTM.

src/common/src/util/table_fragments_util.rs Outdated Show resolved Hide resolved
src/common/src/util/table_fragments_util.rs Outdated Show resolved Hide resolved
let mut table_fragments = table_fragments;

if table_fragments.graph_render_type == GraphRenderType::RenderTemplate as i32 {
downgrade_table_fragments(&mut table_fragments);
Copy link
Member

Choose a reason for hiding this comment

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

We'd better support transform between sql model and templated kv directly for better performance. Not urgent and can be done in future PR.

@yezizp2012 yezizp2012 requested a review from BugenZhao December 4, 2023 08:39
Copy link
Member

@BugenZhao BugenZhao left a comment

Choose a reason for hiding this comment

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

Cool

proto/meta.proto Outdated Show resolved Hide resolved

use crate::util::stream_graph_visitor::visit_stream_node;

pub fn downgrade_table_fragments(table_fragments: &mut PbTableFragments) {
Copy link
Member

Choose a reason for hiding this comment

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

Would you mind adding docs for these functions?

Comment on lines 24 to 31
pub fn downgrade_table_fragments(table_fragments: &mut PbTableFragments) {
assert_eq!(
table_fragments.graph_render_type,
GraphRenderType::RenderTemplate as i32
);
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
pub fn downgrade_table_fragments(table_fragments: &mut PbTableFragments) {
assert_eq!(
table_fragments.graph_render_type,
GraphRenderType::RenderTemplate as i32
);
#[easy_ext::ext(TableFragmentsRenderCompat)]
impl TableFragments {
pub fn ensure_downgraded(&mut self) {
if let Unspecified = table_fragments.graph_render_type {
return;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed, easy_ext is quite useful. However, I believe that the calls here should be explicit and within control. Hence, I would prefer to directly assert fail when there are repeated calls to compress/uncompress. 🤔

Copy link
Member

Choose a reason for hiding this comment

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

Then ensure sounds not that appropriate. 😢

src/common/src/util/table_fragments_util.rs Outdated Show resolved Hide resolved
@BugenZhao
Copy link
Member

By the way, I'm considering if it's worth trying the approach proposed here, which could be more transparent to the application.

#11072 (comment)

@shanicky
Copy link
Contributor Author

shanicky commented Dec 5, 2023

By the way, I'm considering if it's worth trying the approach proposed here, which could be more transparent to the application.

#11072 (comment)

This should be good, if it can be achieved through middleware, it should be able to be done very transparently.

@shanicky shanicky force-pushed the peng/compress-table-fragments branch from 9f6dee2 to 266890e Compare December 5, 2023 08:34
@shanicky
Copy link
Contributor Author

shanicky commented Dec 5, 2023

I added two conversions here. The code with these conversions has passed all the CI tests, so it seems to be fine.

https://github.com/risingwavelabs/risingwave/pull/13598/files#diff-ec1ff910ba6e870e862ae45718136cb6c00b2cb1308a8d5f8bfb6398918136b6R604

@shanicky shanicky changed the title [wip]feat: Add compression capabilities for StreamNode in PbTableFragments. feat: Add compression capabilities for StreamNode in PbTableFragments. Dec 5, 2023
@shanicky shanicky added this pull request to the merge queue Dec 7, 2023
@shanicky shanicky removed this pull request from the merge queue due to a manual request Dec 7, 2023
@shanicky shanicky added this pull request to the merge queue Dec 7, 2023
@shanicky shanicky removed this pull request from the merge queue due to a manual request Dec 7, 2023
Copy link
Contributor

github-actions bot commented Feb 4, 2024

This PR has been open for 60 days with no activity. Could you please update the status? Feel free to ping a reviewer if you are waiting for review.

@BugenZhao
Copy link
Member

By the way, I'm considering if it's worth trying the approach proposed here, which could be more transparent to the application.

#11072 (comment)

The results in #15558 show that the simple gzip compression will work pretty well. Can we take a try? Or have we postponed this PR due to upcoming migration to SQL meta store backend? 😄

@fuyufjh fuyufjh closed this Jun 14, 2024
@shanicky shanicky reopened this Aug 1, 2024
@xxchan
Copy link
Member

xxchan commented Jan 10, 2025

👀

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.

5 participants