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)