From: Andres Freund <andres@anarazel.de>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: tableam: Don't assume that every AM uses md.c style storage.
Date: Sat, 18 May 2019 02:10:46 +0000
Message-ID: <E1hRooA-0006mT-73@gemulon.postgresql.org> (raw)
tableam: Don't assume that every AM uses md.c style storage.
Previously various parts of the code routed size requests through
RelationGetNumberOfBlocks[InFork]. That works if md.c is used by the
AM, but not otherwise.
Add a tableam callback to return the size of the table. As not every
AM will use postgres' BLCKSZ, have it return bytes, and have
RelationGetNumberOfBlocksInFork() round the byte size up into blocks.
To allow code outside of the AM to determine the actual relation size
map InvalidForkNumber the total size of a relation, as not every AM
might just need the postgres defined forks.
A few users of RelationGetNumberOfBlocks() ought to be converted away
from that. One case, the use of it to determine whether a tid is
valid, will be fixed in a follow up commit. Others will have to wait
for v13.
Author: Andres Freund
Discussion: https://postgr.es/m/20190423225201.3bbv6tbqzkb5w7cw@alap3.anarazel.de
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/7f44ede5941499c4cee13b812dd93335f4005095
Modified Files
--------------
src/backend/access/heap/heapam_handler.c | 27 ++++++++++++++++++++
src/backend/access/table/tableamapi.c | 3 +++
src/backend/storage/buffer/bufmgr.c | 43 +++++++++++++++++++++++++++++---
src/include/access/tableam.h | 40 +++++++++++++++++++++++++++++
4 files changed, 110 insertions(+), 3 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: andres@anarazel.de
Subject: Re: pgsql: tableam: Don't assume that every AM uses md.c style storage.
In-Reply-To: <E1hRooA-0006mT-73@gemulon.postgresql.org>
References: <E1hRooA-0006mT-73@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox