Adding SMGR discriminator to buffer tags

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Shawn Debnath <sdn(at)amazon(dot)com>
Subject: Adding SMGR discriminator to buffer tags
Date: 2019-05-08 06:31:04
Message-ID: CA+hUKG+OZqOiOuDm5tC5DyQZtJ3FH4+FSVMqtdC4P1atpJ+qhg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello hackers,

On another thread, lots of undo log-related patches have been traded.
Buried deep in the stack is one that I'd like to highlight and discuss
in a separate thread, because it relates to a parallel thread of
development and it'd be good to get feedback on it.

In commit 3eb77eba, Shawn Debnath and I extended the checkpointer
fsync machinery to support more kinds of files. Next, we'd like to
teach the buffer pool to deal with more kinds of buffers. The context
for this collaboration is that he's working on putting things like
CLOG into shared buffers, and my EDB colleagues and I are working on
putting undo logs into shared buffers. We want a simple way to put
any block-structured stuff into shared buffers, not just plain
"relations".

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.

Thoughts?

[1] https://www.postgresql.org/message-id/flat/CA%2BhUKG%2BDE0mmiBZMtZyvwWtgv1sZCniSVhXYsXkvJ_Wo%2B83vvw%40mail.gmail.com

--
Thomas Munro
https://enterprisedb.com

Attachment Content-Type Size
0001-Add-SmgrId-to-smgropen-and-BufferTag.patch application/octet-stream 64.0 KB
0002-Move-tablespace-dir-creation-from-smgr.c-to-md.c.patch application/octet-stream 2.8 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Etsuro Fujita 2019-05-08 06:51:25 Missing FDW documentation about GetForeignUpperPaths
Previous Message Ashwin Agrawal 2019-05-08 06:18:39 Re: Pluggable Storage - Andres's take