access method: are disk pages mandatory?

Started by Leonardo Fover 15 years ago3 messages
#1Leonardo F
m_lists@yahoo.it

in bufpage.h:

"all blocks written out by an access method must be disk pages"

but in
http://www.postgresql.org/docs/8.4/static/storage-page-layout.html

"Actually, index access methods need not use this page format. All the
existing index methods do use this basic format, but the data kept on
index metapages usually doesn't follow the item layout rules."

I'm not getting it: am I supposed to use the "disk page format" when
writing an index access method, or it's just a "good practice" because
it makes the handling easier? Given the docs it looks "recommended",
but the comment on the code sounds more "mandatory".

#2Heikki Linnakangas
heikki.linnakangas@enterprisedb.com
In reply to: Leonardo F (#1)
Re: access method: are disk pages mandatory?

On 23/06/10 18:17, Leonardo F wrote:

in bufpage.h:

"all blocks written out by an access method must be disk pages"

but in
http://www.postgresql.org/docs/8.4/static/storage-page-layout.html

"Actually, index access methods need not use this page format. All the
existing index methods do use this basic format, but the data kept on
index metapages usually doesn't follow the item layout rules."

I'm not getting it: am I supposed to use the "disk page format" when
writing an index access method, or it's just a "good practice" because
it makes the handling easier? Given the docs it looks "recommended",
but the comment on the code sounds more "mandatory".

It's recommened because it makes life easier. Even if you don't use the
normal page format, I think you need to have the LSN at the beginning of
the page. The rest is up to you.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Heikki Linnakangas (#2)
Re: access method: are disk pages mandatory?

Heikki Linnakangas <heikki.linnakangas@enterprisedb.com> writes:

On 23/06/10 18:17, Leonardo F wrote:

I'm not getting it: am I supposed to use the "disk page format" when
writing an index access method, or it's just a "good practice" because
it makes the handling easier? Given the docs it looks "recommended",
but the comment on the code sounds more "mandatory".

It's recommened because it makes life easier. Even if you don't use the
normal page format, I think you need to have the LSN at the beginning of
the page. The rest is up to you.

The bufpage.h comment is ancient and might not be 100% gospel anymore.
However, I believe the buffer manager does assume that any page in
shared buffers has a standard page header including LSN. It definitely
assumes there's an LSN, and I think we have validity checks on the other
page header fields somewhere inside ReadBuffer. You don't however need
to use the item-and-item-pointer-array structure if it's not useful to
you.

regards, tom lane