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: RegionEngine::handle_request always returns affected rows #2874

Merged
merged 11 commits into from
Dec 6, 2023
Merged

refactor: RegionEngine::handle_request always returns affected rows #2874

merged 11 commits into from
Dec 6, 2023

Conversation

tisonkun
Copy link
Collaborator

@tisonkun tisonkun commented Dec 5, 2023

I hereby agree to the terms of the GreptimeDB CLA

What's changed and what's your intention?

This closes #2784.

@waynexia I wonder if we should add a type alias or wrapper for AffectedRows but I keep use usize in this patch for a first step.

Checklist

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.

Refer to a related PR or issue link (optional)

@tisonkun
Copy link
Collaborator Author

tisonkun commented Dec 5, 2023

cc @Dysprosium0626 you can take a review or take over this patch as the assignee. But it happens that I have time to take a look at this issue and it's weeks after your assignment.

@tisonkun tisonkun changed the title Refactor handle query refactor: RegionEngine::handle_request -> handle_execution Dec 5, 2023
Signed-off-by: tison <[email protected]>
@WenyXu
Copy link
Member

WenyXu commented Dec 5, 2023

I prefer using words to align the DQL, DML, DDL, and DCL. The definition of execution is too broad.

@tisonkun
Copy link
Collaborator Author

tisonkun commented Dec 5, 2023

@WenyXu do you mean revert the name to handle_request but retain the return value type refactor?

@tisonkun
Copy link
Collaborator Author

tisonkun commented Dec 5, 2023

The reason I try to rename is request is actually non-query request but perhaps execution is not optimal also.

@WenyXu
Copy link
Member

WenyXu commented Dec 5, 2023

@WenyXu do you mean revert the name to handle_request but retain the return value type refactor?

Yes, the execution seems not good either. Maybe it's a better time to rename the method when we need to separate handle_request into several methods.

@tisonkun tisonkun changed the title refactor: RegionEngine::handle_request -> handle_execution refactor: RegionEngine::handle_request always returns affected rows Dec 5, 2023
@tisonkun
Copy link
Collaborator Author

tisonkun commented Dec 5, 2023

@WenyXu Updated.

Signed-off-by: tison <[email protected]>
Copy link

codecov bot commented Dec 5, 2023

Codecov Report

Merging #2874 (911a4c1) into develop (b3ffe5c) will decrease coverage by 0.52%.
Report is 5 commits behind head on develop.
The diff coverage is 86.51%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2874      +/-   ##
===========================================
- Coverage    84.86%   84.35%   -0.52%     
===========================================
  Files          745      749       +4     
  Lines       117222   117896     +674     
===========================================
- Hits         99482    99448      -34     
- Misses       17740    18448     +708     

@evenyag
Copy link
Contributor

evenyag commented Dec 5, 2023

Shall we add a RegionResponse struct?

struct RegionResponse {
    affected_rows: usize,
}

@Dysprosium0626
Copy link
Contributor

cc @Dysprosium0626 you can take a review or take over this patch as the assignee. But it happens that I have time to take a look at this issue and it's weeks after your assignment.

@tisonkun I am sorry that I was busy on other things last week. I had done it halfway but delayed because I had to take some time to understand the code structure (I'm new here). Anyway, I have the similar idea as your refraction and thank you for taking over my task. I will take some other tasks.

@tisonkun
Copy link
Collaborator Author

tisonkun commented Dec 5, 2023

@waynexia I wonder if we should add a type alias or wrapper for AffectedRows but I keep use usize in this patch for a first step.

@evenyag I thought of it either. But lean to keep usize until we found the return value as usize causes confusion.

@waynexia
Copy link
Member

waynexia commented Dec 6, 2023

@waynexia I wonder if we should add a type alias or wrapper for AffectedRows but I keep use usize in this patch for a first step.

@evenyag I thought of it either. But lean to keep usize until we found the return value as usize causes confusion.

Thanks for your efforts.

For the return type, I prefer at least a type alias over plain usize, which makes it easier to distinguish with other usizes

@tisonkun
Copy link
Collaborator Author

tisonkun commented Dec 6, 2023

OK. I'll push a new commit later :D

@tisonkun
Copy link
Collaborator Author

tisonkun commented Dec 6, 2023

@WenyXu @evenyag @waynexia updated.

BTW we have three type alias pub type AffectedRows = usize;. Perhaps we can move them to a common base crate as a follow-up.

  • src/common/meta/src/datanode_manager.rs
  • src/query/src/table_mutation.rs
  • src/store-api/src/region_request.rs (added in this patch)

Copy link
Member

@waynexia waynexia left a comment

Choose a reason for hiding this comment

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

Almost LGTM, thanks for this @tisonkun

src/metric-engine/src/engine.rs Outdated Show resolved Hide resolved
src/metric-engine/src/engine.rs Outdated Show resolved Hide resolved
@tisonkun
Copy link
Collaborator Author

tisonkun commented Dec 6, 2023

@waynexia Updated at 911a4c1

@waynexia waynexia enabled auto-merge December 6, 2023 12:53
@waynexia waynexia added this pull request to the merge queue Dec 6, 2023
Merged via the queue into GreptimeTeam:develop with commit f74715c Dec 6, 2023
13 checks passed
@tisonkun tisonkun deleted the refactor-handle-query branch December 6, 2023 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change the return type of RegionEngine::handle_request()
5 participants