Page type and version - Mailing list pgsql-hackers

From Manfred Koizar
Subject Page type and version
Date
Msg-id hf8ciu8t87i46rn8shtkfufc5brk1re83m@4ax.com
Whole thread Raw
Responses Re: Page type and version  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
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) ...).

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.

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 ...

Thoughts?

ServusManfred




pgsql-hackers by date:

Previous
From: "Dann Corbit"
Date:
Subject: Re: (A) native Windows port
Next
From: Tatsuo Ishii
Date:
Subject: Re: Proposal: CREATE CONVERSION