-
Notifications
You must be signed in to change notification settings - Fork 5k
enh: stt file load perfermance #34195
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
base: 3.0
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @facetosea, 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 focuses on enhancing the performance of STT file loading by optimizing array initialization. It introduces a new utility function, Highlights
🧠 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. Using Gemini Code AssistThe 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
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 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
|
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.
Code Review
This pull request introduces a new function taosArrayAddZeroData to optimize the loading of STT files by adding multiple zero-initialized elements to an array more efficiently than repeated pushes. While the performance improvement is a good goal, I've found a few critical issues.
The new function taosArrayAddZeroData has a bug where it doesn't actually zero-initialize the new array elements, which could lead to undefined behavior. Additionally, the error checking for this new function in tsdbMergeTree.c is incorrect, using a stale pointer for validation. I've also pointed out an issue with the documentation for the new function.
Please address these correctness and maintainability issues. Also, note the typo in the pull request title ("perfermance" should be "performance").
| /** | ||
| * | ||
| * @param pArray | ||
| * @param pData | ||
| * @param nEles | ||
| * @return | ||
| */ |
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.
The Doxygen comment for the new function taosArrayAddZeroData is incorrect. It seems to be copied from another function, as it references a @param pData which is not a parameter of this function. The comment should accurately describe the function's purpose, parameters, and return value.
/**
* @brief Add nEles zero-initialized elements to the array.
* @param pArray The array to add elements to.
* @param nEles The number of elements to add.
* @return 0 on success, or an error code otherwise.
*/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.
Pull request overview
This PR aims to improve STT (Sorted Time-series Table) file load performance by optimizing the addition of zero-initialized elements to arrays. However, the implementation contains critical bugs that will prevent it from working correctly.
Key Changes:
- Added new function
taosArrayAddZeroData()to add zero-initialized elements to arrays without a loop - Replaced manual loops that pushed zero-initialized
SValuestructs with calls to the new function - Added function declaration in the public header file
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| include/util/tarray.h | Adds declaration for new taosArrayAddZeroData() function with incomplete documentation |
| source/util/src/tarray.c | Implements taosArrayAddZeroData() but fails to zero-initialize memory |
| source/dnode/vnode/src/tsdb/tsdbMergeTree.c | Replaces loops with calls to taosArrayAddZeroData() but uses incorrect error checking macros |
Critical Issues Identified:
- The new
taosArrayAddZeroData()function does not actually zero the memory - it only reserves space - Error handling uses
TSDB_CHECK_NULL(px, ...)butpxis no longer defined after the refactor - The function should use
TSDB_CHECK_CODEmacro instead since it returns an error code, not a pointer
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Description
Issue(s)
Checklist
Please check the items in the checklist if applicable.