Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BugFix] fix ingestion hang because of alter job timeout #55207

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions fe/fe-core/src/main/java/com/starrocks/alter/AlterJobV2.java
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,10 @@ public long getWarehouseId() {
*/
public synchronized void run() {
if (isTimeout()) {
cancelHook(cancelImpl("Timeout"));
return;
if (cancelInternal("Timeout")) {
// If this job can't be cancelled, we should execute it.
return;
}
}

// create connectcontext
Expand Down Expand Up @@ -255,15 +257,19 @@ public synchronized void run() {
} // else: handle the new state
}
} catch (AlterCancelException e) {
cancelHook(cancelImpl(e.getMessage()));
cancelInternal(e.getMessage());
}
}

protected boolean cancelInternal(String errMsg) {
boolean cancelled = cancelImpl(errMsg);
cancelHook(cancelled);
return cancelled;
}

public boolean cancel(String errMsg) {
synchronized (this) {
boolean cancelled = cancelImpl(errMsg);
cancelHook(cancelled);
return cancelled;
return cancelInternal(errMsg);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1080,9 +1080,7 @@ public final boolean cancel(String errMsg) {
createReplicaLatch.countDownToZero(new Status(TStatusCode.OK, ""));
}
synchronized (this) {
boolean cancelled = cancelImpl(errMsg);
cancelHook(cancelled);
return cancelled;
return cancelInternal(errMsg);
}
} finally {
isCancelling.set(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -770,9 +770,7 @@ public final boolean cancel(String errMsg) {
createReplicaLatch.countDownToZero(new Status(TStatusCode.OK, ""));
}
synchronized (this) {
boolean cancelled = cancelImpl(errMsg);
cancelHook(cancelled);
return cancelled;
return cancelInternal(errMsg);
}
} finally {
isCancelling.set(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2110,7 +2110,7 @@ public AlterJobV2 createAlterMetaJob(AlterClause alterClause, Database db, OlapT
long timeoutSecond = PropertyAnalyzer.analyzeTimeout(properties, Config.alter_table_timeout_second);
alterMetaJob = new LakeTableAlterMetaJob(GlobalStateMgr.getCurrentState().getNextId(),
db.getId(),
olapTable.getId(), olapTable.getName(), timeoutSecond,
olapTable.getId(), olapTable.getName(), timeoutSecond * 1000 /* should be ms*/,
TTabletMetaType.ENABLE_PERSISTENT_INDEX, enablePersistentIndex, persistentIndexType);
} else {
// shouldn't happen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -946,9 +946,7 @@ public final boolean cancel(String errMsg) {
createReplicaLatch.countDownToZero(new Status(TStatusCode.OK, ""));
}
synchronized (this) {
boolean cancelled = cancelImpl(errMsg);
cancelHook(cancelled);
return cancelled;
return cancelInternal(errMsg);
}
} finally {
isCancelling.set(false);
Expand Down
Loading