Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wYptM-000Y0w-1i for pgsql-hackers@arkaria.postgresql.org; Sun, 14 Jun 2026 18:49:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wYptJ-008isy-2R for pgsql-hackers@arkaria.postgresql.org; Sun, 14 Jun 2026 18:49:05 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wYptJ-008isq-0z for pgsql-hackers@lists.postgresql.org; Sun, 14 Jun 2026 18:49:05 +0000 Received: from forwardcorp1d.mail.yandex.net ([178.154.239.200]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wYptG-00000000OZ7-0hci for pgsql-hackers@lists.postgresql.org; Sun, 14 Jun 2026 18:49:04 +0000 Received: from mail-nwsmtp-smtp-corp-main-56.klg.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-56.klg.yp-c.yandex.net [IPv6:2a02:6b8:c42:65a0:0:640:e1de:0]) by forwardcorp1d.mail.yandex.net (Yandex) with ESMTPS id 3929380ED3; Sun, 14 Jun 2026 21:49:00 +0300 (MSK) Received: from smtpclient.apple (unknown [2a02:6bf:8080:42b::1:39]) by mail-nwsmtp-smtp-corp-main-56.klg.yp-c.yandex.net (smtpcorp) with ESMTPSA id wmTtoq5XEeA0-NKPqbq0k; Sun, 14 Jun 2026 21:48:59 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1781462939; bh=8TZCRWWy2iKZ7fzmsfOCzJRbwmuYkuMYARe+DUJANcw=; h=Message-Id:To:Date:References:Cc:In-Reply-To:From:Subject; b=klWn0aFKzwLih0w/VtLPFLv/UdRGxSZ0D1HKW/NrY2dTP7xlQQ4AHlzcvaw2lpRl4 d3rpPxhbVxDFnmBUa4yDpZs/2ATpdjLVmQ/0ofepO8lXX3nVwEL+LBW/mT7WWYgPNR 9g/47Qj2OlzaVixXvC5jCGqKeF48VWa1zOBnNQ1I= Authentication-Results: mail-nwsmtp-smtp-corp-main-56.klg.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.600.51.1.1\)) Subject: Re: Add wait events for server logging destination writes From: Andrey Borodin In-Reply-To: Date: Sun, 14 Jun 2026 23:48:48 +0500 Cc: pgsql-hackers mailing list , Kirk Wolak , Kyotaro Horiguchi , Andreas Karlsson , nik@postgres.ai Content-Transfer-Encoding: quoted-printable Message-Id: <378001C2-12FE-47F5-8188-05900EF53F62@yandex-team.ru> References: <20260601.144922.658666928129832364.horikyota.ntt@gmail.com> To: =?utf-8?B?7Iug7ISx7KSA?= X-Mailer: Apple Mail (2.3864.600.51.1.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 6 Jun 2026, at 21:52, =EC=8B=A0=EC=84=B1=EC=A4=80 = wrote: >=20 Hi Seongjun, Naming is a hard thing. Anyone who can tell syslog from syslogger without checking man is probably a computer themselves. +1: a blocking logging write shows as wait_event IS NULL today, which most tools read as on-CPU. This is very real for us. In our managed Postgres the root filesystem that holds the logs sits on slow network-backed HDD, so when the syslogger pipe backs up the backends stall on the log write and the whole node looks like a CPU overload. This patch would have made that directly visible. Worth a line in the commit message: the call that actually blocks on a slow log device is write_syslogger_file() in the syslogger, which has no shared memory and isn't in pg_stat_activity. It surfaces on backends as the pipe fills and they block on the pipe write (SysloggerWrite), so the backend side is the right, visible layer. One thing worth checking: wait events are single-slot by design (no nesting - discussed back in 2016 [0]), and pgstat_report_wait_end() just writes 0. So if any ereport() path runs while a wait event is already set, instrumenting the logging write here clobbers that outer event. Probably rare, but I'm not sure it never happens. EventlogWrite necessarily shows up in the event list on all platforms (the generator has no per-platform gating), but the description already says "Windows event log", so that seems fine... Thanks for working on this! Best regards, Andrey Borodin. [0] = https://www.postgresql.org/message-id/CANP8%2BjKsS6SDo011AUWrLdBcBMv0KJha6= 9t7eFGqEtqx9FVfag%40mail.gmail.com