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 1wgY6m-006FmF-2k for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Jul 2026 01:26:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wgY6k-00EPvE-2E for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Jul 2026 01:26:50 +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 1wgY6k-00EPv6-0X for pgsql-hackers@lists.postgresql.org; Mon, 06 Jul 2026 01:26:50 +0000 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wgY6h-00000001y8l-19Kz for pgsql-hackers@postgresql.org; Mon, 06 Jul 2026 01:26:49 +0000 Received: by mail-pj1-x1031.google.com with SMTP id 98e67ed59e1d1-3811f512167so2112172a91.3 for ; Sun, 05 Jul 2026 18:26:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; t=1783301205; x=1783906005; darn=postgresql.org; h=user-agent:content-disposition:mime-version:message-id:subject:cc :to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=UMl6LB6XgAD8pW/hkFiuWInKhFc/Ywv/SwRUXW/UtOw=; b=TG/ctaiXGBd0gDGwDUuDcqmImJyJ195v2ICd62wZdUw/evtXkW4NtaY2Sd/Wi92wpx 0aaskLwH3fOO6prraNiSSGP4oCK41pST2UjuVm+k2A1zafsnEgS/A9Jkr9LiN7+RcKjL FmY2F8Gt2OslTH1idPKqZ5zfu9oBWHl4FB07I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783301205; x=1783906005; h=user-agent:content-disposition:mime-version:message-id:subject:cc :to:from:date:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=UMl6LB6XgAD8pW/hkFiuWInKhFc/Ywv/SwRUXW/UtOw=; b=cs0LRotpxFJaPmeezY7Yexnt6oYiCyCPoxG3HvgeBH1RhpAOwtfuEmbRdsVwGksoqp mYTq9nTXQwaew3d3Q49NFYEzAJLsvyHED/fFaMC9UbHYQTGwKXFe+cN5KDDxbtHrj87n PL+fWMF9ySaI58gmbHfkrtPrKCXftXWv4DNqMTDtEpvbM58YWzjujDbL+aTEzELN7G/U 3ccOuszJVH3XhCaW5Lp3NE7tIoNnk13Pqy16vbYYRGCdGfWCJxdAB80CkW6d70pZpLh1 NGr9QW70lRKtCap1yRstNA645kKZR4tQgOBya+GxjIWRfTcb1EXtDshqB7+iDrdt/erH UMQw== X-Gm-Message-State: AOJu0YyLSDfIKB1MYquCnx547e45AeSZ16C8srvj7ZaduBIrO7yuUfsI 5s5qd67JVJnIoD7Cn+LztTDrOzxVB9kIfvAPG9U3qvi5aJKzPKnBn4kG2N6Gx3JcGw== X-Gm-Gg: AfdE7cnmaqUFHNMqh9bBi0ePylNginFad2WBlfJnz5b9YGsFVinXQtyM3GUH7S+3K/v 7+Rkkb7Sm1gXMq6+M0T6rqmktbHzmo18EVnTE276xOIXnpQ7SxRmLY3+uD3XUZrI29PkZ/uAm1j b31GWntAlUR+4hqB3AfbP4wP1pNo964XnKmZ1NycCS3441DAwhqIKPZZ91jsQ2S4NdW/RWpm5ah A0YqZAQsuDdR7ys/9LjhP11nyJc3sqKx47GBkrpvJj4FbADJkdSB4BwCABkI1quPvVm19CBe3gP yIHCn5Wot5ZEk9VwqKDf0fi87ioly2fim8pSJfBECavNTc6Ea0F/88ikvDKnHqLogrc2hpDTAGX kajtoVoJodYBUWNPZnA84N5XUKYBTy81VZhuR6FG6NYe2nu+xwDeNGIiUrg5LCtrjv3Ih8c9kfO tBBG1wgcdPzY1dIEmvqZlpruYlkEkqYaEKTqVtrTwI6snd X-Received: by 2002:a17:90b:1845:b0:381:152b:d596 with SMTP id 98e67ed59e1d1-38280d98d29mr7945422a91.11.1783301204708; Sun, 05 Jul 2026 18:26:44 -0700 (PDT) Received: from microsoft.com (c-73-15-160-255.hsd1.ca.comcast.net. [73.15.160.255]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-30f3d92c44bsm24972574eec.19.2026.07.05.18.26.43 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 Jul 2026 18:26:44 -0700 (PDT) Date: Sun, 5 Jul 2026 18:26:42 -0700 From: Noah Misch To: xunengzhou@gmail.com, aekorotkov@gmail.com Cc: pgsql-hackers@postgresql.org Subject: wait_event_type for WAIT FOR LSN Message-ID: <20260706012642.f9.noahmisch@microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/2.3.0 (2026-01-25) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk commit 7a39f43 wrote: > --- a/src/backend/utils/activity/wait_event_names.txt > +++ b/src/backend/utils/activity/wait_event_names.txt > @@ -76,34 +76,35 @@ ABI_compatibility: > # Wait Events - Client > # > # Use this category when a process is waiting to send data to or receive data > # from the frontend process to which it is connected. This is never used for > # a background process, which has no client connection. > # > > Section: ClassName - WaitEventClient > > CLIENT_READ "Waiting to read data from the client." > CLIENT_WRITE "Waiting to write data to the client." > GSS_OPEN_SERVER "Waiting to read data from the client while establishing a GSSAPI session." > LIBPQWALRECEIVER_CONNECT "Waiting in WAL receiver to establish connection to remote server." > LIBPQWALRECEIVER_RECEIVE "Waiting in WAL receiver to receive data from remote server." > SSL_OPEN_SERVER "Waiting for SSL while attempting connection." > WAIT_FOR_STANDBY_CONFIRMATION "Waiting for WAL to be received and flushed by the physical standby." > -WAIT_FOR_WAL_FLUSH "Waiting for WAL flush to reach a target LSN on a primary." > +WAIT_FOR_WAL_FLUSH "Waiting for WAL flush to reach a target LSN on a primary or standby." > WAIT_FOR_WAL_REPLAY "Waiting for WAL replay to reach a target LSN on a standby." > +WAIT_FOR_WAL_WRITE "Waiting for WAL write to reach a target LSN on a standby." > WAL_SENDER_WAIT_FOR_WAL "Waiting for WAL to be flushed in WAL sender process." > WAL_SENDER_WRITE_DATA "Waiting for any activity when processing replies from WAL receiver in WAL sender process." > > ABI_compatibility: WaitEventClient is about waiting for a socket to become readable or writable, so I think WAIT_FOR_WAL_* events don't fit in its scope. Sockets are just one of the ways to be in WAIT_FOR_WAL_*; other delay sources include local fsync and local replay, which could be disk-bound or CPU-bound. I think WAIT_FOR_WAL_* belong in WaitEventIPC. In the absence of objections, I'll change it that way: --- a/src/backend/utils/activity/wait_event_names.txt +++ b/src/backend/utils/activity/wait_event_names.txt @@ -91,5 +91,2 @@ SSL_OPEN_SERVER "Waiting for SSL while attempting connection." WAIT_FOR_STANDBY_CONFIRMATION "Waiting for WAL to be received and flushed by the physical standby." -WAIT_FOR_WAL_FLUSH "Waiting for WAL flush to reach a target LSN on a primary or standby." -WAIT_FOR_WAL_REPLAY "Waiting for WAL replay to reach a target LSN on a standby." -WAIT_FOR_WAL_WRITE "Waiting for WAL write to reach a target LSN on a standby." WAL_SENDER_WAIT_FOR_WAL "Waiting for WAL to be flushed in WAL sender process." @@ -164,2 +161,5 @@ SAFE_SNAPSHOT "Waiting to obtain a valid snapshot for a READ ONLY DEFER SYNC_REP "Waiting for confirmation from a remote server during synchronous replication." +WAIT_FOR_WAL_FLUSH "Waiting for WAL flush to reach a target LSN on a primary or standby." +WAIT_FOR_WAL_REPLAY "Waiting for WAL replay to reach a target LSN on a standby." +WAIT_FOR_WAL_WRITE "Waiting for WAL write to reach a target LSN on a standby." WAL_RECEIVER_EXIT "Waiting for the WAL receiver to exit." As further rationale, WaitEventClient says "never used for a background process". By xlogwait.c sizing its shmem to include NUM_AUXILIARY_PROCS, it's reserving the right to accept calls from background processes. As a side note related to that, the placement of WaitLSNCleanup() in ProcKill() but not AuxiliaryProcKill() would also need to change before welcoming auxiliary process use. Perhaps better than adding to AuxiliaryProcKill(), a separate on_shmem_exit callback for xlogwait.c would make it harder to miss callers needing it.