Re: Page type and version

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: Page type and version
Дата
Msg-id 200207060242.g662gPC13614@candle.pha.pa.us
обсуждение исходный текст
Ответ на Page type and version  (Manfred Koizar <mkoi-pg@aon.at>)
Список 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@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Typo in htup.h comment
Следующее
От: Bruce Momjian
Дата:
Сообщение: Thread discussion