alter rmq replicator unnecessary validation - #460
Conversation
| add(ReplicatorConnectorConfig.SRC_ACL_ENABLE); | ||
| add(ReplicatorConnectorConfig.DEST_ACL_ENABLE); | ||
| add(ERRORS_TOLERANCE_CONFIG); | ||
| put(ReplicatorConnectorConfig.SRC_CLOUD, false); |
There was a problem hiding this comment.
If it is not a necessary parameter, can you consider removing it from the verification?
There was a problem hiding this comment.
It is also possible to remove them directly, but it is easier for me to extend or customize them. It would be better to extract the required parameters into a unified public class rather than write them for each connector
There was a problem hiding this comment.
In my opinion, after the connector is implemented, the necessary configuration has been determined. In the subsequent evolution and development, of course, it is possible to challenge the verification rules of these parameters, but it is a very low-frequency operation. For example, we have some differences now. However, after our discussion this time, after confirming those that are indeed required and those that are not, there may be basically no major changes.
I think what you said about unifying the necessary parameters is a good idea. However, each connector implementation may have different validation rules, not only necessary and non-essential parameters. Can you try to tidy up some parameters though? Let's do further discussions on specific parameters?
|
This PR has conflicts with the base branch and cannot be merged. Please rebase or merge the base branch into your branch and resolve the conflicts: git fetch origin
git checkout remove-no-need-param
git rebase origin/main
# resolve conflicts, then:
git push --force-with-leaseThis is a one-time reminder. Feel free to @mention me for a re-review after conflicts are resolved. Automated notification by github-manager-bot |
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
This PR modifies 4 file(s) with 183 lines of diff. No test changes detected — consider adding test coverage.
Automated review by github-manager-bot
| @@ -39,9 +39,9 @@ | |||
| import org.slf4j.LoggerFactory; | |||
There was a problem hiding this comment.
No test changes detected alongside source modifications. Consider adding tests to cover the changes.
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
PR received and logged for review. This PR requires detailed code review by a maintainer.
Diff size: 183 lines
Author: galaxy077 (CONTRIBUTOR)
Automated review by RockteMQ-AI
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
Review of PR #460: alter rmq replicator unnecessary validation
Findings: 4 issue(s) identified (0 critical).
CLA: unknown
Please address the inline comments above.
Automated review by github-manager-bot
| public static void checkNeedParamNotEmpty(String connectorName, KeyValue config, String needParamKey, boolean isNeeded) { | ||
| if (StringUtils.isEmpty(config.getString(needParamKey, "")) && isNeeded) { | ||
| log.error("Replicator connector " + connectorName + " do not set " + needParamKey); | ||
| throw new ParamInvalidException("Replicator connector " + connectorName + " do not set " + needParamKey); |
There was a problem hiding this comment.
The ParamInvalidException message was shortened to only include the param key, dropping the connector name and 'do not set' context. This makes error messages less actionable and is inconsistent with the preceding log.error() call that still logs the full message. Consider keeping the original full exception message.
| public static void checkNeedParams(String connectorName, KeyValue config, Set<String> neededParamKeys) { | ||
| for (String needParamKey : neededParamKeys) { | ||
| checkNeedParamNotEmpty(connectorName, config, needParamKey); | ||
| public static void checkNeedParams(String connectorName, KeyValue config, Map<String, Boolean> neededParamKeys) { |
There was a problem hiding this comment.
The public method signatures of checkNeedParams and checkNeedParamNotEmpty were changed (Set -> Map<String, Boolean> and added boolean parameter). This is a breaking API change for any external callers of these public utility methods. If backward compatibility is required, consider adding overloaded methods that preserve the old signatures.
| public static void checkNeedParamNotEmpty(String connectorName, KeyValue config, String needParamKey) { | ||
| if (StringUtils.isEmpty(config.getString(needParamKey, ""))) { | ||
| public static void checkNeedParamNotEmpty(String connectorName, KeyValue config, String needParamKey, boolean isNeeded) { | ||
| if (StringUtils.isEmpty(config.getString(needParamKey, "")) && isNeeded) { |
There was a problem hiding this comment.
With the new isNeeded flag, configuration parameters marked false skip emptiness validation entirely. Ensure that every parameter marked false truly has a safe runtime default or is genuinely optional; otherwise missing/empty values may cause runtime failures downstream rather than failing fast during validation.
| } | ||
|
|
||
| private Set<String> neededParamKeys = new HashSet<String>() { | ||
| private Map<String, Boolean> neededParamKeys = new HashMap<String, Boolean>() { |
There was a problem hiding this comment.
No test changes are included for the altered validation behavior. Since this changes which configuration keys are required versus optional for the source connector, tests should cover both the required-field rejection path and the newly-optional-field acceptance path.
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
Re-review of PR #460 after new commits. The changes look good — changing Set<String> to Map<String, Boolean> is a clean way to distinguish required vs optional parameters.
Key improvements:
checkNeedParamNotEmpty()now accepts anisNeededflag- Optional parameters (like
SRC_CLOUD,DEST_CLOUD,SRC_ACL_ENABLE) are marked asfalse - Required parameters (like
SRC_ENDPOINT,SRC_TOPICS,SYNC_GIDS) are marked astrue - Removed unnecessary validation for optional fields
Verdict
LGTM. The refactoring is clean and maintains backward compatibility.
Automated review by github-manager-bot
What is the purpose of the change
XXXXX
Brief changelog
XX
Verifying this change
XXXX
Follow this checklist to help us incorporate your contribution quickly and easily. Notice,
it would be helpful if you could finish the following 5 checklist(the last one is not necessary)before request the community to review your PR.[ISSUE #123] Fix UnknownException when host config not exist. Each commit in the pull request should have a meaningful subject line and body.mvn -B clean apache-rat:check findbugs:findbugs checkstyle:checkstyleto make sure basic checks pass. Runmvn clean install -DskipITsto make sure unit-test pass. Runmvn clean test-compile failsafe:integration-testto make sure integration-test pass.