-
Notifications
You must be signed in to change notification settings - Fork 40
Backport to branch(3.13) : Add JDBC database permission test (Part 2) #2943
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
Conversation
Co-authored-by: Mitsunori Komatsu <[email protected]> Co-authored-by: Toshihiro Suzuki <[email protected]>
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.
Summary of Changes
Hello @feeblefakie, 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 is an automated backport aimed at improving the robustness and compatibility of our JDBC database permission integration tests. The changes primarily focus on enhancing DDL operation handling for specific database systems like Yugabyte and Db2, ensuring tests run reliably across different JDBC backends. It also includes some general refactoring of DDL-related wait mechanisms within the test framework.
Highlights
- JDBC Permission Test Enhancements for Yugabyte: I've introduced a
waitForDdlCompletion()mechanism inJdbcAdminPermissionIntegrationTestandJdbcPermissionIntegrationTestthat includes a 1-second sleep specifically for Yugabyte. This addresses potential schema or catalog version mismatch errors due to DDL operations not being immediately consistent in Yugabyte. - JDBC Permission Test Enhancements for Db2: I've added specific handling for Db2 in
JdbcPermissionTestUtils. User creation and dropping are now skipped for Db2, and thegetGrantPermissionStatementsmethod includesGRANT DBADMandGRANT DATAACCESSstatements for Db2 users. - Refactoring of DDL Wait Methods: I've refactored the DDL waiting logic across the integration test base classes. The
waitForTableCreation()method has been generalized and renamed towaitForDdlCompletion()inCassandraPermissionIntegrationTest,DistributedStorageAdminPermissionIntegrationTestBase, andDistributedStoragePermissionIntegrationTestBaseto provide a more generic wait mechanism for DDL operations. - Minor Test Schema Adjustment: I've updated the test table metadata in
DistributedStorageAdminPermissionIntegrationTestBaseto change the data type ofCOL_NAME3fromTEXTtoINT.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| 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 issue 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 or fill out our survey to provide feedback.
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
-
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. ↩
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 backports permission tests for JDBC databases, adding DB2 support. It refactors waitForTableCreation() to waitForDdlCompletion() and introduces wait logic for DDL propagation in JDBC tests, especially for YugabyteDB. The review identified code duplication in the wait logic across test classes and a data type change that needs verification.
| private void waitForDdlCompletion() { | ||
| if (JdbcTestUtils.isYugabyte(rdbEngine)) { | ||
| // This is needed to avoid schema or catalog version mismatch database errors. | ||
| Uninterruptibles.sleepUninterruptibly(DDL_WAIT_SECONDS, TimeUnit.SECONDS); | ||
| } | ||
| } |
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 logic within waitForDdlCompletion is identical to the implementation in JdbcPermissionIntegrationTest.java. To improve maintainability and avoid code duplication, consider extracting this logic into a shared utility method. A new static method in an existing utility class like JdbcPermissionTestUtils would be a suitable place for it.
| protected void waitForDdlCompletion() { | ||
| if (JdbcTestUtils.isYugabyte(rdbEngine)) { | ||
| // This is needed to avoid schema or catalog version mismatch database errors. | ||
| Uninterruptibles.sleepUninterruptibly(DDL_WAIT_SECONDS, TimeUnit.SECONDS); | ||
| } | ||
| } |
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.
This waitForDdlCompletion method is identical to the one in JdbcAdminPermissionIntegrationTest.java. To avoid code duplication and improve maintainability, consider extracting this logic into a common utility method. For example, a new static method in JdbcPermissionTestUtils could hold the shared logic, which can then be called from both test classes.
| .addColumn(COL_NAME1, DataType.INT) | ||
| .addColumn(COL_NAME2, DataType.TEXT) | ||
| .addColumn(COL_NAME3, DataType.TEXT) | ||
| .addColumn(COL_NAME3, DataType.INT) |
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.
This is an automated backport of the following:
Please merge this PR after all checks have passed.