Re: Block-level CRC checks

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Block-level CRC checks
Дата
Msg-id 20081112201609.GA7661@svana.org
обсуждение исходный текст
Ответ на Re: Block-level CRC checks  (Alvaro Herrera <alvherre@commandprompt.com>)
Ответы Re: Block-level CRC checks  (Alvaro Herrera <alvherre@commandprompt.com>)
Список pgsql-hackers
On Wed, Nov 12, 2008 at 11:08:13AM -0300, Alvaro Herrera wrote:
> For this to work, we would have to create two (or more) versions of the
> calculate checksum macro, one for heap pages and other for other pages.
> I'm not sure how bad is that.  The bit that's worse is that we'd need to
> have external knowledge of what kind of page we're talking about (i.e.
> FlushBuffer would need to know whether a page is heap or another kind).

I think all you need is a macro (say COMP_CRC32_ONE) that adds a single
byte to the checksum, then use COMP_CRC32 for the bulk of the work.
Yes, you'd need to distinguish different kinds of pages.

Seems to me the xlog code already has plenty of examples on how to do
acrobatics with CRCs.

> However, your idea suggests something else that we could do to improve
> the patch: skip the ItemId->lp_flags during the CRC calculation.  This
> would mean we wouldn't need to WAL-log those.  The problem with that is
> that lp_flags are only 2 bits, so we would need to iterate zeroing them
> and restore them after CRC_COMP() instead of simply skipping.

Not sure why you're so intent on actually changing memory just so you can use
COMP_CRC32, which is just a for loop around the COMP_CRC32_ONE I
mentioned. Actually changing the memory probably means locking so why
bother.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while
> boarding. Thank you for flying nlogn airlines.

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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: Block-level CRC checks
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: Block-level CRC checks