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(mock data): failed to cancel the mock data task #2850

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public enum ErrorCodes implements ErrorCode {
TaskNotReadyForDownload,
TaskSqlExecuteFailed,
TaskLogNotFound,
TaskFailedCancelledNow,

// Debug
DebugDBMSNotSupported,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -899,4 +899,4 @@ com.oceanbase.odc.DatabasePermissionType.ACCESS=訪問
com.oceanbase.odc.PartitionPlanVariableKey.INTERVAL=間隔
com.oceanbase.odc.PartitionPlanVariableKey.LAST_PARTITION_VALUE=最後一個分區規則對應位置表達式的值
com.oceanbase.odc.partitionplan.TimeDataType=時間類型
com.oceanbase.odc.partitionplan.NumberDataType=數字類型
com.oceanbase.odc.partitionplan.NumberDataType=數字類型
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,4 @@ com.oceanbase.odc.ErrorCodes.PartitionKeyDataTypeMismatch=The data type does not
com.oceanbase.odc.ErrorCodes.TimeDataTypePrecisionMismatch=The time type precision does not match. The configured time interval precision is greater than the maximum precision of the partition key {0} data type.
com.oceanbase.odc.ErrorCodes.DatabaseAccessDenied=Database access is denied because the current user does not have {0} permissions for the database.
com.oceanbase.odc.ErrorCodes.ObQueryProfileNotSupported=Query profile is only available for OceanBase Database with versions equal to or higher than {0}.
com.oceanbase.odc.ErrorCodes.TaskFailedCancelledNow=Cannot cancel at this time, the task may not have started yet, please try again later.
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,4 @@ com.oceanbase.odc.ErrorCodes.PartitionKeyDataTypeMismatch = 数据类型不匹
com.oceanbase.odc.ErrorCodes.TimeDataTypePrecisionMismatch = 时间类型精度不匹配,配置的时间间隔精度大于分区键 {0} 数据类型的最大精度
com.oceanbase.odc.ErrorCodes.DatabaseAccessDenied=数据库访问被拒绝,因为当前用户没有数据库的{0}权限
com.oceanbase.odc.ErrorCodes.ObQueryProfileNotSupported=执行详情仅在高于或等于 {0} 的 OceanBase 版本可用
com.oceanbase.odc.ErrorCodes.TaskFailedCancelledNow=当前无法取消,任务可能还未开始,请稍后再试
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,4 @@ com.oceanbase.odc.ErrorCodes.PartitionKeyDataTypeMismatch = 資料類型不匹
com.oceanbase.odc.ErrorCodes.TimeDataTypePrecisionMismatch = 時間類型精度不匹配,配置的時間間隔精度大於分區鍵 {0} 資料類型的最大精度
com.oceanbase.odc.ErrorCodes.DatabaseAccessDenied=資料庫存取被拒絕,因為目前使用者沒有資料庫的{0}權限
com.oceanbase.odc.ErrorCodes.ObQueryProfileNotSupported=執行詳情僅在高於或等於 {0} 的 OceanBase 版本可用
com.oceanbase.odc.ErrorCodes.TaskFailedCancelledNow=當前無法取消,任務可能還未開始,請稍後再試
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@

import com.oceanbase.odc.common.trace.TraceContextHolder;
import com.oceanbase.odc.core.shared.Verify;
import com.oceanbase.odc.core.shared.constant.ErrorCodes;
import com.oceanbase.odc.core.shared.constant.FlowStatus;
import com.oceanbase.odc.core.shared.exception.BadRequestException;
import com.oceanbase.odc.service.connection.model.ConnectionConfig;
import com.oceanbase.odc.service.flow.task.model.MockDataTaskResult;
import com.oceanbase.odc.service.flow.task.model.MockProperties;
Expand Down Expand Up @@ -61,7 +63,10 @@ public class MockDataRuntimeFlowableTask extends BaseODCFlowTaskDelegate<Void> {

@Override
public boolean cancel(boolean mayInterruptIfRunning, Long taskId, TaskService taskService) {
Verify.notNull(context, "MockContext is null");
if (context == null) {
zijiacj marked this conversation as resolved.
Show resolved Hide resolved
throw new BadRequestException(ErrorCodes.TaskFailedCancelledNow, null,
"Failed to cancel the task.");
}
Map<String, String> variables = new HashMap<>();
variables.putIfAbsent("mocktask.workspace", taskId + "");
TraceContextHolder.span(variables);
Expand Down