github-actions[bot] commented on code in PR #63490:
URL: https://github.com/apache/doris/pull/63490#discussion_r3303029847
##########
fe/fe-core/src/main/java/org/apache/doris/job/extensions/insert/streaming/DataSourceConfigValidator.java:
##########
@@ -122,6 +123,45 @@ public static void validateSslVerifyCaPair(Map<String,
String> input) throws Ill
"ssl_mode '" + DataSourceConfigKeys.SSL_MODE_VERIFY_CA
+ "' requires ssl_rootcert to be set");
}
+
+ validateServerIdConfig(input);
+ }
+
+ // Shared by validateSource and the cdc_stream TVF entrypoint so both
reject malformed
+ // server_id at SQL-analysis time, not as a cdc_client runtime error.
+ public static void validateServerIdConfig(Map<String, String> input)
+ throws IllegalArgumentException {
+ String serverIdValue = input.get(DataSourceConfigKeys.SERVER_ID);
+ if (serverIdValue == null) {
+ return;
+ }
+ int[] range = parseServerIdRange(serverIdValue);
+ if (range == null) {
+ throw new IllegalArgumentException(
+ "Invalid value for key '" + DataSourceConfigKeys.SERVER_ID
+ "': "
+ + serverIdValue
+ + ". Expected a single value (e.g. '5400') or
range (e.g. '5400-5408')"
+ + " with start >= 1 and start <= end.");
+ }
+ String parallelismValue = input.getOrDefault(
+ DataSourceConfigKeys.SNAPSHOT_PARALLELISM,
+ DataSourceConfigKeys.SNAPSHOT_PARALLELISM_DEFAULT);
+ Integer parallelism = parsePositiveInt(parallelismValue);
+ if (parallelism == null) {
+ throw new IllegalArgumentException(
+ "Invalid value for key '" +
DataSourceConfigKeys.SNAPSHOT_PARALLELISM
+ + "': " + parallelismValue + ". Expected a
positive integer.");
+ }
+ int width = range[1] - range[0] + 1;
+ // Range must cover every parallel SnapshotSplitReader; cdc_client
throws otherwise.
Review Comment:
This width check is too strict for binlog-only startup modes. For
`offset=latest`, `earliest`, a timestamp, or a specific binlog JSON offset,
`MySqlSourceReader.getSourceSplits()` returns only `BINLOG_SPLIT_ID` and
`getBinlogSplitReader()` creates config for subtask `0`, so a single configured
`server_id` is sufficient even if `snapshot_parallelism` is larger. With the
current validation, a valid job such as `offset=latest`,
`snapshot_parallelism=4`, `server_id=5400` is rejected at CREATE time; the
runtime resolver has the same unconditional width check as well. Please gate
the range-width requirement to `initial`/`snapshot` startup modes, or otherwise
pass the required reader count instead of always using `snapshot_parallelism`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]