修复pg_job故障不重启的bug

This commit is contained in:
luozihao
2023-05-06 17:08:35 +08:00
parent a9a1691026
commit 0f51bfba70
2 changed files with 6 additions and 0 deletions

View File

@ -1929,8 +1929,12 @@ void update_run_job_to_fail()
while (HeapTupleIsValid(tuple = heap_getnext(scan, ForwardScanDirection))) {
Form_pg_job pg_job = (Form_pg_job)GETSTRUCT(tuple);
/* Every coordinator should update all tuples which job_status is 'r'. */
#ifdef ENABLE_MULTIPLE_NODES
if (pg_job->job_status == PGJOB_RUN_STATUS &&
0 == strcmp(pg_job->node_name.data, g_instance.attr.attr_common.PGXCNodeName)) {
#else
if (pg_job->job_status == PGJOB_RUN_STATUS) {
#endif
get_job_values(pg_job->job_id, tuple, pg_job_tbl, old_value, visnull);
values[Anum_pg_job_failure_count - 1] = Int16GetDatum(pg_job->failure_count + 1);

View File

@ -734,10 +734,12 @@ static void ScanExpireJobs()
continue;
}
#ifdef ENABLE_MULTIPLE_NODES
/* handle cases - ALL_NODE/ALL_CN/ALL_DN/CCN specific node */
if (!IsExecuteOnCurrentNode(pg_job->node_name.data)) {
continue;
}
#endif
Datum cur_job_start_time = DirectFunctionCall1(timestamp_timestamptz, values[Anum_pg_job_next_run_date - 1]);
if (false == DatumGetBool(DirectFunctionCall2(timestamp_gt, curtime, cur_job_start_time))) {