Re: Block-level CRC checks

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Block-level CRC checks
Дата
Msg-id 20081112071857.GA28467@svana.org
обсуждение исходный текст
Ответ на Re: Block-level CRC checks  (Gregory Stark <stark@enterprisedb.com>)
Ответы Re: Block-level CRC checks  (Alvaro Herrera <alvherre@commandprompt.com>)
Список pgsql-hackers
On Mon, Nov 10, 2008 at 11:31:33PM +0000, Gregory Stark wrote:
> No, I just meant that you could calculate the CRC by scanning the whole buffer
> efficiently using one of the good word-wise CRC algorithms, then look at the
> line pointers to find the hint bits and subtract them out of the CRC. The
> result should be zero after adjusting for the hint bits.

If you're going to look at the line pointers anyway, couldn't you just
do it in one pass, like:

n = 0
next = &tuple[n].hintbits
pos = 0
while pos < BLOCK_SIZE: if pos == next:    CRC_ADD( block[pos] & mask )   n++   next = &tuple[n].hintbits  # If n ==
numtups,next = BLOCK_SIZE else:   CRC_ADD( block[pos] pos++ 

This only handles one byte of hintbits but can easily be extended. No
need to actually *store* the hintbit free version anywhere...

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 по дате отправления:

Предыдущее
От: Charlie Savage
Дата:
Сообщение: Re: 8.3 .4 + Vista + MingW + initdb = ACCESS_DENIED
Следующее
От: "Hitoshi Harada"
Дата:
Сообщение: Re: Windowing Function Patch Review -> NTH_VALUE