-
Notifications
You must be signed in to change notification settings - Fork 40
Refactor JdbcAdmin (Part 2) #3157
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
Summary of ChangesHello @brfrn169, 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 continues the refactoring of the Highlights
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 continues the refactoring of JdbcAdmin. The main changes are adjusting the timing of metadata schema creation to be lazy and renaming tableExistsInternal() to internalTableExists() for better clarity. The changes look good and improve the code structure. I've found a minor issue in the test updates for SQLite where the mocking seems incorrect. Please see my detailed comment.
core/src/test/java/com/scalar/db/storage/jdbc/JdbcAdminTest.java
Outdated
Show resolved
Hide resolved
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 continues the refactoring of JdbcAdmin by improving the structure and timing of metadata schema management, and renaming a method for better clarity.
- Renamed
tableExistsInternal()tointernalTableExists()for improved naming consistency - Moved metadata schema creation responsibility from
NamespaceMetadataServicetoJdbcAdminlevel for better separation of concerns - Adjusted metadata schema deletion to occur at the
JdbcAdminlevel after namespace operations
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| core/src/main/java/com/scalar/db/storage/jdbc/JdbcAdmin.java | Added createMetadataSchemaIfNotExists() and deleteMetadataSchemaIfEmpty() methods; renamed tableExistsInternal() to internalTableExists(); added metadata schema creation calls before operations that require it |
| core/src/main/java/com/scalar/db/storage/jdbc/NamespaceMetadataService.java | Removed metadata schema creation and deletion logic, now handled at JdbcAdmin level; renamed tableExistsInternal() to internalTableExists() |
| core/src/main/java/com/scalar/db/storage/jdbc/TableMetadataService.java | Renamed tableExistsInternal() to internalTableExists() |
| core/src/main/java/com/scalar/db/storage/jdbc/RdbEngineStrategy.java | Renamed interface method tableExistsInternalTableCheckSql() to internalTableExistsCheckSql() |
| core/src/main/java/com/scalar/db/storage/jdbc/RdbEngineMysql.java | Renamed method tableExistsInternalTableCheckSql() to internalTableExistsCheckSql() |
| core/src/main/java/com/scalar/db/storage/jdbc/RdbEnginePostgresql.java | Renamed method tableExistsInternalTableCheckSql() to internalTableExistsCheckSql() |
| core/src/main/java/com/scalar/db/storage/jdbc/RdbEngineOracle.java | Renamed method tableExistsInternalTableCheckSql() to internalTableExistsCheckSql() |
| core/src/main/java/com/scalar/db/storage/jdbc/RdbEngineSqlServer.java | Renamed method tableExistsInternalTableCheckSql() to internalTableExistsCheckSql() |
| core/src/main/java/com/scalar/db/storage/jdbc/RdbEngineSqlite.java | Renamed method tableExistsInternalTableCheckSql() to internalTableExistsCheckSql() |
| core/src/main/java/com/scalar/db/storage/jdbc/RdbEngineDb2.java | Renamed method tableExistsInternalTableCheckSql() to internalTableExistsCheckSql() |
| core/src/main/java/com/scalar/db/storage/dynamo/DynamoAdmin.java | Renamed method tableExistsInternal() to internalTableExists() for consistency |
| core/src/test/java/com/scalar/db/storage/jdbc/JdbcAdminTest.java | Updated test parameter ordering to match new execution flow; added mocks for metadata schema operations; removed obsolete metadata schema creation mocks from createNamespacesTableIfNotExists tests |
| core/src/integration-test/java/com/scalar/db/storage/jdbc/JdbcAdminTestUtils.java | Updated to use renamed method internalTableExistsCheckSql() |
| core/src/integration-test/java/com/scalar/db/storage/multistorage/MultiStorageAdminTestUtils.java | Updated to use renamed method internalTableExistsCheckSql() |
Comments suppressed due to low confidence (1)
core/src/test/java/com/scalar/db/storage/jdbc/JdbcAdminTest.java:3974
- This Statement is not always closed on method exit.
verify(adminSpy).createNamespacesTableIfNotExists(connection);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Torch3333
left a comment
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.
LGTM, thank you!
feeblefakie
left a comment
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 code looks good, so I'm approving it.
But, can you clarify the reason for the changes?
komamitsu
left a comment
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.
LGTM 👍 other than @feeblefakie's comment.
Description
This PR continues the refactoring of
JdbcAdmin(following #3121).Related issues and/or PRs
Changes made
tableExistsInternal()tointernalTableExists().Checklist
Additional notes (optional)
N/A
Release notes
N/A