-
Notifications
You must be signed in to change notification settings - Fork 587
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 loom test for the counter #6888
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 2540 files.
Valid | Invalid | Ignored | Fixed |
---|---|---|---|
1205 | 1 | 1334 | 0 |
Click to see the invalid file list
- src/utils/task_stats_alloc/tests/loom.rs
d7d2db7
to
c1c4e3a
Compare
// Need this otherwise the NonNull is not Send and can not be used in future. | ||
unsafe impl Send for TaskLocalBytesAllocated {} |
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.
Add this due to the compiler
Co-authored-by: TennyZhuang <[email protected]>
a4dce60
to
3c36325
Compare
I think we don't need to depend on |
LGTM! It's actually not in a |
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.
Good work!
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.
LGTM!
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.
Rest LGTM
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.
Generally LGTM
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.
🚀
2515c87
to
e5d59d0
Compare
Given that this utils (specifically the Counter) should not be frequently changed, I decided not to add this test into CI, seems like it will doubles the runnig time or more (Re-compile). Have added comments that remind people to re-run this test locally and future TODOs. |
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.
LGTM
I believe the timeout is caused by sqlsmith due to |
How about adding it to daily ci? |
I'm not sure where is our daily ci. Do you mean the main-cron.yml? But it seems like we still need to create a new label job (do not put it the same scripts with unit test, otherwise there is still timeout) Let me try put the test behind the sqlsmith |
Codecov Report
@@ Coverage Diff @@
## main #6888 +/- ##
=======================================
Coverage 73.12% 73.12%
=======================================
Files 1037 1037
Lines 165781 165785 +4
=======================================
+ Hits 121231 121234 +3
- Misses 44550 44551 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Hey @BowenXiao1999, this pull request failed to merge and has been dequeued from the merge train. If you believe your PR failed in the merge train because of a flaky test, requeue it by clicking "Update branch" or pushing an empty commit with |
58ac359
to
26a278c
Compare
I hereby agree to the terms of the Singularity Data, Inc. Contributor License Agreement.
What's changed and what's your intention?
Basically same as #6822. But we reuse the Counter to avoid code duplicate. Copy the content here.
Use https://github.com/tokio-rs/loom for concurrency test. Maybe can make the correctness more confident. But I'm not so sure how to write the best test.
it requires some code change for previous structure, so may need discuss:
remove workspacke hack in task_stats_alloc crate. Otherwise there will be package conflict if you run RUSTFLAGS="--cfg loom" cargo test --test loom. Have not investigate deeply but simple remove just works.
Refactor &'static AtomicUsize to be NonNull. This is because the AtomicUsize in loom type do not support .as_mut_ptr (described in What to do when loom::AtomicUsize do not implement as_mut_ptr() tokio-rs/loom#298), so we use NonNull as intermediate workaround, that will add some unsafe code in .add() and .sub(). But seems OK.
To test the drop, I have to add a flag var AtomicUsize in .sub() to ensure that the value is dropped. Please provide some suggestions if you have better ideas on how to write test.
Checklist
./risedev check
(or alias,./risedev c
)Documentation
If your pull request contains user-facing changes, please specify the types of the changes, and create a release note. Otherwise, please feel free to remove this section.
Types of user-facing changes
Please keep the types that apply to your changes, and remove those that do not apply.
Release note
Please create a release note for your changes. In the release note, focus on the impact on users, and mention the environment or conditions where the impact may occur.
Refer to a related PR or issue link (optional)