Is Backgroundworker.bgw_restart_time is defined in seconds? - Mailing list pgsql-bugs

From constzl
Subject Is Backgroundworker.bgw_restart_time is defined in seconds?
Date
Msg-id 4baeccb.80f0.17b81651c54.Coremail.const_sunny@126.com
Whole thread Raw
Responses Re: Is Backgroundworker.bgw_restart_time is defined in seconds?  (Daniel Gustafsson <daniel@yesql.se>)
List pgsql-bugs

Hi,

typedef struct BackgroundWorker
{
    char        bgw_name[BGW_MAXLEN];
    char        bgw_type[BGW_MAXLEN];
    int         bgw_flags;
    BgWorkerStartTime bgw_start_time;
    int         bgw_restart_time;   /* in seconds, or BGW_NEVER_RESTART */
    char        bgw_library_name[BGW_MAXLEN];
    char        bgw_function_name[BGW_MAXLEN];
    Datum       bgw_main_arg;
    char        bgw_extra[BGW_EXTRALEN];
    pid_t       bgw_notify_pid; /* SIGUSR1 this backend on start/stop */
BackgroundWorker;


static bool
SanityCheckBackgroundWorker(BackgroundWorker *workerint elevel)
{
... ...

    if ((worker->bgw_restart_time < 0 &&
         worker->bgw_restart_time != BGW_NEVER_RESTART) ||
        (worker->bgw_restart_time > USECS_PER_DAY / 1000))

> The Backgroundworker.bgw_restart_time is defined in seconds,
> so should it be "USECS_PER_DAY / 1000,000" here instead of "USECS_PER_DAY / 1000"?
> Or am I getting it wrong?

    {
        ereport(elevel,
                (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
                 errmsg("background worker \"%s\": invalid restart interval",
                        worker->bgw_name)));
        return false;
    }
... ...
}

Regards!

pgsql-bugs by date:

Previous
From: Masahiko Sawada
Date:
Subject: Re: pg_basebackup behavior on non-existent slot
Next
From: Daniel Gustafsson
Date:
Subject: Re: Is Backgroundworker.bgw_restart_time is defined in seconds?