| From: | Manfred Koizar <mkoi-pg(at)aon(dot)at> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | pgsql-patches(at)postgresql(dot)org |
| Subject: | Re: Wrap access to Oid in HeapTupleHeader |
| Date: | 2002-07-03 14:06:50 |
| Message-ID: | 1cu5iu0f5ps86j5ja3c9k4q308gucsi5m6@4ax.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-patches |
On Mon, 01 Jul 2002 11:10:20 -0400, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
wrote:
>Yes, but I still think the Assert is useless. The only thing it can
>catch is failure to set t_hoff before touching the OID, but in practice
>if t_hoff has not been set then it will be uninitialized garbage; the
>odds that the Assert will actually fire are only about 1 in 10.
Sad, but true. Thanks for pointing that out.
AssertMacro((tup)->t_hoff >= offsetof(HeapTupleHeaderData, t_bits))
should be
AssertMacro((tup)->t_hoff == ExpectedLen(tup))
where
#define ExpectedLen(tup) MAXALIGN( \
offsetof(HeapTupleHeaderData, t_bits) + \
(((tup)->t_infomask | HEAP_HASNULL) \
? BITMAPLEN((tup)->t_natts) : 0) \
)
Sure, this is even more expensive, but it catches 255 out of 256
errors.
On Mon, 01 Jul 2002 10:40:34 -0400, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote
on -hackers:
>Also, you could be a little more conservative about
>adding Asserts --- those are not free, at least not from a development
>point of view, so I object to adding multiple redundant Asserts in
>hotspot routines.
Messing around with tuple headers is delicate stuff IMHO, and I don't
want to be remembered as the man who broke the best open source
database. So I cowardly put in those Asserts ... If you are concerned
about performance in development versions, is there any chance you
could be convinced of a configurable paranoia level? Then I could
write
Assert3(...)
which would expand to
if (PARANOIA_LEVEL >= 3) Assert(...)
Servus
Manfred
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2002-07-03 14:21:40 | Re: Wrap access to Oid in HeapTupleHeader |
| Previous Message | Manfred Koizar | 2002-07-03 10:26:33 | Re: [PATCHES] Reduce heap tuple header size |