Re: pg_filedump 9.3: checksums (and a few other fixes)

Поиск
Список
Период
Сортировка
От Jeff Davis
Тема Re: pg_filedump 9.3: checksums (and a few other fixes)
Дата
Msg-id 1371223571.27844.14.camel@jdavis
обсуждение исходный текст
Ответ на Re: pg_filedump 9.3: checksums (and a few other fixes)  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: pg_filedump 9.3: checksums (and a few other fixes)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Thu, 2013-06-13 at 20:09 -0400, Tom Lane wrote:
> What I propose we do about this is reduce backend/storage/page/checksum.c
> to something like
> 
> #include "postgres.h"
> #include "storage/checksum.h"
> #include "storage/checksum_impl.h"
> 
> moving all the code currently in the file into a new .h file.  Then,
> any external programs such as pg_filedump can use the checksum code
> by including checksum_impl.h.  This is essentially the same thing we
> did with the CRC support functionality some time ago.

Thank you for taking care of that. After seeing that it needed to be in
a header file, I was going to try doing it all as macros.

I have a question about the commit though: shouldn't both functions be
static if they are in a .h file? Otherwise, it could lead to naming
conflicts. I suppose it's wrong to include the implementation file
twice, but it still might be confusing if someone tries. Two ideas that
come to mind are: * make both static and then have a trivial wrapper in checksum.c * export one or both functions, but
use#ifndef CHECKSUM_IMPL_H to
 
prevent redefinition

> Also, we have the cut-point between checksum.c and bufpage.c at the
> wrong place.  IMO we should move PageCalcChecksum16 in toto into
> checksum.c (or really now into checksum_impl.h), because that and not
> just checksum_block() is the functionality that is wanted.

Agreed.

Regards,Jeff Davis





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

Предыдущее
От: Hannu Krosing
Дата:
Сообщение: Re: MD5 aggregate
Следующее
От: Tom Lane
Дата:
Сообщение: Re: pg_filedump 9.3: checksums (and a few other fixes)