Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mNZbE-0006r4-AB for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Sep 2021 11:49:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mNZbD-0004cl-6d for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Sep 2021 11:49:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mNZbC-0004cd-RB for pgsql-hackers@lists.postgresql.org; Tue, 07 Sep 2021 11:49:10 +0000 Received: from mail-il1-x134.google.com ([2607:f8b0:4864:20::134]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mNZb9-0001K9-Bh for pgsql-hackers@postgresql.org; Tue, 07 Sep 2021 11:49:10 +0000 Received: by mail-il1-x134.google.com with SMTP id l10so9661805ilh.8 for ; Tue, 07 Sep 2021 04:49:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=kWLd7Sqzu0yeSJkPSYFvuP8YLlJijeHuHOBltfIGvbc=; b=Oi/vhgwgx1+vKy/wytIuPCHtBVyiqZ8OFOQ6Jk1R/lLxbaAC4S/HemXHKEI5CRduZd d8dU2426jqx9KZ8A6vJ2wdGNLNSQ2AY+FAdAmVUAy/6ipdu/GFxNZ7Yap+K7QCGVOEYo oWfA7WZEziiyb53aXV6bXb7F+GLdcSc3enSLtHIoKxvOiUWJQmaY9etxvMNCi7QcTfX6 W2a6Za4e52rZHk9pd6paxteqxZUky2ZvLoUnUrJ5eGhGOO6YcARaBnQWec29Ne7HPW/f L1+2dcUNDA9uULWZv6Y3Pn9n9gFu4AJP0Pmu+BfVYAjhS3uM2MhTvDr6H11yRvKonUFO UdMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=kWLd7Sqzu0yeSJkPSYFvuP8YLlJijeHuHOBltfIGvbc=; b=myWDOWXPJoh1Q2xVvm1wtMIydYK6IunlJTphsGyeI88ShdhamAIi8qaiISoBWO2u/x nu1KGl8f9zCxgaz7aGFgtEDH9Oibh8hr2x7yW506LBkKZnm1gsaM549O4rfHXZIToO4w 9DwjTgOiQ6Buk1OwxFifb6kndQBVCD9BkFDHxF2P7os072bo+HZPo2/dWBerS5Hujk3p k8f5FwrEu35qyn3j7ZVYhSXxPY7YnI//4WKWQ0QXJwMWJytuCBcBYgXzPF9eHFyYy7Rg K4pPJuHcARGD1nypA8fVDNWbNHjS+ZQoJm7AjnotgFSS+9Zk8rr7TNGz1p+70qdLG2JK DZdw== X-Gm-Message-State: AOAM530+5I0xQnISF+pM9nZdyuxA/N8m/dUq1KigvG1UjEPWuhE9hlXs CXxiklvVvdNfCT7jA2Bz84q6lQ== X-Google-Smtp-Source: ABdhPJxGamiL9WhEKII2RfSZU7Ua2Z12s+mB5o4dMQ6NZYi2eGGtXdGc/V3stNdBV8z6bRQdncP1Ng== X-Received: by 2002:a05:6e02:198d:: with SMTP id g13mr11748710ilf.319.1631015345434; Tue, 07 Sep 2021 04:49:05 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id z26sm6411620iol.6.2021.09.07.04.49.04 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Sep 2021 04:49:04 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 8ED5C800B38; Tue, 7 Sep 2021 06:49:03 -0500 (CDT) Date: Tue, 7 Sep 2021 06:49:03 -0500 From: Justin Pryzby To: Nitin Jadhav Cc: Michael Paquier , Robert Haas , Bharath Rupireddy , Tom Lane , Andres Freund , Stephen Frost , Magnus Hagander , Thomas Munro , Pg Hackers Subject: Re: when the startup process doesn't (logging startup delays) Message-ID: <20210907114903.GJ26465@telsasoft.com> References: <20210725175654.GA23997@telsasoft.com> <20210726153023.GC23997@telsasoft.com> <20210814214700.GO10479@telsasoft.com> <20210904022327.GE26465@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Sep 07, 2021 at 03:07:15PM +0530, Nitin Jadhav wrote: > > Looking over this version, I realized something I (or you) should have > > noticed sooner: you've added the RegisterTimeout call to > > InitPostgres(), but that's for things that are used by all backends, > > and this is only used by the startup process. So it seems to me that > > the right place is StartupProcessMain. That would have the further > > advantage of allowing startup_progress_timeout_handler to be made > > static. begin_startup_progress_phase() and > > startup_progress_timeout_has_expired() are the actual API functions > > though so they will need to remain extern. > > > > I agree with Robert that a standby server should not continuously show timing > > messages for WAL replay. > > The earlier discussion wrt this point is as follows. I think you're confusing discussions. Robert was talking about initdb/bootstrap/single, and I separately and independently asked about hot standbys. It seems like Robert and I agreed about the desired behavior and there was no further discussion. > > Honestly, I don't see why we should have > > a GUC for what's proposed here. A value too low would bloat the logs > > with entries that are not that meaningful. A value too large would > > just prevent access to some information wanted. Wouldn't it be better > > to just pick up a value like 10s or 20s? I don't think bloating logs is a issue for values > 10sec. You agreed that it's important to choose the "right" value, but I think that will vary between users. Some installations with large checkpoint_timeout might anticipate taking 15+min to perform recovery, but others might even have a strict requirement that recovery must not take more than (say) 10sec; someone might want to use this to verify that, or to optimize the slow parts of recovery, with an interval that someone else might not care about. > > + {"log_startup_progress_interval", PGC_SIGHUP, LOGGING_WHEN, > > + gettext_noop("Sets the time interval between each progress update " > > + "of the startup process."), > > + gettext_noop("0 logs all messages. -1 turns this feature off."), > > + GUC_UNIT_MS, |+ 10, -1, INT_MAX, > > The unit is incorrect here, as that would default to 10ms, contrary to > > what the documentation says about 10s. > > Kindly refer the previous few discussions wrt this point. You copied and pasted unrelated emails, which isn't helpful. Michael is right. You updated some of the units based on Robert's suggestion to use MS, but didn't update all of the corresponding parts of the patch. guc.c says that the units are in MS, which means that unqualified values are interpretted as such. But postgresql.conf.sample still says "seconds", and guc.c says the default value is "10", and you still do: + interval_in_ms = log_startup_progress_interval * 1000; I checked that this currently does not interpret the value as ms: |./tmp_install/usr/local/pgsql/bin/postgres -D src/test/regress/tmp_check/data/ -c log_startup_progress_interval=1 |2021-09-07 06:28:58.694 CDT startup[18865] LOG: redo in progress, elapsed time: 1.00 s, current LSN: 0/E94ED88 |2021-09-07 06:28:59.694 CDT startup[18865] LOG: redo in progress, elapsed time: 2.00 s, current LSN: 0/10808EE0 |2021-09-07 06:29:00.694 CDT startup[18865] LOG: redo in progress, elapsed time: 3.00 s, current LSN: 0/126B8C80 (Also, the GUC value is in the range 0..INT_MAX, so multiplying and storing to another int could overflow.) I think the convention is to for GUC global vars to be initialized with the same default as in guc.c, so both should be 10000, like: +int log_startup_progress_interval = 10 * 1000 /* 10sec */ -- Justin