morningman commented on code in PR #70130:
URL: https://github.com/apache/doris/pull/70130#discussion_r4475111686
##########
fe/fe-core/src/main/java/org/apache/doris/load/routineload/RoutineLoadJob.java:
##########
@@ -2110,6 +2110,28 @@ public void gsonPostProcess() throws IOException {
public abstract void modifyProperties(AlterRoutineLoadCommand command)
throws UserException;
+ /**
+ * Checks the workload group an ALTER leaves the job with, in the compute
group the ALTER leaves the job in, as
+ * CREATE does and as every task resolves it ({@code
KafkaTaskInfo#rePlan}): as the owner, whom the tasks run
+ * as. One that group does not have, or the owner may not use, would
otherwise fail every task with the
+ * retryable CREATE_TASKS_ERR, which auto resume repeats for good. Only an
ALTER that sets a workload group or
+ * declares a compute group changes what the tasks look up; a workload
group it does not set is the one the
+ * job keeps. Called on the statement thread before the job lock, never
when an ALTER is replayed.
+ */
+ protected void checkAlteredWorkloadGroup(Map<String, String>
alteredJobProperties) throws UserException {
+ String declaredComputeGroup = alteredJobProperties.get(COMPUTE_GROUP);
+ String alteredWorkloadGroup = alteredJobProperties.get(WORKLOAD_GROUP);
+ if (StringUtils.isEmpty(declaredComputeGroup) &&
StringUtils.isEmpty(alteredWorkloadGroup)) {
+ return;
+ }
+ String workloadGroup = StringUtils.isEmpty(alteredWorkloadGroup) ?
getWorkloadGroup() : alteredWorkloadGroup;
Review Comment:
Fixed in `7571ae75f2f`. Both job types now call `checkAlteredWorkloadGroup`
first thing under the job's write lock, before the PAUSED check, so of two
concurrent ALTERs the one that gets the lock second checks the compute group
and workload group the first one left. The Kafka offset conversion stays before
the lock: it sends a metadata request through the group's backends and does not
depend on the workload group. The lookup is in memory, and the same locked
section already writes the edit log.
The new
`RoutineLoadComputeGroupTest#testConcurrentAltersCheckWhatTheEarlierOneLeft`
runs your interleaving on a paused job in cg_a with wg_old, which both cg_a and
cg_b have. One ALTER moves the job to cg_b; another, started from inside the
first one's workload group lookup, sets wg_a, which only cg_a has. With the
check before the lock, both were accepted and the job was left with wg_a in
cg_b. Now the second ALTER fails with `Can not find workload group wg_a in
compute croup cg_b` and the job keeps wg_old.
On scope: the check-before-lock placement came from #69749, so on master two
concurrent compute group moves, one of which also sets a workload group,
already raced this way. It also needs cloud mode: outside it, no ALTER changes
the namespace the workload group is looked up in.
--
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]