Skip to content

Conversation

@KodaiD
Copy link
Contributor

@KodaiD KodaiD commented Jul 31, 2025

Description

This PR adds a permission test for MariaDB, YugabyteDB and Db2 under ScalarDB. To check what permissions are required for all ScalarDB operations, all DistributedStorage and DistributedStorageAdmin methods are tested. This is a final step of the permission tests project.

Related issues and/or PRs

The PRs for other permission tests:

Dependent bug-fix PRs:

Changes made

  • Added a new integration test for the implementations of DistributedStorage in JDBC adapter with MariaDB, YugabyteDB and Db2 engines.
  • Added a new integration test for the implementations of DistributedStorageAdmin in JDBC adapter with MariaDB, YugabyteDB and Db2 engines.
  • Updated a GitHub Action workflow to run the JDBC database permission tests.

Checklist

  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation to reflect the changes.
  • I have considered whether similar issues could occur in other products, components, or modules if this PR is for bug fixes.
  • Any remaining open issues linked to this PR are documented and up-to-date (Jira, GitHub, etc.).
  • Tests (unit, integration, etc.) have been added for the changes.
  • My changes generate no new warnings.
  • Any dependent changes in other PRs have been merged and published.

Additional notes (optional)

N/A

Release notes

N/A

@KodaiD KodaiD self-assigned this Jul 31, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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 @KodaiD, 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 marks the completion of the permission testing project for ScalarDB's JDBC adapter. It introduces extensive integration tests to validate the required permissions for all DistributedStorage and DistributedStorageAdmin operations across MariaDB, YugabyteDB, and Db2, ensuring robust security and functionality for these database systems. The changes also include necessary adaptations and refinements to the test infrastructure to support these new tests.

Highlights

  • New JDBC Permission Integration Tests: I've added comprehensive integration tests for the JDBC adapter's DistributedStorage and DistributedStorageAdmin methods. These tests specifically target MariaDB, YugabyteDB, and Db2 to ensure all necessary permissions for ScalarDB operations are properly verified.
  • YugabyteDB DDL Synchronization: To address potential schema or catalog version mismatch errors in YugabyteDB during DDL operations, I've introduced explicit wait mechanisms (1-second sleeps) after DDL commands in the JDBC permission tests. This helps ensure consistency across test runs.
  • Db2 Specific Adaptations: The JdbcPermissionTestUtils now conditionally skips user creation and dropping for Db2, as these operations are not supported via the utility for this database. Additionally, I've added specific GRANT DBADM and GRANT DATAACCESS statements for Db2 to ensure proper permission assignment. The RdbEngineDb2 implementation has also been updated to correctly handle CREATE INDEX and DROP INDEX SQL with schema inclusion.
  • Test Base Class Refinements: I've generalized the DDL waiting methods in DistributedStoragePermissionIntegrationTestBase and CassandraPermissionIntegrationTest from waitForTableCreation to waitForDdlCompletion. This provides a more generic and applicable mechanism for waiting on DDL operations to complete across different database types.
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

  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.

@KodaiD KodaiD requested a review from Copilot July 31, 2025 08:58
Copy link
Contributor

Copilot AI left a 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 adds comprehensive JDBC database permission tests for MariaDB, YugabyteDB, and Db2 engines as the final step of the permission tests project. The tests verify that all required database permissions are properly configured for ScalarDB operations by testing all DistributedStorage and DistributedStorageAdmin methods.

Key changes include:

  • Integration of permission tests for three additional JDBC database engines (MariaDB, YugabyteDB, Db2)
  • Enhanced test base classes with DDL completion waiting mechanisms
  • Database-specific permission handling and SQL generation improvements

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
DistributedStoragePermissionIntegrationTestBase.java Renamed method and added DDL wait call after table truncation
DistributedStorageAdminPermissionIntegrationTestBase.java Changed column data type from TEXT to INT
RdbEngineDb2.java Added createIndexSql method and fixed dropIndexSql to include schema
JdbcPermissionTestUtils.java Added Db2-specific permission handling and DDL wait constant
JdbcPermissionIntegrationTest.java Added Yugabyte-specific DDL completion waiting
JdbcAdminPermissionIntegrationTest.java Added comprehensive DDL completion waiting for all operations
CassandraPermissionIntegrationTest.java Updated method name to match base class change
permission-check.yaml Added CI workflows for MariaDB, YugabyteDB, and Db2 permission testing

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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 extends the JDBC database permission tests to include MariaDB, YugabyteDB, and Db2. The changes involve adding new integration tests, updating the test infrastructure to handle database-specific behaviors (like waits for YugabyteDB and special user management for Db2), and fixing SQL generation for Db2. The overall changes are solid, but I've identified a couple of areas with code duplication that could be refactored to improve maintainability.

@KodaiD KodaiD force-pushed the jdbc-permission-test-part-2 branch from af05593 to f20f767 Compare July 31, 2025 11:26
@KodaiD KodaiD marked this pull request as ready for review July 31, 2025 23:33
@KodaiD KodaiD requested review from a team, Torch3333, brfrn169, feeblefakie and komamitsu and removed request for a team July 31, 2025 23:33
Copy link
Collaborator

@brfrn169 brfrn169 left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you!

@KodaiD KodaiD requested a review from komamitsu August 1, 2025 06:20
Copy link
Contributor

@komamitsu komamitsu left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

Copy link
Contributor

@feeblefakie feeblefakie left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you!

Copy link
Contributor

@Torch3333 Torch3333 left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@KodaiD KodaiD merged commit 67b466c into master Aug 5, 2025
105 of 108 checks passed
@KodaiD KodaiD deleted the jdbc-permission-test-part-2 branch August 5, 2025 01:45
feeblefakie pushed a commit that referenced this pull request Aug 5, 2025
Co-authored-by: Mitsunori Komatsu <[email protected]>
Co-authored-by: Toshihiro Suzuki <[email protected]>
feeblefakie pushed a commit that referenced this pull request Aug 5, 2025
Co-authored-by: Mitsunori Komatsu <[email protected]>
Co-authored-by: Toshihiro Suzuki <[email protected]>
feeblefakie pushed a commit that referenced this pull request Aug 5, 2025
Co-authored-by: Mitsunori Komatsu <[email protected]>
Co-authored-by: Toshihiro Suzuki <[email protected]>
feeblefakie pushed a commit that referenced this pull request Aug 5, 2025
Co-authored-by: Mitsunori Komatsu <[email protected]>
Co-authored-by: Toshihiro Suzuki <[email protected]>
feeblefakie pushed a commit that referenced this pull request Aug 5, 2025
Co-authored-by: Mitsunori Komatsu <[email protected]>
Co-authored-by: Toshihiro Suzuki <[email protected]>
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.

5 participants