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

test(lints): add lint rw::await-in-loop #14013

Closed
wants to merge 12 commits into from

Conversation

TennyZhuang
Copy link
Contributor

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

What's changed and what's your intention?

Inspired by #13970

Found several bugs, also many false positive cases.

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • I have added test labels as necessary. See details.
  • 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.

@TennyZhuang TennyZhuang requested a review from a team as a code owner December 15, 2023 07:54
@github-actions github-actions bot added the component/test Test related issue. label Dec 15, 2023
@TennyZhuang
Copy link
Contributor Author

image image

Signed-off-by: TennyZhuang <[email protected]>
Signed-off-by: TennyZhuang <[email protected]>
@TennyZhuang
Copy link
Contributor Author

I'll try to eliminate false positive cases in the further PRs.

Also I'll fix the true positive cases to improve the performance.

Signed-off-by: TennyZhuang <[email protected]>
Signed-off-by: TennyZhuang <[email protected]>
@BugenZhao BugenZhao requested a review from xxchan December 15, 2023 09:15
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.

Would you mind sharing some results found by this lint?

Copy link
Member

@xxchan xxchan left a comment

Choose a reason for hiding this comment

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

sgtm. added some wording suggestions

lints/src/await_in_loop.rs Outdated Show resolved Hide resolved
lints/src/await_in_loop.rs Outdated Show resolved Hide resolved
/// This can't be concurrent
///
/// ### Known problems
/// Ignore it if your loop body must be executed sequentially or if it is not on the critical path.
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
/// Ignore it if your loop body must be executed sequentially or if it is not on the critical path.
/// Can cause false positives.
///
/// It is possible that the loop body must be executed sequentially.

Copy link
Member

Choose a reason for hiding this comment

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

"or if it is not on the critical path." I'm wondering whether the rewriting is beneficial for all situations. 🤔

// In most cases, a raw `loop` can't be concurrent.
if !matches!(source, LoopSource::Loop) =>
{
if !is_from_async_await(ex.span) {
Copy link
Member

Choose a reason for hiding this comment

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

What does this if do? 👀

Signed-off-by: TennyZhuang <[email protected]>
@TennyZhuang
Copy link
Contributor Author

await_in_loop.log

@TennyZhuang
Copy link
Contributor Author

warning: `risingwave_error` (lib) generated 1 warning
warning: `risingwave_udf` (lib) generated 1 warning
warning: `risingwave_rpc_client` (lib) generated 3 warnings
warning: `risingwave_expr` (lib) generated 3 warnings
warning: `risingwave_hummock_trace` (lib) generated 4 warnings
warning: `risingwave_storage` (lib) generated 49 warnings
warning: `risingwave_jni_core` (lib) generated 1 warning
warning: `risingwave_connector` (lib) generated 26 warnings (5 duplicates)
warning: `risingwave_meta` (lib) generated 90 warnings
warning: `risingwave_batch` (lib) generated 11 warnings
warning: `pgwire` (lib) generated 1 warning
warning: `risingwave_frontend` (lib) generated 13 warnings
warning: `risingwave_expr_impl` (lib) generated 4 warnings
warning: `risingwave_meta_service` (lib) generated 1 warning
warning: `risingwave_compactor` (lib) generated 1 warning
warning: `risingwave_stream` (lib) generated 39 warnings
warning: `risingwave_compute` (lib) generated 2 warnings
warning: `risingwave_ctl` (lib) generated 9 warnings
warning: `risingwave_e2e_extended_mode_test` (lib) generated 5 warnings
warning: `risingwave_compaction_test` (lib) generated 7 warnings
warning: `risingwave_regress_test` (lib) generated 3 warnings
warning: `risingwave_bench` (bin "s3-bench") generated 3 warnings
warning: `risingwave_state_cleaning_test` (bin "risingwave_state_cleaning_test") generated 3 warnings

TennyZhuang and others added 4 commits December 18, 2023 23:38
Signed-off-by: TennyZhuang <[email protected]>
Signed-off-by: TennyZhuang <[email protected]>
Signed-off-by: TennyZhuang <[email protected]>
Copy link

codecov bot commented Dec 19, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (016e58e) 68.05% compared to head (18b5a7b) 67.97%.
Report is 32 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #14013      +/-   ##
==========================================
- Coverage   68.05%   67.97%   -0.09%     
==========================================
  Files        1536     1536              
  Lines      265407   265407              
==========================================
- Hits       180626   180411     -215     
- Misses      84781    84996     +215     
Flag Coverage Δ
rust 67.97% <ø> (-0.09%) ⬇️

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
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants