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

refactor: introduce memory control policy abstraction #8253

Merged
merged 4 commits into from
Mar 2, 2023

Conversation

xx01cyx
Copy link
Contributor

@xx01cyx xx01cyx commented Mar 1, 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 introduces an abstraction for memory control policy: trait MemoryControl, and implements this trait on FixedProportionPolicy (the new memory control policy introduced in #7767) and StreamingOnlyPolicy (the policy we used before). We could implement this trait on various memory control policies in the future.

Related issue: #8228

Checklist For Contributors

  • 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)

Checklist For Reviewers

  • I have requested macro/micro-benchmarks as this PR can affect performance substantially, and the results are shown.

Documentation

  • My PR DOES NOT contain user-facing changes.
Click here for Documentation

Types of user-facing changes

Please keep the types that apply to your changes, and remove the others.

  • Installation and deployment
  • Connector (sources & sinks)
  • SQL commands, functions, and operators
  • RisingWave cluster configuration changes
  • Other (please specify in the release note below)

Release note

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

license-eye has totally checked 3006 files.

Valid Invalid Ignored Fixed
1330 1 1675 0
Click to see the invalid file list
  • src/compute/src/memory_management/policy.rs

src/compute/src/memory_management/policy.rs Show resolved Hide resolved
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@codecov
Copy link

codecov bot commented Mar 1, 2023

Codecov Report

Merging #8253 (451d06d) into main (5ce9f2e) will decrease coverage by 0.05%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main    #8253      +/-   ##
==========================================
- Coverage   71.61%   71.57%   -0.05%     
==========================================
  Files        1132     1133       +1     
  Lines      183410   183507      +97     
==========================================
- Hits       131343   131339       -4     
- Misses      52067    52168     +101     
Flag Coverage Δ
rust 71.57% <0.00%> (-0.05%) ⬇️

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

Impacted Files Coverage Δ
...rc/compute/src/memory_management/memory_manager.rs 0.00% <0.00%> (ø)
src/compute/src/memory_management/policy.rs 0.00% <0.00%> (ø)
src/compute/src/server.rs 0.00% <0.00%> (ø)
src/batch/src/task/task_execution.rs 51.75% <0.00%> (-0.51%) ⬇️
src/common/src/types/ordered_float.rs 30.87% <0.00%> (-0.20%) ⬇️
src/storage/src/hummock/compactor/mod.rs 80.38% <0.00%> (-0.20%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@liurenjie1024 liurenjie1024 left a comment

Choose a reason for hiding this comment

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

Generally LGTM

watermark_epoch: Arc<AtomicU64>,
) -> MemoryControlStats;

fn describe(&self, total_compute_memory_bytes: usize) -> String;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to pass the unchange parts, e.g. total_compute_memory_bytes, barrier_interval_ms into concrete memory control policy implementation so that we can simplify API? For example, this way we don't need the describe method but implement Display trait would be enough.

Copy link
Contributor Author

@xx01cyx xx01cyx Mar 2, 2023

Choose a reason for hiding this comment

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

IMO the policy should only contain fields regarding the policy itself while excluding any information about user configurations like the CN memory (though this does make the code a bit more complex).

@xx01cyx xx01cyx added this pull request to the merge queue Mar 2, 2023
Merged via the queue into main with commit 37334ef Mar 2, 2023
@xx01cyx xx01cyx deleted the cyx/refactor-memory-policy branch March 2, 2023 06:03
@wangrunji0408 wangrunji0408 mentioned this pull request Mar 2, 2023
7 tasks
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