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 1w5sUK-003iYF-0L for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Mar 2026 21:43:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w5sUH-005hhO-0q for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Mar 2026 21:43:33 +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 1w5sUG-005hhF-33 for pgsql-hackers@lists.postgresql.org; Thu, 26 Mar 2026 21:43:33 +0000 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w5sUE-00000001MT5-3Q0W for pgsql-hackers@postgresql.org; Thu, 26 Mar 2026 21:43:33 +0000 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-b980b35534eso393007466b.1 for ; Thu, 26 Mar 2026 14:43:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774561410; cv=none; d=google.com; s=arc-20240605; b=JLu9JzFcX+zQeBZwUP9+jV/oSpRLRc4J5YxuqNIfCP+b9ewK0bMRqdt0DqnG3ysayl cFMzHAJDbeIDbyHv4PFexBAWfnXitH0i5Y+6bFoMiAg5f2mtbxmcqyg+UfoXqji8d02Q zCRO02W8udgGwK8maBxd03D9oxDOG5Oa7UJGvgz9sfot8cQtBzUJVCFvPy5pz2QSDmuC CQa+tMuqbcr1BT/zmOum0rYLMX4EFnEcrAb7Waxo4JLa2a4tZ9MwEKGczWbcSuQU2TKe z41cSyROHXKn10sC9y9fzm8zaWERix9cjk82WYKT9fS6zdxpqUF0E/QmZds3252zKfPm fBJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=1pk/CSripI0WFpCJtlsbe1zuym/1mDA7bl2uuzWG69g=; fh=XZ6zrJ2dW1GhcDbA23yzTcKmwuzhYgOCZN4d8f/uHGc=; b=PpC6HuUMwG24ZwQlz9udmpypGLDzZkbfBsubTQ95Qd2UDDaTuSjURLk8HNLqakBF+H eBk63kc84joLiYBLFpEsMnvKyqvV/Pkjmi0ZlQ0mjw10KHbzIGY43U2FBbtBEU6xUwPj WVTyfqSmMH0ClRnCm7gbwgdWR8YXZFh/J+iQuox1ZO/66Hw3LedkpYJHvdXVoxL6Z+S6 0CCTUKd98eFwdHOEHPpQO0vD/S0Ky5+IooHD732Xo9/66iR+bQAY/GIsXr84jeIS2OQZ OipQ1AT4bo9Zd/ufzytoqrPMYwpwefCr3qRhKPCL5xkzOsjAlycZ/cO+/SDVYnHbqKeb QqkQ==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774561410; x=1775166210; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=1pk/CSripI0WFpCJtlsbe1zuym/1mDA7bl2uuzWG69g=; b=lvMNELjVc/TXYHqIv2ISEWygfHenhxcH7ME4qrYLs52pe16HBFiPXzJdVhwUD429eu E5DZ3aowdFLO1UVSv6uKnfU8Eqns7vC7XGViJaqfWxtiUhH5tJBvejywIXtf8BG7R95b 5ErspA8FGRgnzZZ9BTUi+r8wVo+eS/TASVIA4RlvqJuYq2JfctVONlyrK1+ngh5nXH0q ljWzQ+k5Y3+7RsJNCMVeCFKNAdjiODXjE6TEHMujOCeTk8xsW6cEmwVhtsvnWmzp6jxx NTpXwkBcXVpavLiDu6BITk1SkK7jq8ja2yUYILAUQBfRDOZtwGVxEqMWvLkpmw2XVbqM PwKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774561410; x=1775166210; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=1pk/CSripI0WFpCJtlsbe1zuym/1mDA7bl2uuzWG69g=; b=QV24Kp6h0w0rpGW+l9XrRz0/nHm7YCnmgB9nndjVr8XsJxYOGxxidEL/fqssxL/H4H tjmMn/YHSMCOAFSrIYduG8lchqRGOVsHJklZat2/NwV6BY8Lbk3dpBPDDCFrQ/14xx1p teXecz+Fok7JSEKfYKzrm6hq0JtORYi2L/os5sLr/hHy2XxqbCgAddz+tgTqAUFOHVmT 5fds6VVnjv/ibNZxN5FZmQ6nFIe1Kn3tOI8LZpCfpBQq/vt0iBWnOWzCUpCE4imd3s68 qa1Fn+npJYTp885vPy1GTwH9v2G4gC28mmvjESepokrceHR/B6tcB9H7RsYIsDDuQHt4 gnxA== X-Forwarded-Encrypted: i=1; AJvYcCUqxNCznLNmI+JULF2WlPz6BkkwHr3BfX60xEhUFRGj/SfTwQx7aXK1Z36BY+RqHXcoGX2h8rnzUqjWgCmo@postgresql.org X-Gm-Message-State: AOJu0YwZieVfho2Tgegnc6ZB/HyPMhpniRNU3CeDx0LSRK0OLT8OUZ8n a8fcxNpZQOlowLOEAeQxkeBFtLU4LzMBlOydXOMVNnNn75K2z3mS3yuM5YRjYCwYINNiUW8upEe zZF3SvslPTBVyUrAHko9NjGl9DGLLYIign475 X-Gm-Gg: ATEYQzys0NghENfqP6dFLXtI21sGacg/74fbWKN057rgD8Pa2nyUB0Q0WbHny6RzTHW 50SLXdxAnm+3ahJ+YO/XTR9U5ZzOZ6/f0PZ698YtyhoGPyUTHCcBJ9oA6wiCMDn0lSzjkIaVa4j jzrLEhjyjq9+NoImIDnMAn/a/DRINk/tAGybKgcnYKI1S5XPqbezqZeet1ZFC3I0NiPvTUpdCrm l5gMvsnMsPiw7gr4bg+N0f7Lo2zN5YO0+GX/ShKV9vRQS2+LBNaj6DGLZrA8O8Fo6GkGx48j2vY /9WsYXolB2Dfab1CzeyiFOEoJcvKazOMyy34H1E6Dhb4r0seqd4DWqI8R7I0lzf6qaRiJdXM8Wz mJODQk2HP X-Received: by 2002:a17:907:3f8d:b0:b97:b88c:386b with SMTP id a640c23a62f3a-b9b2eb9bd1bmr191143466b.29.1774561409664; Thu, 26 Mar 2026 14:43:29 -0700 (PDT) MIME-Version: 1.0 References: <42rdu4q44kvsq53fz5qgzuawqpaytvnemsnquynlfch5mqhc2m@6ytnlgivtzro> In-Reply-To: From: Melanie Plageman Date: Thu, 26 Mar 2026 17:43:17 -0400 X-Gm-Features: AQROBzDP7IdKZ58QQWd_V4zBxHdurZvroap9ceb-r1RAquJzNa3S_d1ZFCctntQ Message-ID: Subject: Re: Don't synchronously wait for already-in-progress IO in read stream To: Andres Freund Cc: Nazir Bilal Yavuz , Thomas Munro , pgsql-hackers@postgresql.org, Peter Geoghegan , Tomas Vondra Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Mar 25, 2026 at 5:58=E2=80=AFPM Andres Freund = wrote: > > I'm planning to commit 0001 soon - it hasn't changed in a while. Then I'd= like > to get 0002 committed soon after, but I'll hold off for that until tomorr= ow, > given that nobody has looked at it (as it's new). I think 0004-0007 can = be > committed too, but I am not sure if you (Melanie) want to do so. This is a review of 0002 in read_buffers(): - you forgot to initialize operation->forknum - I think the output columns could really use a bit of documentation - I assume that using uint16 for nblocks and nios is to make sure it plays nice with the input nblocks which is an int32 -- it doesn't matter for the range of values you're using, but it would be better if you could just use uint32 everywhere but I guess because we only have int4 in SQL you can't. anyway, I find all the many different types of ints and uints in read_buffers() pretty sus. Like why do you need this cast to int16? that seems...wrong and unnecessary? values[3] =3D Int32GetDatum((int16) nblocks_this_io); in the evict_rel() refactor: - you need invalidate_one_block() to use the forknum parameter because otherwise temp tables won't evict any forks except the main fork for the tests themselves: - for the first test, # check that one larger read is done as multiple reads isn't the comment actually the opposite of what it is testing? 0|0|t|2 -- would be 1 2 block io starting at 0, no? seems like something like # check that consecutive misses are combined into one read would be better - for this comment: # but if we do it again, i.e. it's in s_b, there will be two operations technically you are also doing this for temp tables, so the comment isn't entirely correct. - For this test: # Verify that we aren't doing reads larger than io_combine_limit isn't this more just covering the logic in read_buffers()? AFAICT StartReadBuffers() only worries about the max IOs it can combine if it is near the segment boundary - For this: $psql_a->query_safe(qq|SELECT invalidate_rel_block('$table', 1)|); $psql_a->query_safe(qq|SELECT invalidate_rel_block('$table', 2)|); $psql_a->query_safe(qq|SELECT * FROM read_buffers('$table', 3, 2)|); psql_like( $io_method, $psql_a, "$persistency: read buffers, miss 1-2, hit 3-4", qq|SELECT blockoff, blocknum, needs_io, nblocks FROM read_buffers('$table', 1, 4)|, qr/^0\|1\|t\|2\n2\|3\|f\|1\n3\|4\|f\|1$/, qr/^$/); I think this is a duplicate. There is one before and after the "verify we aren't doing reads larger than io_combine_limit" - It may be worth adding one more test case which is IO in progress on the last block since you have in-progress as the first and the middle blocks but not as the last block # Test in-progress IO on the last block of the range $psql_a->query_safe(qq|SELECT evict_rel('$table')|); $psql_a->query_safe( qq|SELECT read_rel_block_ll('$table', 3, wait_complete=3D>false)|); psql_like( $io_method, $psql_a, "$persistency: read buffers, in-progress 3, read 1-3", qq|SELECT blockoff, blocknum, needs_io, nblocks FROM read_buffers('$table', 1, 3)|, qr/^0\|1\|t\|2\n2\|3\|f\|1$/, qr/^$/); - Melanie