github-actions[bot] commented on code in PR #69673:
URL: https://github.com/apache/doris/pull/69673#discussion_r4663769426
##########
fe/fe-core/src/main/java/org/apache/doris/job/offset/jdbc/JdbcSourceOffsetProvider.java:
##########
@@ -176,7 +237,12 @@ public Offset getNextOffset(StreamingJobProperties
jobProps, Map<String, String>
List<SnapshotSplit> snapshotSplits = new
ArrayList<>(remainingSplits.subList(0, splitsNum));
nextOffset.setSplits(snapshotSplits);
return nextOffset;
- } else if (currentOffset != null && currentOffset.snapshotSplit()
&& noMoreSplits()) {
+ } else if ((hasPendingIncludeTablesChange() || (currentOffset !=
null && currentOffset.snapshotSplit()))
+ && noMoreSplits()) {
+ // Added-table snapshots resume the saved offset so
retained-table changes are not skipped.
+ if (hasPendingIncludeTablesChange()) {
+ return createIncrementalOffset();
Review Comment:
[P1] Preserve finished snapshot high-watermarks when resuming added tables
When a pending include_tables round finishes its snapshot splits, this
branch returns `createIncrementalOffset()`, which contains only the saved
binlog offset and drops `finishedSplits`. Both CDC readers build
`FinishedSnapshotSplitInfo` solely from that list; without it, the stream
starts from the old T0 and replays events that occurred between T0 and each
added table's snapshot high-watermark after the snapshot has already loaded
current rows. A write in that window can therefore regress or duplicate target
data. Carry the completed snapshot split metadata into the resumed BinlogSplit
and add a test covering a write between T0 and the added-table snapshot.
##########
fe/fe-core/src/main/java/org/apache/doris/job/extensions/insert/streaming/StreamingInsertJob.java:
##########
@@ -617,6 +625,64 @@ public void alterJob(AlterJobCommand alterJobCommand)
throws AnalysisException,
}
}
+ public void prepareIncludeTables(AlterJobCommand command) throws
AnalysisException, JobException {
+ List<String> updatedTables = command.getIncludeTables();
+ if (updatedTables == null) {
+ return;
+ }
+ if (new HashSet<>(updatedTables).equals(new HashSet<>(syncTables))) {
+ return;
+ }
+ if
(command.getProperties().containsKey(StreamingJobProperties.OFFSET_PROPERTY)) {
+ throw new AnalysisException("Cannot alter include_tables and
offset together");
+ }
+ validateComputeGroupProperty(command.getProperties());
+ List<String> addedTables = new ArrayList<>(updatedTables);
+ addedTables.removeAll(syncTables);
+ Map<String, String> source = new HashMap<>(sourceProperties);
+ source.putAll(command.getSourceProperties());
+ validateAlterSourceProperties(command, source);
+ source = buildConvertedSourceProperties(source);
+ Map<String, String> target = new HashMap<>(targetProperties);
+ target.putAll(command.getTargetProperties());
+ try {
+ // Prepare resources before entering JobManager's global write
lock.
+ StreamingJobUtils.validateAndCreateTables(targetDb, dataSourceType,
Review Comment:
[P1] Roll back preflight DDL when ALTER JOB cannot commit
`doRun()` calls `prepareIncludeTables()` before `JobManager.alterJob()`.
That preflight runs `CreateTableCommand.run()` for added targets (and may
`ALTER PUBLICATION`), but `alterIncludeTables()` only afterward calls
`validateAlterIncludeTables()`. For example, a paused job with no committed
incremental offset creates the new target and then fails with `Cannot alter
include_tables before an incremental offset is committed`, leaving an orphan
target and possibly an expanded publication while the job's table set is
unchanged. Validate all provider/state preconditions before external DDL, or
track and compensate every mutation if the later ALTER/journal fails.
--
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]