github-actions[bot] commented on code in PR #62490:
URL: https://github.com/apache/doris/pull/62490#discussion_r3086051977
##########
fe/fe-core/src/main/java/org/apache/doris/job/offset/jdbc/JdbcSourceOffsetProvider.java:
##########
@@ -360,10 +362,33 @@ public Offset deserializeOffset(String offset) {
@Override
public Offset deserializeOffsetProperty(String offset) {
- // no need cause cdc_stream has offset property
+ if (offset == null || offset.trim().isEmpty()) {
+ return null;
+ }
+ // JSON format: {"file":"binlog.000003","pos":154} or {"lsn":"123456"}
+ if (DataSourceConfigValidator.isJsonOffset(offset)) {
+ try {
+ Map<String, String> offsetMap = objectMapper.readValue(offset,
+ new TypeReference<Map<String, String>>() {});
+ return new JdbcOffset(Collections.singletonList(new
BinlogSplit(offsetMap)));
Review Comment:
This now accepts any JSON object as a valid JDBC offset and turns it into a
non-empty `JdbcOffset`. That means FE-side validation will accept values like
`{'lsn':'123'}` for MySQL or `{'file':'binlog.000001','pos':'4'}` for
PostgreSQL, even though `MySqlSourceReader.generateMySqlConfig()` and
`PostgresSourceReader.generatePostgresConfig()` only support source-specific
shapes. The result is that malformed offsets pass DDL-time validation and then
fail later when the job executes. Please validate the JSON schema here (or in
`DataSourceConfigValidator`) against `sourceType` instead of only checking
`isJsonOffset()`.
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/AlterJobCommand.java:
##########
@@ -166,7 +166,8 @@ private void validate() throws Exception {
boolean sourcePropModified =
isPropertiesModified(streamingJob.getSourceProperties(),
this.getSourceProperties());
if (sourcePropModified) {
-
DataSourceConfigValidator.validateSource(this.getSourceProperties());
+
DataSourceConfigValidator.validateSource(this.getSourceProperties(),
Review Comment:
Allowing `sourceProperties.offset` through this path is misleading today,
because the new offset is never applied to the running provider state. In
`StreamingInsertJob.alterJob()` the source-properties branch only does
`this.sourceProperties.putAll(...)`; it does **not** call `validateOffset()`,
`offsetProvider.updateOffset()`, persist `offsetProviderPersist`, or reset
cloud progress. On resume, `StreamingMultiTblTask.before()` still asks
`offsetProvider.getNextOffset(...)`, and
`JdbcSourceOffsetProvider.getNextOffset()` will keep returning the old
`currentOffset`. So `ALTER JOB ... FROM MYSQL/POSTGRES (... 'offset'=...)`
appears to succeed but the job resumes from the previous position. Please
either reject offset changes in the `FROM ... TO ...` alter syntax, or route
them through the same update path as `PROPERTIES('offset'=...)`.
--
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]