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

sync to 1.1: fix db not found when mo_table_size #15444

Merged
merged 3 commits into from Apr 10, 2024

Conversation

gouhongshen
Copy link
Contributor

@gouhongshen gouhongshen commented Apr 10, 2024

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

issue #https://github.com/matrixorigin/MO-Cloud/issues/2930

What this PR does / why we need it:

see issue for more details

@matrix-meow matrix-meow added the size/S Denotes a PR that changes [10,99] lines label Apr 10, 2024
@mergify mergify bot requested a review from sukki37 April 10, 2024 09:52
@mergify mergify bot added the kind/bug Something isn't working label Apr 10, 2024
@matrix-meow
Copy link
Contributor

@gouhongshen Thanks for your contributions!

Pull Request Review:

Title:

The title of the pull request is clear and concise, indicating that it fixes an issue related to the database not being found when mo_table_size is called.

Body:

The body of the pull request is minimal, providing checkboxes for the type of PR and referencing the related issue. It would be beneficial to include a brief description of the problem and the approach taken to solve it directly in the body to give reviewers a quick overview without having to refer to the linked issue.

Changes:

  1. Code Logic Issue:

    • The code contains commented-out logic related to switching account IDs (accSwitched and proc.Ctx manipulation) that seems to be unnecessary and confusing. This commented-out code should be removed entirely to avoid confusion and reduce clutter in the codebase.
  2. Variable Naming Improvement:

    • The variable name foolCtx used as a copy of proc.Ctx can be misleading. It's recommended to use a more descriptive name like ctxCopy or tempCtx to improve readability and maintainability.
  3. Security Concern - Logging Sensitive Information:

    • The log message in the MoTableSize function includes sensitive information like database and table names, account IDs, and potentially identifiable information. It's crucial to avoid logging such sensitive data to prevent security risks. Consider logging only essential information or using placeholders instead of actual values.
  4. Redundant Context Passing:

    • The code unnecessarily creates a copy of the context (foolCtx) and passes it to subsequent function calls. Instead of creating a copy, the original context (proc.Ctx) can be directly used, reducing unnecessary variable creation and improving code efficiency.
  5. Function Parameter Consistency:

    • The function calls to originalTableSize and indexesTableSize inconsistently pass the context parameter as ctx or foolCtx. It's recommended to maintain consistency in parameter naming for better code clarity and maintainability.

Suggestions for Optimization:

  • Remove unnecessary commented-out code to declutter the codebase.
  • Use more descriptive variable names for better code readability.
  • Avoid logging sensitive information and consider using placeholders.
  • Refactor to eliminate redundant context copying and ensure consistent parameter naming in function calls.

By addressing the identified issues and implementing the suggested optimizations, the codebase can be improved in terms of clarity, security, and efficiency.

@mergify mergify bot merged commit a0ea7da into matrixorigin:1.1-dev Apr 10, 2024
16 of 18 checks passed
@gouhongshen gouhongshen changed the title fix db not found when mo_table_size sync to 1.1: fix db not found when mo_table_size Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working size/S Denotes a PR that changes [10,99] lines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants