-
Notifications
You must be signed in to change notification settings - Fork 474
[flink] Refactor CALL procedure "sys.xxx_cluster_config" to support multiple conifg keys #2279
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
base: main
Are you sure you want to change the base?
Conversation
ff5c87d to
5c54a55
Compare
|
@platinumhamburg could you help to review this? |
|
Besides, the coverage reports error. |
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 refactors Flink procedure APIs to support multiple configuration keys in a single call. The changes rename procedures from singular (sys.set_cluster_config, sys.get_cluster_config) to plural forms (sys.set_cluster_configs, sys.get_cluster_configs) and introduce a new sys.reset_cluster_configs procedure to separate the reset functionality.
Key changes:
- Refactored procedures to use varargs, enabling multiple config keys/pairs in single calls
- Split delete/reset functionality from
set_cluster_configinto a dedicatedreset_cluster_configsprocedure - Updated all procedure names to plural forms for consistency
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| FlinkProcedureITCase.java | Updated test cases to use renamed procedures and added coverage for multi-config operations |
| SetClusterConfigsProcedure.java | Refactored to accept varargs for config key-value pairs, enabling setting multiple configs at once |
| ResetClusterConfigsProcedure.java | New procedure dedicated to resetting/deleting multiple cluster configurations |
| GetClusterConfigsProcedure.java | Enhanced to retrieve multiple specific configurations using varargs |
| ProcedureManager.java | Updated procedure registrations to reflect renamed and new procedures |
Comments suppressed due to low confidence (5)
fluss-flink/fluss-flink-common/src/main/java/org/apache/fluss/flink/procedure/SetClusterConfigsProcedure.java:32
- The documentation mentions that this procedure can "set or delete cluster configuration dynamically", but the delete functionality has been moved to a separate procedure (reset_cluster_configs). This comment should be updated to only mention "set" to reflect the actual functionality.
fluss-flink/fluss-flink-common/src/main/java/org/apache/fluss/flink/procedure/SetClusterConfigsProcedure.java:54 - The documentation states that empty string ('') can be used to delete a configuration, but this functionality has been moved to the reset_cluster_configs procedure. This example should be removed or updated to clarify that resetting should be done via the reset_cluster_configs procedure.
fluss-flink/fluss-flink-common/src/main/java/org/apache/fluss/flink/procedure/SetClusterConfigsProcedure.java:51 - Missing space after the comma in the example. Should be: 'CALL sys.set_cluster_configs('kv.rocksdb.shared-rate-limiter.bytes-per-sec', '200MB', 'datalake.format', 'paimon');'
fluss-flink/fluss-flink-common/src/main/java/org/apache/fluss/flink/procedure/SetClusterConfigsProcedure.java:72 - The error message should use "configuration pairs" (plural) instead of "configuration pairs." to be consistent with other error messages in the procedure. Consider: "Please specify valid configuration pairs."
fluss-flink/fluss-flink-common/src/main/java/org/apache/fluss/flink/procedure/SetClusterConfigsProcedure.java:78 - The error message should use "configuration pairs" (plural) instead of "configuration pairs." to be consistent. Consider: "Please specify valid configuration pairs."
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| .await()) | ||
| .rootCause() | ||
| .hasMessageContaining( | ||
| "config_pairs must be set in pairs. Please specify a valid configuration pairs."); |
Copilot
AI
Jan 4, 2026
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 expected error message uses "configuration pairs." with a period before the end quote, but this should be "configuration pairs" without the period for proper grammar. The period should only appear after the closing quote in a sentence.
| "config_pairs must be set in pairs. Please specify a valid configuration pairs."); | |
| "config_pairs must be set in pairs. Please specify valid \"configuration pairs\"."); |
| * CALL sys.reset_cluster_configs('kv.rocksdb.shared-rate-limiter.bytes-per-sec'); | ||
| * | ||
| * -- reset multiple configurations at one time | ||
| * CALL sys.reset_cluster_configs('kv.rocksdb.shared-rate-limiter.bytes-per-sec','datalake.format'); |
Copilot
AI
Jan 4, 2026
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.
Missing space after the comma in the example. Should be: 'CALL sys.reset_cluster_configs('kv.rocksdb.shared-rate-limiter.bytes-per-sec', 'datalake.format');'
| * CALL sys.reset_cluster_configs('kv.rocksdb.shared-rate-limiter.bytes-per-sec','datalake.format'); | |
| * CALL sys.reset_cluster_configs('kv.rocksdb.shared-rate-limiter.bytes-per-sec', 'datalake.format'); |
| if (configKey.isEmpty()) { | ||
| throw new IllegalArgumentException( | ||
| "Config key cannot be null or empty. " | ||
| + "Please specify valid configuration key."); |
Copilot
AI
Jan 4, 2026
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 error message should say "a valid configuration key" (singular) instead of "valid configuration key" to be grammatically correct and consistent with similar error messages in the codebase.
| + "Please specify valid configuration key."); | |
| + "Please specify a valid configuration key."); |
| // Validate config key | ||
| if (configKeys.length == 0) { | ||
| throw new IllegalArgumentException( | ||
| "config_pairs cannot be null or empty. " |
Copilot
AI
Jan 4, 2026
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 error message mentions "config_pairs" but should mention "config_keys" to match the parameter name used in this procedure. The parameter is named "config_keys" in the @ArgumentHint annotation.
| "config_pairs cannot be null or empty. " | |
| "config_keys cannot be null or empty. " |
Sure, I'll review this PR. |
|
@platinumhamburg |
platinumhamburg
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.
@sd4324530 This PR LGTM overall. I have a few minor suggestions, and additionally, the documentation should be updated accordingly based on the changes in this PR.
|
|
||
| @Test | ||
| void testGetClusterConfig() throws Exception { | ||
| void testGetClusterConfigs() throws Exception { |
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.
Need to enrich this case by covering scenarios, including:
- retrieval of multiple configurations
- some configurations do not exist.
| * -- Delete a configuration (reset to default) | ||
| * CALL sys.set_cluster_config('kv.rocksdb.shared-rate-limiter.bytes-per-sec', NULL); | ||
| * CALL sys.set_cluster_config('kv.rocksdb.shared-rate-limiter.bytes-per-sec', ''); | ||
| * CALL sys.set_cluster_configs('kv.rocksdb.shared-rate-limiter.bytes-per-sec', ''); |
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.
Remove, not supported.
| "Successfully %s configuration '%s'. " | ||
| + "The change is persisted in ZooKeeper and applied to all servers.", | ||
| operationDesc, configKey) | ||
| resultMessage + "The change is persisted in ZooKeeper and applied to all servers." |
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 current resultMessage aggregates the processing results of all requests into a single line, resulting in poor readability. Since the return value supports returning a String[], please refactor the code to improve readability.
| * <p>This procedure allows modifying dynamic cluster configurations. The changes are: | ||
| * | ||
| * <ul> | ||
| * <li>Validated by the CoordinatorServer before persistence |
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 comment description should be updated. In theory, an operation like "Reset to default value" should always succeed, as the default value should be a valid one.
| * | ||
| * </pre> | ||
| * | ||
| * <p><b>Note:</b> Not all configurations support dynamic changes. The server will validate the |
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.
ditto
| admin.alterClusterConfigs(configList).get(); | ||
|
|
||
| return new String[] { | ||
| resultMessage + "The change is persisted in ZooKeeper and applied to all servers." |
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.
Ditto, optimize the returned message—do not aggregate responses from all requests into a single line.
|
|
||
| @Test | ||
| void testSetClusterConfigValidation() throws Exception { | ||
| // Try to set an invalid config (not allowed for dynamic change) |
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.
Need to enrich the test scenarios covered in this test case, including:
- No parameters passed;
- Mismatched key-value pairs in the input parameters.
216ae0d to
5883c0a
Compare
|
@platinumhamburg |
@sd4324530 No worries—this is actually expected behavior. When you revert to an earlier commit and resubmit, Git (and GitHub) determine whether a file is "renamed" or "deleted + added" based on content similarity. If the new version of SetClusterConfigProcedure differs significantly from the original (i.e., less than 50% of the lines are unchanged), Git treats it as a deletion of the old file and creation of a new one, rather than a rename. So even though you reverted and resubmitted, the system still shows it as deleted because the content similarity fell below the threshold. Overall, this aligns with how Git’s rename detection works. |
|
|
||
| **Important Notes:** | ||
|
|
||
| - Changes are validated before being applied and persisted in ZooKeeper |
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 description here is still a bit odd, because the user isn't trying to set a new value—they're simply reverting to the default configuration, which should always be valid.
|
|
||
| - Changes are validated before being applied and persisted in ZooKeeper | ||
| - Changes are automatically applied to all servers (Coordinator and TabletServers) | ||
| - Changes survive server restarts |
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 short description would be better placed in the set_cluster_configs section.
| .await()) | ||
| .rootCause() | ||
| .hasMessageContaining( | ||
| "The config key invalid.config.key is not allowed to be changed dynamically"); |
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.
An invalid (non-existent) key and a key that isn't allowed to be set dynamically are two distinct error cases. The current error message can be misleading. If we prefer not to complicate the validation logic, we could instead use "or" in the error message to cover both scenarios explicitly.
…conifg keys Signed-off-by: Pei Yu <[email protected]>
…conifg keys Signed-off-by: Pei Yu <[email protected]>
Signed-off-by: Pei Yu <[email protected]>
f48d7e1 to
55e31bd
Compare
| String.format( | ||
| "The config key %s is not allowed to be changed dynamically.", | ||
| "The config key %s is not allowed to be changed dynamically or invalid (non-existent).", | ||
| configPropName)); |
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.
@sd4324530 Sorry, you misunderstood my point. What I meant was that, from a testing perspective, the exposed error message doesn't accurately reflect the underlying issue (and indeed, this wasn't introduced by your PR). I don't recommend simply modifying the error message thrown in DynamicConfigManager.java to meet the requirement, as this wouldn't actually address the root problem—that the validation error messages aren't properly categorized. If you don't intend to fix this issue now, I suggest converting the comment into a TODO note explaining the situation and reverting the changes made in DynamicConfigManager.java.
Additionally, I think the PR is overall quite mature and, after addressing these minor adjustments, it should be ready to move into the final review stage.
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.
@platinumhamburg Okay, I think this issue might require a design adjustment to DynamicConfigManager.alterConfigs.
Signed-off-by: peiyu <[email protected]>
Purpose
Linked issue: close #2270
Brief change log
Refactor CALL procedure "sys.xxx_cluster_config" to support multiple conifg keys