-
Notifications
You must be signed in to change notification settings - Fork 40
Add --replication-tables option to the Schema Loader
#2747
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
--replication-tables option--replication-tables option to the Schema Loader
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 introduces a new option (--replication-tables) to manage replication-related tables. The changes update the schema loader command and related API methods to accept an additional boolean flag for replication tables, add corresponding tests, and update the replication administration interface.
- Added new boolean parameters and option handling for replication tables in SchemaLoader and SchemaOperator.
- Extended command-line tests to validate the new option in various table creation, deletion, and repair scenarios.
- Removed confusing default implementations in ReplicationAdmin to allow overwriting.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| schema-loader/src/test/java/com/scalar/db/schemaloader/command/SchemaLoaderCommandTest.java | Updated tests to include replication tables flag in command execution and verification. |
| schema-loader/src/test/java/com/scalar/db/schemaloader/SchemaOperatorTest.java | Added unit tests for replication table creation, dropping, and repair. |
| schema-loader/src/main/java/com/scalar/db/schemaloader/command/SchemaLoaderCommand.java | Modified command options and subsequent method calls to pass the replication tables flag. |
| schema-loader/src/main/java/com/scalar/db/schemaloader/SchemaOperator.java | Introduced new methods for creating, dropping, and repairing replication tables. |
| schema-loader/src/main/java/com/scalar/db/schemaloader/SchemaLoader.java | Overloaded several methods to accept an extra replication tables flag and updated documentation accordingly. |
| schema-loader/build.gradle | Added a new test dependency for parameterized tests. |
| core/src/main/java/com/scalar/db/api/ReplicationAdmin.java | Removed default implementations for replication tables, replacing them with exceptions. |
Comments suppressed due to low confidence (2)
schema-loader/src/main/java/com/scalar/db/schemaloader/SchemaLoader.java:107
- [nitpick] Consider encapsulating the boolean flags for coordinator and replication table creation into a dedicated options object. This can improve readability and future extensibility of the API.
boolean createCoordinatorTables, boolean createReplicationTables)
core/src/main/java/com/scalar/db/api/ReplicationAdmin.java:33
- [nitpick] It may be beneficial to update the Javadoc or inline comments to clearly indicate that the replication feature is not enabled by default, explaining the rationale behind throwing an UnsupportedOperationException.
throw new UnsupportedOperationException(CoreError.REPLICATION_NOT_ENABLED.buildMessage());
| */ | ||
| default void createReplicationTables(boolean ifNotExist, Map<String, String> options) | ||
| throws ExecutionException { | ||
| if (ifNotExist && replicationTablesExist()) { |
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.
Replaced confusing logics with simply throwing an exception.
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.
LGTM! Thank you!
brfrn169
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.
Left a comment. Other than that, LGTM! Thank you!
| return; | ||
| } | ||
| createReplicationTables(options); | ||
| throw new UnsupportedOperationException(CoreError.REPLICATION_NOT_ENABLED.buildMessage()); |
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.
Shouldn’t we revise the error message itself now that we’ve determined the license type?
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.
Addressed it in 68751db
Description
This PR adds
--replication-tablesoption to manage the replication related tables as well as--coordinatoroption for the coordinator tables. I first tried to add--replicationoption, but noticed--replication-factorexisted. So, I added--replication-tablesinstead.Related issues and/or PRs
None
Changes made
--replication-tablesoption.createReplicationTables(),dropReplicationTables()andrepairReplicationTables()toSchemaOperator.SchemaLoaderif--replication-tablesis specified.ReplicationAdmininterface since they can be easily overwritten.Checklist
Additional notes (optional)
None
Release notes
Added
replication-tablesoption to the Schema Loader.