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 1vyY04-000CgZ-01 for pgsql-hackers@arkaria.postgresql.org; Fri, 06 Mar 2026 16:26:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vyY01-0063TW-1W for pgsql-hackers@arkaria.postgresql.org; Fri, 06 Mar 2026 16:26:01 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vyXww-005zxb-0F for pgsql-hackers@lists.postgresql.org; Fri, 06 Mar 2026 16:22:50 +0000 Received: from lahtoruutu.iki.fi ([2a0b:5c81:1c1::37]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vyXwt-00000000nRN-3C2U for pgsql-hackers@lists.postgresql.org; Fri, 06 Mar 2026 16:22:49 +0000 Received: from [10.0.2.15] (unknown [130.41.208.2]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hlinnaka) by lahtoruutu.iki.fi (Postfix) with ESMTPSA id 4fSBX36NcDz49PtL; Fri, 06 Mar 2026 18:22:43 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1772814164; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1sGZ4AS69XjHhreTyUHtTelko4vfcDmTQN9tgSZDmFc=; b=Zs9TP3Nhnth5IgxlnAMJXZ7fMC1XIii/IFTKahFggT9AU48dIuYTHoN537JEr2LW2FkKF3 opoEJNMTtvpktA0VndVMxUCD0FqalmE2hCyLLrkfUUANvay4QL8nBRnElHVUv5KYcTTEYt mV4oieuNEi906ktv3Mxut7cBhsPXzeIWamGCGzdgAG0ZdC5OuHQPr1c6rea4MIjCixgsX0 HJVkHqiIvfSMGYarsm2Lq9MSYA6Tl0XmnZXwomhTVCBf1aHChDRBi/wVpTVOHVgDZ/mpJ1 3zO8gVyDMctl6KJAn3LW2ucspwyIKoARgTvmhGrBA5PqqF0zC3lNStzUnc3+4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1772814164; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1sGZ4AS69XjHhreTyUHtTelko4vfcDmTQN9tgSZDmFc=; b=EDKtL98+bTVt7gSNBhid6Sj7ZXGc9v5pM3HLyKDv2+CNt+gvXaG0AUJmACq1xMJX8QV7XC t57QdupzcEd4Smp0drtpiAwOhBSq+zqjULV+5K3aEMujuhJ8lnQBkLz0SgFhGnJEikUwBg z3GmP8wkdo1ZB1Rxsq+l/DuBX6rYyPT0GzX5pdtm2msF8KxBd9KFQi/0vOZ7QfgIeWXiSW TZjNVK473K2K83QevffHRA2qjyyXRkHeUePKRuoqRvIoabPqd5PEe/m5iAF9OSAvyUpY2T Nv4leRln+W2wS0bCREfANzKhA1VNKXA3WF6gCvEzBm1aGmoChtilumuVEzEEvw== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=hlinnaka smtp.mailfrom=hlinnaka@iki.fi ARC-Seal: i=1; a=rsa-sha256; d=iki.fi; s=lahtoruutu; cv=none; t=1772814164; b=kd2pmAQYO2zOZ+RPIQb96QEfPQV4FmHa1e/rMDMdEa/GiD/3gITAQGt3jOH8lRIUhBuqoQ pV9EagHdFzT1kW9Uggmeaf/9B3LJFLVG52A1c2qCmZKmnV0fze9oH0dsTTcXiIlPuGI0OV +YZ7UOZYIUSTd5Q52XjCWqGgoSSbcl+M8U0HXk+daqm6Oqjl+vajpULMpuAESjQi1WRo2M raESMGUkDNez/PLOHYHw7GQujl1hLiI0rkIDlSwyFH74Na9L77G07UqfVHsJyan3LHK9U5 74bKk1UxVpowvruWxpI1XJLJMAmFqa4Mpvgh08/xkIFerDRda9IpBP2jk/DObw== Message-ID: <74f5dc14-29fd-46d9-ba8b-2844328d7bdf@iki.fi> Date: Fri, 6 Mar 2026 18:22:42 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Rework SLRU I/O errors handle To: =?UTF-8?Q?=C3=81lvaro_Herrera?= Cc: Maxim Orlov , Postgres hackers References: <202603061507.6ynh6qimlcma@alvherre.pgsql> Content-Language: en-US From: Heikki Linnakangas In-Reply-To: <202603061507.6ynh6qimlcma@alvherre.pgsql> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 06/03/2026 17:33, Álvaro Herrera wrote: > I'm not a fan of the split. I think it all these patches should be > pushed as a single commit, and avoid introducing xact_errmsg_for_io_error > as an exposed function. I think that doesn't make a lot of sense. Each > SLRU should have a correct and appropriate error reporting callback. Agreed. > The comment added in 0005 is bogus too. It mentions InvalidTransactionId, > but the problem is not that the value is 0 but rather that we get no > pointer. Also, in all other callbacks the pointer is asserted to not be > NULL, so why don't we do the same here, and avoid an error message > that's not going to help anyone? I see however that in the patch we're > passing a NULL to SlruReportIOError(), which means if you get an IO > error with any SLRU other than xact, you're going to get either a crash > on the assertion, or (on non-debug builds) a crash on dereferencing the > NULL pointer. Hmm, I thought we could just never pass a NULL pointer, but if a Write fails, slru.c has no context where to pull that opaque_data. Perhaps we should just not call the callback in that case. I'm starting to feel that what SlruReportIOError() currently uses as the errdetail, could well be the main error message, and the callback could provide the errdetail. I.e. swap the errmsg and errdetail we have now. That way, we can just leave out the errdetail for Write failures. The current errmsg we have for Write failures is pretty bad: "ERROR: could not access status of transaction 0". What's currently the errdetail, e.g. "Could not read from file \"%s\" at offset %d: %m", is a lot more informative. - Heikki