[HACKERS] Page type and version

2002-07-05 Thread Manfred Koizar

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?

Servus
 Manfred



---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send unregister YourEmailAddressHere to [EMAIL PROTECTED])





Re: [HACKERS] Page type and version

2002-07-05 Thread Bruce Momjian

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
  [EMAIL PROTECTED]   |  (610) 853-3000
  +  If your life is a hard drive, |  830 Blythe Avenue
  +  Christ can be your backup.|  Drexel Hill, Pennsylvania 19026



---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly