Skip to content

enh(grant): timeseries calculation excluding system tables - #34767

Merged
guanshengliang merged 14 commits into
mainfrom
enh/TS-6672169603-main
Mar 16, 2026
Merged

guanshengliang merged 14 commits into
mainfrom
enh/TS-6672169603-main

Conversation

@kailixu

@kailixu kailixu commented Mar 13, 2026

Copy link
Copy Markdown
Contributor

Description

Issue(s)

  • Close/close/Fix/fix/Resolve/resolve: Issue Link

Checklist

Please check the items in the checklist if applicable.

  • Is the user manual updated?
  • Are the test cases passed and automated?
  • Is there no significant decrease in test coverage?

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refines the timeseries calculation for the SHOW GRANTS command by implementing logic to exclude system tables found in log and audit databases. It also introduces a new restriction on database naming for audit databases and updates the internal lists of system tables. These changes aim to provide more accurate and relevant timeseries metrics by focusing on user-generated data, while a new comprehensive test suite validates the exclusion behavior.

Highlights

  • Timeseries Calculation Exclusion: System tables within 'log' and 'audit' databases are now excluded from timeseries calculations, ensuring that 'SHOW GRANTS' accurately reflects user-defined data points.
  • New Database Creation Restriction: A new validation prevents the creation of a database named 'log' when it is intended to be an audit database, avoiding potential conflicts or misconfigurations.
  • Expanded System Table List: The internal list of system tables (tkLogStb) has been significantly expanded to include many new system-related tables, ensuring broader exclusion from timeseries counts.
  • Enhanced Audit Database Identification: The logic for identifying audit databases has been improved to consider not only the database name but also an explicit isAudit flag in the vnode configuration.
  • New Test Case for Exclusion Logic: A dedicated Python test file (test_grant_basic.py) has been added to thoroughly verify the correct exclusion of system tables from timeseries counts in various scenarios.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • source/dnode/mnode/impl/src/mndDb.c
    • Added a check to prevent creating a database named 'log' within an audit database.
  • source/dnode/vnode/src/meta/metaCache.c
    • Updated audit database identification to include an isAudit configuration flag.
  • source/dnode/vnode/src/vnd/vnodeQuery.c
    • Expanded the tkLogStb array with numerous new system table names to be excluded from timeseries calculations.
    • Modified the condition for identifying audit system tables in vnodeGetTimeSeriesBlackList to include databases explicitly marked as isAudit.
  • test/cases/32-Grants/test_grant_basic.py
    • Added a new test file to verify the correct exclusion of system tables from timeseries counts in log and audit databases.
  • test/cases/uncatalog/system-test/0-others/test_grant.py
    • Moved the s5_check_timeseries_exclude_systable test function to a new dedicated test file.
    • Updated the test_grant method to call the new s5_check_timeseries_exclude_systable function.
  • test/ci/cases.task
    • Added the new test_grant_basic.py to the CI test suite under the 32-Grants category.
Activity
  • The pull request was created by kailixu, focusing on enhancing timeseries calculation for grants by excluding system tables.
  • Core database logic in mndDb.c, metaCache.c, and vnodeQuery.c was modified to implement the exclusion and related restrictions.
  • A new Python test file test_grant_basic.py was introduced to validate the updated timeseries exclusion behavior.
  • The CI configuration was updated to include the new test case.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request enhances the timeseries calculation by excluding system tables in log and audit databases. The changes in the C code correctly identify these system databases and tables. A new comprehensive test file is added to verify this functionality, which is a great addition. I've found a few issues in the new test file, including a bug in an exception message, a security best practice violation, and a maintainability issue with a very long line of code. Please see my detailed comments.

Comment thread test/cases/32-Grants/test_grant_basic.py Outdated
Comment thread test/cases/32-Grants/test_grant_basic.py Outdated
Comment thread test/cases/32-Grants/test_grant_basic.py Outdated
@kailixu kailixu changed the title enh(grant): timeseries calculation excluding system tables[manual only] enh(grant): timeseries calculation excluding system tables Mar 13, 2026
@guanshengliang
guanshengliang merged commit d4f0019 into main Mar 16, 2026
11 of 12 checks passed
@guanshengliang
guanshengliang deleted the enh/TS-6672169603-main branch March 16, 2026 01:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants