fix:add check transcation after new db#34175
Conversation
…ansactions after database creation
Summary of ChangesHello @tomchon, 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 enhances the test framework by introducing a robust mechanism to verify that all database transactions are cleared following the creation of a new database. This is achieved through a new utility function that actively waits for transaction completion, which is then integrated into the database creation process. Additionally, a relevant test case has been activated in the CI pipeline to leverage this new functionality. 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.
Code Review
This pull request aims to fix a race condition by waiting for transactions to complete after creating a database. The approach is sound, but there are a couple of areas for improvement.
The new waitTransactionZeroWithTsql method should be made more robust by explicitly handling timeouts to prevent silent test failures. I've provided a suggestion to improve its implementation.
More critically, the new test case enabled in this PR (test_tmq_snapshot_basic.py) does not actually use the new fix. It calls tdCom.create_database instead of tmqCom.create_database, so the waiting logic is never executed for this test. This needs to be corrected to ensure the fix is effective and properly tested.
Lastly, there's a small typo in the pull request title ('transcation' should be 'transaction').
There was a problem hiding this comment.
Pull request overview
This PR adds a transaction monitoring mechanism to ensure transactions complete before proceeding after database creation. The title contains a spelling error: "transcation" should be "transaction".
Key Changes:
- Introduces
waitTransactionZeroWithTsqlmethod to poll for zero active transactions - Integrates the transaction check into the
create_databasemethod - Enables a previously commented-out test case for TMQ snapshot functionality
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| test/new_test_framework/utils/tmqUtil.py | Adds transaction wait utility method and integrates it into database creation to ensure clean state |
| test/ci/win_cases.task | Uncomments and updates test case from tmqConsFromTsdb to test_tmq_snapshot_basic.py |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…out and improve transaction checking logic
…use td_sql and improve error handling
…or transaction checking
…ction checking function name
…eadability and consistency
…es within a timeout
https://project.feishu.cn/taosdata_td/defect/detail/6467995692