Re: Adding SMGR discriminator to buffer tags

From: Shawn Debnath <sdn(at)amazon(dot)com>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Adding SMGR discriminator to buffer tags
Date: 2019-05-09 20:54:49
Message-ID: 20190509205449.GA98992@f01898859afd.ant.amazon.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, May 08, 2019 at 06:31:04PM +1200, Thomas Munro wrote:

> The questions are: how should buffer tags distinguish different kinds
> of buffers, and how should SMGR direct IO traffic to the right place
> when it needs to schlepp pages in and out?
>
> In earlier prototype code, I'd been using a special database number
> for undo logs. In a recent thread[1], Tom and others didn't like that
> idea much, and Shawn mentioned his colleague's idea of stealing unused
> bits from the fork number so that there is no net change in tag size,
> but we have entirely separate namespaces for each kind of buffered
> data.
>
> Here's a patch that does that, and then makes changes in the main
> places I have found so far that need to be aware of the new SMGR ID
> field.

Looks good to me. Minor nit: update the comment for XLogRecGetBlockTag:

diff --git a/src/backend/access/transam/xlogreader.c b/src/backend/access/transam/xlogreader.c
index 9196aa3aae..9ee086f00b 100644
--- a/src/backend/access/transam/xlogreader.c
+++ b/src/backend/access/transam/xlogreader.c
@@ -1349,12 +1353,13 @@ err:
/*
* Returns information about the block that a block reference refers to.
*
- * If the WAL record contains a block reference with the given ID, *rnode,
+ * If the WAL record contains a block reference with the given ID, *smgrid, *rnode,
* *forknum, and *blknum are filled in (if not NULL), and returns true.
* Otherwise returns false.
*/
bool
XLogRecGetBlockTag(XLogReaderState *record, uint8 block_id,
+ SmgrId *smgrid,
RelFileNode *rnode, ForkNumber *forknum, BlockNumber *blknum)
{
DecodedBkpBlock *bkpb;

--
Shawn Debnath
Amazon Web Services (AWS)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2019-05-09 21:07:28 Re: reloption to prevent VACUUM from truncating empty pages at the end of relation
Previous Message Ashwin Agrawal 2019-05-09 20:34:17 Re: Pluggable Storage - Andres's take