github-actions[bot] commented on code in PR #69673:
URL: https://github.com/apache/doris/pull/69673#discussion_r4488538368
##########
fe/fe-core/src/main/java/org/apache/doris/job/util/StreamingJobUtils.java:
##########
@@ -508,6 +507,24 @@ public static LinkedHashMap<String,
Optional<CreateTableCommand>> generateCreate
}
}
+ public static void validateAndCreateTables(String targetDb, DataSourceType
sourceType,
+ Map<String, String> properties, Map<String, String>
targetProperties,
+ List<String> updatedTables, List<String> addedTables) throws
Exception {
+ Map<String, Optional<CreateTableCommand>> commands =
generateCreateTableCmds(
+ targetDb, sourceType, properties, targetProperties);
+ for (String table : updatedTables) {
+ if (!commands.containsKey(table)) {
+ throw new JobException("Source table does not exist: " +
table);
+ }
+ }
+ for (String table : addedTables) {
+ Optional<CreateTableCommand> command = commands.get(table);
+ if (command.isPresent()) {
Review Comment:
[P1] Reconcile the preserved target schema before re-adding a table
In the supported remove/re-add workflow, remove PostgreSQL `b(id,v)`, add `w
INT DEFAULT 7` upstream while excluded, and let retained `a` commit past that
DDL before re-adding `b`. `generateCreateTableCmds` returns `Optional.empty`
for `b`'s existing target, so this loop leaves its old `(id,v)` schema. The new
JDBC lookup adopts `(id,v,w)` as the source baseline; subsequent PG Relation
messages have no added column relative to that baseline, and T0 is already
after the DDL, so no target ADD is emitted. Snapshot/CDC JSON silently ignores
`w` and the job commits with that column absent. This is distinct from the
existing historical MySQL MODIFY thread: a supported PostgreSQL ADD happened
before T0, and the preserved target remains obsolete. Reconcile supported
schema differences, or reject the incompatible target, before publishing the
addition; cover remove/schema-change/re-add in a regression.
--
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]