JNSimba commented on code in PR #69673:
URL: https://github.com/apache/doris/pull/69673#discussion_r4736367372
##########
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,
+ source, target, updatedTables, addedTables);
+ if (dataSourceType == DataSourceType.POSTGRES) {
+ PostgresResourceValidator.ensurePublicationCoversTables(
+ source, String.valueOf(getJobId()), updatedTables);
+ }
+ } catch (Exception e) {
+ throw new JobException("Failed to prepare include_tables change: "
+ e.getMessage(), e);
+ }
+ }
+
+ private void alterIncludeTables(List<String> updatedTables,
+ Map<String, String> newConvertedSourceProperties) throws
JobException {
+ if (updatedTables == null || new HashSet<>(updatedTables).equals(new
HashSet<>(syncTables))) {
+ return;
+ }
+ // A paused job may not have restored its committed progress after an
FE restart.
+ replayOffsetProviderIfNeed();
Review Comment:
This is the result of a trade-off; implementing it on the 'resume' side
would likely require more extensive changes.
--
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]