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(meta): adapt ValTransaction to metadata model v2 #12918

Merged
merged 4 commits into from
Oct 18, 2023

Conversation

zwang28
Copy link
Contributor

@zwang28 zwang28 commented Oct 17, 2023

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

What's changed and what's your intention?

Create a ValTransaction trait replica for use by sql meta store model. The replica is the same as the original except:

  • Make some methods async.
  • Remove dependency on MetadataModel.
  • Fix unit tests.

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.

/// Trait that wraps a local memory value and applies the change to the local memory value on
/// `commit` or leaves the local memory value untouched on `abort`.
#[async_trait]
pub trait ValTransaction: Sized {
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems that the only difference between the current on and the original one is the type of the Transaction? If so, shall try introducing a associated type Transaction or a generic parameter in the trait definition so that we may avoid completely duplicating the original code.

Copy link
Contributor Author

@zwang28 zwang28 Oct 18, 2023

Choose a reason for hiding this comment

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

Yes the only several difference includes Transaction and sync/async method.
The duplicated code is because model V1 and model V2 may coexist for some time and there may be more changes. In the end I'll remove this duplicate file, and modify original one directly.

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.

Rest LGTM!

src/meta/src/model_v2/trx.rs Show resolved Hide resolved
@wenym1
Copy link
Contributor

wenym1 commented Oct 18, 2023

Just had some small change on the original trait. Now original utils can be reused without duplicating the code.

@codecov
Copy link

codecov bot commented Oct 18, 2023

Codecov Report

Merging #12918 (1db9141) into main (203cac8) will increase coverage by 0.03%.
Report is 3 commits behind head on main.
The diff coverage is 99.04%.

@@            Coverage Diff             @@
##             main   #12918      +/-   ##
==========================================
+ Coverage   69.18%   69.21%   +0.03%     
==========================================
  Files        1493     1495       +2     
  Lines      246484   246750     +266     
==========================================
+ Hits       170523   170787     +264     
- Misses      75961    75963       +2     
Flag Coverage Δ
rust 69.21% <99.04%> (+0.03%) ⬆️

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

Files Coverage Δ
...ta/src/hummock/manager/compaction_group_manager.rs 78.54% <100.00%> (ø)
src/meta/src/hummock/manager/mod.rs 61.11% <100.00%> (ø)
src/meta/src/lib.rs 1.36% <ø> (ø)
src/meta/src/manager/catalog/mod.rs 27.81% <ø> (ø)
src/meta/src/model/mod.rs 97.12% <100.00%> (+0.02%) ⬆️
src/meta/src/model_v2/ext/hummock.rs 100.00% <100.00%> (ø)
src/meta/src/model_v2/mod.rs 100.00% <ø> (ø)
src/meta/src/model_v2/trx.rs 100.00% <100.00%> (ø)
src/meta/src/manager/cluster.rs 74.60% <50.00%> (ø)
src/meta/src/manager/system_param/mod.rs 18.94% <0.00%> (ø)
... and 1 more

... and 3 files with indirect coverage changes

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

@zwang28 zwang28 added this pull request to the merge queue Oct 18, 2023
Merged via the queue into main with commit b782185 Oct 18, 2023
6 of 7 checks passed
@zwang28 zwang28 deleted the wangzheng/valtransaction_model_v2 branch October 18, 2023 07:41
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