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)
|
if (desiredStatus)
|
||||||
{
|
{
|
||||||
Oid reachedStatusOid = BackgroundJobStatusOid(job->state);
|
Oid reachedStatusOid = BackgroundJobStatusOid(job->state);
|
||||||
Datum reachedStatusNameDatum = DirectFunctionCall1(enum_out, reachedStatusOid);
|
Datum reachedStatusNameDatum = DirectFunctionCall1(enum_out,
|
||||||
|
reachedStatusOid);
|
||||||
char *reachedStatusName = DatumGetCString(reachedStatusNameDatum);
|
char *reachedStatusName = DatumGetCString(reachedStatusNameDatum);
|
||||||
|
|
||||||
Oid desiredStatusOid = BackgroundJobStatusOid(*desiredStatus);
|
Oid desiredStatusOid = BackgroundJobStatusOid(*desiredStatus);
|
||||||
Datum desiredStatusNameDatum = DirectFunctionCall1(enum_out, desiredStatusOid);
|
Datum desiredStatusNameDatum = DirectFunctionCall1(enum_out,
|
||||||
|
desiredStatusOid);
|
||||||
char *desiredStatusName = DatumGetCString(desiredStatusNameDatum);
|
char *desiredStatusName = DatumGetCString(desiredStatusNameDatum);
|
||||||
|
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errmsg("Job reached terminal state \"%s\" instead of desired "
|
(errmsg(
|
||||||
"state \"%s\"", reachedStatusName, desiredStatusName)));
|
"Job reached terminal state \"%s\" instead of desired "
|
||||||
|
"state \"%s\"", reachedStatusName,
|
||||||
|
desiredStatusName)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Otherwise, if no desiredStatus was given, we accept this terminal state. */
|
/* 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
|
* citus_task_wait_internal implements the waiting on a task for reuse in other areas where
|
||||||
* we want to wait on tasks.
|
* we want to wait on tasks.
|
||||||
|
|
Loading…
Reference in New Issue