Skip to content

Commit

Permalink
[fix](schema-change) fix potential data race when schema change job i…
Browse files Browse the repository at this point in the history
…s set to cancelled but table state is still schema change
  • Loading branch information
TangSiyang2001 committed Aug 9, 2024
1 parent d5049ec commit 6ac034e
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -749,11 +749,11 @@ protected synchronized boolean cancelImpl(String errMsg) {
pruneMeta();
this.errMsg = errMsg;
this.finishedTimeMs = System.currentTimeMillis();
LOG.info("cancel {} job {}, err: {}", this.type, jobId, errMsg);
Env.getCurrentEnv().getEditLog().logAlterJob(this);

changeTableState(dbId, tableId, OlapTableState.NORMAL);
LOG.info("set table's state to NORMAL when cancel, table id: {}, job id: {}", tableId, jobId);
jobState = JobState.CANCELLED;
Env.getCurrentEnv().getEditLog().logAlterJob(this);
LOG.info("cancel {} job {}, err: {}", this.type, jobId, errMsg);
postProcessShadowIndex();

return true;
Expand Down Expand Up @@ -791,8 +791,6 @@ private void cancelInternal() {
}
}
}

jobState = JobState.CANCELLED;
}

// Check whether transactions of the given database which txnId is less than 'watershedTxnId' are finished
Expand Down

0 comments on commit 6ac034e

Please sign in to comment.