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 1wDdpP-003CGA-0t for pgsql-hackers@arkaria.postgresql.org; Fri, 17 Apr 2026 07:41:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wDdpM-008xKn-36 for pgsql-hackers@arkaria.postgresql.org; Fri, 17 Apr 2026 07:41:24 +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 1wDdpM-008xKf-1x for pgsql-hackers@lists.postgresql.org; Fri, 17 Apr 2026 07:41:24 +0000 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wDdpK-00000001cYn-0cQE for pgsql-hackers@lists.postgresql.org; Fri, 17 Apr 2026 07:41:24 +0000 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-2a871daa98fso2388725ad.1 for ; Fri, 17 Apr 2026 00:41:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776411680; x=1777016480; darn=lists.postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=tBvUjF45wezx8FYpeZb7G23ZHiu9bBvfd5e58mcccCA=; b=mS2Hxvl6u7UnzDEjW70Eovfju92JWg4bGNIED/NNs2c8RaXVCwd2+wAHLFDIkBEIUl esWxJdFgOaHfQKWARViA2q6qmCZK8NF76urs6CrsS0C3FeO9PGvoET5NpG/w+TqUbJtA j+8xHT4YC+npJDznksgcop8fIh7KUn9RY/qYDf0QJlFboZoeKSX2iy4/cN0dR7sp+CUA bn1Nx1Yz596V+sBwIabJg1bQGyHFjc+xyHOitnafoSMI919wyNYsQ/TpN9LleaG7RN0w LH4Cg6A82EFcyU7kPkzjGZftBGtPfgKvqw7Ae6/pBrYslRNpj9SY6Ib4DK6Y7LCOQF2b jUjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776411680; x=1777016480; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=tBvUjF45wezx8FYpeZb7G23ZHiu9bBvfd5e58mcccCA=; b=mepeXAms6YAsm5U88Kuh+TJ+rqTjehbalAo60kL+SI8zkrxO0ERLRkttJNRW98iSVP QmYGc//ITmGiqYGZVC15KdUiZy5i/p0UwkpdOAgqogncnbnSNIJbCQcI51rdLdNuvZ9e DfHMlPjJyj8fAATSlbfhAU9tO8oEDB7rGE/TSmyASfW/SchNcZwwSeXm1kzObTPsQKHQ lqbM4Yy5gWkUqowUQS2qU7918TI8PtE7mbr+N+5Gh0qIR53w/vfpL83ofhBLo+nM/pWx 8uMlDRCfhKKH7jCa44yKvZcSe3zZZUe2Nha/61TU5yLb8ZCuqA2TDWqUtuazgH8c2Fze W4iw== X-Gm-Message-State: AOJu0YxH30cG9CNuW6RtZRAyUxTDprxkMQHE2ZwiprZkQMfqNwVGudOx mKddmZGCuNjnn4BMeV4uhPbzO1ileYIE+S2vDgPgKgUgDWZ4GJNoaR6B X-Gm-Gg: AeBDievSg9OEaPcum7lSZ3xWYiE6UNMOIZEcqUoBB1FM8xHRWN2+o+XY1eELjDcuxeX 8H20Po8vJcQnfcuvfZW755Rf0pvyUoNq1q76tYO9APAuH9LJry2zG4mDeXqDuQmlmlMOrIW/sNE nP+S69ZiOTWpZxfKpV97X977A45EAflVY1hFGTvSQ3RCM0TDqSbzeY2h4N1Pd0OnEDyqu3g78Mu hdFfDzu7GLyZBuPFoFWXRsHemLyM1r60OKG2mRDsQMVoOnL4zJIQjs1mipLKMsF7mLFBrzA9X7t 0EuIbIgesznSimeLCBNUKhGD7tlIqs0peIp41slojyicYVt2Xx6XzAk7/Kfx7NL/kXnK8JblE+M UJnpj+I9u7Mi8lzz4PK+qwnmeaazhEwxu14xkp/C/XRKBWOu2CwPvHMfCnPrxlhgcO48FKEMGMk c4NzXRB8y18mwLPbWoCva5i2pihJOguiZnvyccNckU/A== X-Received: by 2002:a17:903:1104:b0:2b4:6529:7b9f with SMTP id d9443c01a7336-2b5f9f37032mr19109985ad.26.1776411680110; Fri, 17 Apr 2026 00:41:20 -0700 (PDT) Received: from smtpclient.apple ([45.32.121.103]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b5fab20c6asm10107225ad.58.2026.04.17.00.41.18 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Apr 2026 00:41:19 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.400.21\)) Subject: Re: Fix stats reporting delays in logical parallel apply worker From: Chao Li In-Reply-To: Date: Fri, 17 Apr 2026 15:40:40 +0800 Cc: PostgreSQL Hackers , Amit Kapila Content-Transfer-Encoding: quoted-printable Message-Id: <4F6FFB88-72EE-4685-BF58-5450FE3D5009@gmail.com> References: To: "Zhijie Hou (Fujitsu)" X-Mailer: Apple Mail (2.3864.400.21) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Apr 17, 2026, at 11:35, Zhijie Hou (Fujitsu) = wrote: >=20 > On Friday, April 17, 2026 11:01 AM Zhijie Hou (Fujitsu) = wrote: >> Hi, >>=20 >> When implementing another feature, I noticed that parallel apply = workers >> currently do not report statistics while idle in their main loop. = This can cause >> stats from the last processed transaction to be arbitrarily delayed, = especially >> when there are long gaps between streamed transactions. >>=20 >> The issue is demonstrated in 0002, where a TAP test fails when = attempting to >> collect stats from a parallel apply worker that has no subsequent = transaction >> to >> trigger a stats report. >>=20 >> 0001 fixes this issue by forcing a stats report when the worker is = idle in the >> main loop, matching the behavior already present in = LogicalRepApplyLoop() >> for >> regular logical apply workers. >=20 > Regarding 0002, I realized that the streaming option is now set to = 'parallel' by > default so can avoid adjusting the option again. The test needs to be = adjusted > to increase the worker limit so that a parallel worker can start. Here = are the > updated patches. >=20 > Best Regards, > Hou zj > = I think WaitLatch will never return WL_LATCH_SET and WL_TIMEOUT = together, so we can do =E2=80=9Celse if (rc & WL_TIMEOUT) && = !IsTransactionState())=E2=80=9D, so that upon WL_LATCH_SET, it skips the = WL_TIMEOUT check, which could be slightly more efficient. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/