what indicates the message “server restarted” in the return_message column in the cron.job_run_details table

2024-07-02T14:27:55.3966667+00:00

what indicates the message “server restarted” in the return_message column in the cron.job_run_details table

As per my understanding, the message “server restarted” in the return_message column of the cron.job_run_details table typically indicates that the PostgreSQL server was restarted.

checked the server logs and found no information related to server restarts.

so, trying to understand, what could be the issue?

Azure Database for PostgreSQL
0 comments No comments
{count} votes

Accepted answer
  1. GeethaThatipatri-MSFT 29,477 Reputation points Microsoft Employee
    2024-07-02T18:05:24.89+00:00

    @Naveen Kumar Kakarla (Quadrant Resource) Thanks for posting your question in the Microsoft Q&A forum.
    pg_cron leverages PostgreSQL's Background Worker Processes. And this extension configures its bgw_restart_time to 1 second. That means if that process crashes, postmaster will wait for 1 second and spin up another instance of the process, which will go through the same initialization code as when it is first run after a PosgtreSQL restart. Meaning that it will execute the entry-point function PgCronLauncherMain, and that one will call MarkPendingRunsAsFailed, which will update all rows in the cron.job_run_details whose status is STARTING or RUNNING to have their status set as FAILED and return_message a 'server restarted'.

     Bottom line being that you can see rows marked like that when PostgreSQL itself has been restarted, or when the background worker for pg_cron has crashed. 

    An alternate approach to START/STOP Flexible Server Instance on schedule is to leverage built-in Azure Automation Tasks based on Azure Logic Apps. This method offers easy scheduling via the Azure portal and provides reporting in the form of task history. 

    Manage Azure Database for PostgreSQL - Flexible Server using automation tasks

    Regards

    Geetha

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.