Remove unused citus_cancel_job function to streamline background job processing

m3hm3t/issue_7896
Mehmet Yilmaz 2025-04-04 11:17:07 +00:00
parent 62ef1c3536
commit 3ed1284794
1 changed files with 0 additions and 38 deletions

View File

@ -117,7 +117,6 @@ static void QueueMonitorSigTermHandler(SIGNAL_ARGS);
static void QueueMonitorSigIntHandler(SIGNAL_ARGS);
static void QueueMonitorSigHupHandler(SIGNAL_ARGS);
static void DecrementParallelTaskCountForNodesInvolved(BackgroundTask *task);
static bool citus_cancel_job(int64 jobid);
/* flags set by signal handlers */
static volatile sig_atomic_t GotSigterm = false;
@ -352,43 +351,6 @@ citus_job_wait_internal(int64 jobid, BackgroundJobStatus *desiredStatus)
}
/*
* citus_cancel_job - forcibly cancels a background job by setting its status
* to BACKGROUND_JOB_STATUS_CANCELLED in memory, then updates the
* pg_dist_background_job table.
*/
bool
citus_cancel_job(int64 jobId)
{
BackgroundJob *job = GetBackgroundJobByJobId(jobId);
if (!job)
{
/* No such job ID */
return false;
}
/*
* If the job is already in a terminal state, or is scheduled,
* decide if you want to do anything special.
* But typically you just check if it is still "running" or "cancelling".
*/
if (IsBackgroundJobStatusTerminal(job->state))
{
return false;
}
/* Mark job as canceled, then update the catalog */
job->state = BACKGROUND_JOB_STATUS_CANCELLED;
/* This projects the tasks states into the job's new state,
* and updates the row in pg_dist_background_job.
*/
UpdateBackgroundJob(job->jobid);
return true;
}
/*
* citus_task_wait_internal implements the waiting on a task for reuse in other areas where
* we want to wait on tasks.