Re: WAL, xl_heap_insert and tuple oid mystry

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Re: WAL, xl_heap_insert and tuple oid mystry
Дата
Msg-id 4DA3F748.9020806@enterprisedb.com
обсуждение исходный текст
Ответ на WAL, xl_heap_insert and tuple oid mystry  (jagan <jaganrvce@yahoo.com>)
Ответы Re: WAL, xl_heap_insert and tuple oid mystry  (jagan <jaganrvce@yahoo.com>)
Re: WAL, xl_heap_insert and tuple oid mystry  (Greg Stark <gsstark@mit.edu>)
Re: WAL, xl_heap_insert and tuple oid mystry  (jagan <jaganrvce@yahoo.com>)
Список pgsql-hackers
On 11.04.2011 23:35, jagan wrote:
> Hi,
> Suppose I create a table as follows:
>
> CREATE TABLE test2 (name TEXT, age INTEGER) WITH oids;
>
> Now, for every tuple in this table is associated with a unique oid, which I can retrieve by:
>
> SELECT oid, name, age FROM test2;
>
> which works great. So far so good.
>
> Now, if look at the corresponding WAL entry for any insert into this relation, it creates the following WAL entry
whichI can decode.
 
>
> XLogRecord --->  Followed by -->  xl_heap_insert struct -->followed by -->  xl_heap_header -->  Followed by -->
tupledata
 
>
> If I use the macro  HeapTupleHeaderGetOid([xl_heap_header struct])

Yeah, that won't work because xl_heap_header is not a HeapTupleHeader.

> or equivalently if I test ([xl_heap_header struct]->t_infomask&  HEAP_HASOID), it tells me that the tuple oid is not
storedwith this record.
 

That's strange, the flag should be set.

> Where is the OID of tuple stored in a WAL record of a tuple? If not with xl_heap_header, where is it stored? Is it
storedat all?
 

It's stored in the "tuple data" portion. See the code that writes the 
WAL record, here:


http://git.postgresql.org/gitweb?p=postgresql.git;a=blob;f=src/backend/access/heap/heapam.c;h=1fbd8b39b4a73f6aee337fccf2dcce548d0850bb;hb=HEAD#l1987

Maybe the WAL record you're looking at is a full-page image? A record 
with a full-page image includes a verbatim copy of the page, and the 
individual tuple is omitted in that case.

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


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

Предыдущее
От: Jesper Krogh
Дата:
Сообщение: Re: Locking when concurrent updated of foreign references
Следующее
От: Bernd Helmle
Дата:
Сообщение: Re: Back branch update releases this week; beta postponed