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

[fix](mtmv)fix mtmv may have repeat tasks after canceled #48830

Open
wants to merge 1 commit into
base: master
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
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,9 @@ private String getDummyStmt(Set<String> refreshPartitionNames) {
public synchronized void onFail() throws JobException {
LOG.info("mtmv task onFail, taskId: {}", super.getTaskId());
super.onFail();
if (super.getStatus() != TaskStatus.FAILED) {
return;
}
after();
}

Expand All @@ -340,12 +343,18 @@ public synchronized void onSuccess() throws JobException {
LOG.debug("mtmv task onSuccess, taskId: {}", super.getTaskId());
}
super.onSuccess();
if (super.getStatus() != TaskStatus.SUCCESS) {
return;
}
after();
}

@Override
protected synchronized void executeCancelLogic(boolean needWaitCancelComplete) {
LOG.info("mtmv task cancel, taskId: {}", super.getTaskId());
if (super.getStatus() != TaskStatus.CANCELED) {
return;
}
if (executor != null) {
executor.cancel(new Status(TStatusCode.CANCELLED, "mtmv task cancelled"), needWaitCancelComplete);
}
Expand Down
3 changes: 3 additions & 0 deletions regression-test/suites/mtmv_p0/test_task_mtmv.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ suite("test_task_mtmv") {
log.info("cancel error msg: " + e.getMessage())
assertTrue(e.getMessage().contains("no running task"));
}
def tasksAfterCancel = sql """ select TaskId from tasks('type'='mv') where MvName = '${mvName}';"""
// should only has one task after cancel
assertEquals(1, tasksAfterCancel.size());
sql """drop materialized view if exists ${mvName};"""

}