pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: constzl <const_sunny@126.com>
To: pgsql-bugs@lists.postgresql.org
Subject: Is Backgroundworker.bgw_restart_time is defined in seconds?
Date: Thu, 26 Aug 2021 15:38:12 +0800 (CST)
Message-ID: <4baeccb.80f0.17b81651c54.Coremail.const_sunny@126.com> (raw)



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 *worker, int 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!

view thread (4+ messages)  latest in thread

Message-ID: <4baeccb.80f0.17b81651c54.Coremail.const_sunny@126.com>
Permalink:  ../4baeccb.80f0.17b81651c54.Coremail.const_sunny@126.com/
Also on:    postgresql.org/message-id/4baeccb.80f0.17b81651c54.Coremail.const_sunny@126.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: const_sunny@126.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: Is Backgroundworker.bgw_restart_time is defined in seconds?
  In-Reply-To: <4baeccb.80f0.17b81651c54.Coremail.const_sunny@126.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox