Re: Page type and version

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Manfred Koizar <mkoi-pg(at)aon(dot)at>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Page type and version
Date: 2002-07-06 02:42:25
Message-ID: 200207060242.g662gPC13614@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Manfred Koizar wrote:
> As the upcoming release is breaking compatibility anyway: what do you
> think about placing a magic number and some format version info into
> the page header?
>
> One 32-bit-number per page should be enough to encode page type and
> version. We have just to decide, how we want it:
>
> a) combine page type and version into a single 32-bit magic number
>
> HEAPPAGE73 = 0x63c490c9
> HEAPPAGE74 = 0x540beeb3
> ...
> BTREE73 = 0x8cdc8edb
> BTREE74 = 0xbb13f0a1
>
> b) use n bits for the page type and the rest for a version number
>
> HEAPPAGE73 = 0x63c40703
> HEAPPAGE74 = 0x63c40704
> ...
> BTREE73 = 0x8cdc0703
> BTREE74 = 0x8cdc0704
>
> The latter has the advantage, that the software could easily check for
> a version range (e.g. if (PageGetVersion(page) <= 0x0703) ...).

Yea, b) sounds good.

> One might argue, that one magic number *per file* should be
> sufficient. That would mean, that the first page of a file had to
> have a different format. Btree has such a meta page; I don't know
> about the other access methods.

Heap used to have a header page too but it was removed long ago.

We do have the TODO item:

* Add version file format stamp to heap and other table types

but I am now questioning why that is there. btree had a version stamp,
so I thought heap should have one too, but because the PG_VERSION file
is in every directory, isn't that all that is needed for version
information.

My vote is just to remove the btree version. If we decide to implement
multi-version reading in the backend, we can add it where appropriate.

> With a magic number in every single page it could even be possible to
> do a smooth upgrade: "Just install Postgres 8.0 and continue to use
> your PostgreSQL 7.4 databases" :-). Whenever the backend reads an old
> format page it uses alternative accessor routines. New pages are
> written in the new format. Or the database can be run in
> compatibility mode ... I'm dreaming ...

Yes, and as I understand, it is pretty easy from a tuple to snoop to the
end of the block to see what version stamp is there. Will we ever use
it?

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2002-07-06 02:59:13 Thread discussion
Previous Message Bruce Momjian 2002-07-06 02:17:46 Re: Typo in htup.h comment