Skip to content

Commit e78e9ec

Browse files
gengjun-gitclaude
andcommitted
[Refactor] Drop redundant AgentTaskQueue cleanup from the lake alter-job handoff resets
The demotion drain stage (abandonInFlightAgentTasks) empties the whole AgentTaskQueue before AlterHandler.onStopped() runs the per-job resets, and the activation-side sweep runs before any daemon can enqueue - so the removeBatchTask / per-task removeTask calls in the lake jobs' resetTransientStateForHandoff() were no-ops on every reachable path. Remove them and state the invariant in the comments; the essential part (fresh/nulled batch so the re-run re-sends or re-dispatches) is unchanged. Signed-off-by: gengjun-git <gengjun@starrocks.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent ba062ef commit e78e9ec

3 files changed

Lines changed: 11 additions & 15 deletions

File tree

fe/fe-core/src/main/java/com/starrocks/alter/LakeRollupJob.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,9 @@ protected void resetTransientStateForHandoff() {
133133
if (jobState == JobState.RUNNING) {
134134
jobState = JobState.WAITING_TXN;
135135
}
136-
// Same normalization replay() performs: drop queue entries and start from an empty
137-
// batch - runWaitingTxnJob appends directly to the field (double-add hazard).
138-
AgentTaskQueue.removeBatchTask(rollupBatchTask, TTaskType.ALTER);
136+
// Same normalization replay() performs: start from an empty batch - runWaitingTxnJob
137+
// appends directly to the field (double-add hazard). No AgentTaskQueue cleanup needed:
138+
// the demotion drain (abandonInFlightAgentTasks) already emptied the queue.
139139
rollupBatchTask = new AgentBatchTask();
140140
// whereClause deliberately KEPT: this class has no gsonPostProcess restore, so a real
141141
// reload silently loses the sync-MV filter (pre-existing reload bug); keep the

fe/fe-core/src/main/java/com/starrocks/alter/LakeTableIndexFastPathJobBase.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,10 @@ protected void resetTransientStateForHandoff() {
131131
jobState = JobState.PENDING;
132132
}
133133
// runRunningJob dispatches ONLY behind a null guard - a stale batch would silently
134-
// suppress the re-send and wedge the job until timeout. Drop queue entries (mirror
135-
// cancelImpl) and null the field so the re-run re-dispatches.
136-
if (batchTask != null) {
137-
for (AgentTask task : batchTask.getAllTasks()) {
138-
AgentTaskQueue.removeTask(task.getBackendId(), TTaskType.ALTER, task.getSignature());
139-
}
140-
batchTask = null;
141-
}
134+
// suppress the re-send and wedge the job until timeout. Null the field so the re-run
135+
// re-dispatches. No AgentTaskQueue cleanup needed: the demotion drain
136+
// (abandonInFlightAgentTasks) already emptied the queue before this hook runs.
137+
batchTask = null;
142138
}
143139

144140
protected LakeTableIndexFastPathJobBase(long jobId, JobType jobType, long dbId, long tableId, String tableName,

fe/fe-core/src/main/java/com/starrocks/alter/LakeTableSchemaChangeJob.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,11 @@ protected void resetTransientStateForHandoff() {
181181
if (jobState == JobState.RUNNING) {
182182
jobState = JobState.WAITING_TXN;
183183
}
184-
// Mirror cancelImpl's queue cleanup, then start from an empty batch: the WAITING_TXN
185-
// handler APPENDS to it (double-add hazard), and getInfo dereferences the field, so
186-
// fresh-empty rather than null. watershedTxnId/Gtid stay - they are durable with the
184+
// Start from an empty batch: the WAITING_TXN handler APPENDS to it (double-add hazard),
185+
// and getInfo dereferences the field, so fresh-empty rather than null. No AgentTaskQueue
186+
// cleanup needed - the demotion drain (abandonInFlightAgentTasks) already emptied the
187+
// queue before this hook runs. watershedTxnId/Gtid stay - they are durable with the
187188
// WAITING_TXN entry, and runPendingJob reassigns them unconditionally at PENDING.
188-
AgentTaskQueue.removeBatchTask(schemaChangeBatchTask, TTaskType.ALTER);
189189
schemaChangeBatchTask = new AgentBatchTask();
190190
createReplicaLatch = null;
191191
waitingCreatingReplica.set(false);

0 commit comments

Comments
 (0)