-
Notifications
You must be signed in to change notification settings - Fork 594
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(storage): simplify memory limiter notify #17528
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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 5177 files.
Valid | Invalid | Ignored | Fixed |
---|---|---|---|
2213 | 1 | 2963 | 0 |
Click to see the invalid file list
- src/storage/hummock_memory_limiter/src/test.rs
} | ||
|
||
fn may_notify_waiters(self: &Arc<Self>) { | ||
// check `has_waiter` to avoid access lock every times drop `MemoryTracker`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only this method is changed compared to the original code in src/storage/hummock/utils.rs
.
Changed logic is described as in the PR description.
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we should upgrade tokio
in another PR first (and ideally run benchmarks/longevity tests first), because it might be one of the most critical dependency.
If you've read the CHANGELOG and are very confident it's a harmless trivial upgrade, that's also fine.
This doesn't seem to be the correct issue number? |
In the bullet 9 of the Investigation section in the issue description, you mentioned a corner case that msg might be dropped in the oneshot sender side even if the send returns ok.
|
Wow, have almost no impression of this. Still find it interesting when rereading it now. 😄 |
Make sense to me, I can have a separate PR for it. btw, I didn't see a place to specify the tokio version in any of the Should we instead explicitly specify the tokio version somewhere in the |
Yes, I also thought about this problem before. I think we do need to specify the version explicitly. (Perhaps we should use It cannot be put in workspace sth like # why we need this: XXX
dummy-tokio-used-to-restrict-version = { version= "=1.38.0", package = "tokio" ...} |
|
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
Previously due to the problem of tokio oneshot channel described in #6617, in the memory limiter, when we notify waiters, we will have to store the senders to notify and then notify senders after release the lock to avoid deadlock.
With tokio-rs/tokio#6558 gets merged and published in tokio 1.38.0, we don't need this workaround anymore. We can change to notify the sender within the lock, and on send error, we can release the quota without acquiring the lock to notify again. The following code snippet shows the changed logic.
The memory limiter is moved to a separate crate, so that we can write loom test on the memory limiter. A loom test
test_memory_limiter_drop
is added in this PR, which tests the scenario of future cancellation that can cause deadlock in previous tokio version. It's expected to fail in the previous tokio version 1.37.0, though it still gets passed. We may further investigate on why loom is not able to cover all the corner cases.Checklist
./risedev check
(or alias,./risedev c
)Documentation
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.