mirror of https://github.com/citusdata/citus.git
Refactor job cancellation logic in background job processing for improved clarity and maintainability
parent
3c23f897e4
commit
85a1c730ce
|
@ -295,16 +295,20 @@ citus_job_wait_internal(int64 jobid, BackgroundJobStatus *desiredStatus)
|
|||
if (desiredStatus)
|
||||
{
|
||||
Oid reachedStatusOid = BackgroundJobStatusOid(job->state);
|
||||
Datum reachedStatusNameDatum = DirectFunctionCall1(enum_out, reachedStatusOid);
|
||||
Datum reachedStatusNameDatum = DirectFunctionCall1(enum_out,
|
||||
reachedStatusOid);
|
||||
char *reachedStatusName = DatumGetCString(reachedStatusNameDatum);
|
||||
|
||||
Oid desiredStatusOid = BackgroundJobStatusOid(*desiredStatus);
|
||||
Datum desiredStatusNameDatum = DirectFunctionCall1(enum_out, desiredStatusOid);
|
||||
Datum desiredStatusNameDatum = DirectFunctionCall1(enum_out,
|
||||
desiredStatusOid);
|
||||
char *desiredStatusName = DatumGetCString(desiredStatusNameDatum);
|
||||
|
||||
ereport(ERROR,
|
||||
(errmsg("Job reached terminal state \"%s\" instead of desired "
|
||||
"state \"%s\"", reachedStatusName, desiredStatusName)));
|
||||
(errmsg(
|
||||
"Job reached terminal state \"%s\" instead of desired "
|
||||
"state \"%s\"", reachedStatusName,
|
||||
desiredStatusName)));
|
||||
}
|
||||
|
||||
/* Otherwise, if no desiredStatus was given, we accept this terminal state. */
|
||||
|
@ -385,7 +389,6 @@ citus_cancel_job(int64 jobId)
|
|||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* citus_task_wait_internal implements the waiting on a task for reuse in other areas where
|
||||
* we want to wait on tasks.
|
||||
|
|
Loading…
Reference in New Issue