Re: SIGSEGV taken on 8.1 during dump/reload

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: SIGSEGV taken on 8.1 during dump/reload
Дата
Msg-id 20051112172430.GC571@svana.org
обсуждение исходный текст
Ответ на Re: SIGSEGV taken on 8.1 during dump/reload  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: SIGSEGV taken on 8.1 during dump/reload  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Sat, Nov 12, 2005 at 12:03:00PM -0500, Tom Lane wrote:
> That would be attractive if we could get it to happen without the
> assumption that the library uses PG_FUNCTION_INFO_V1 ... but if it still
> needs that assumption, it doesn't seem like much of an improvement.
> It's not always easy for people to see dynamic-linker error messages,
> so I'd rather the message were issued under our control when possible.

If you want something that works even if people don't use
PG_FUNCTION_INFO_V1, you need something like the linux kernel source
does. During the main build the kernel generate a vmmagic.o object.
This defines a number of symbols including a block containing flags
about endianness, spinlocks, etc. Any module expecting to be loaded
needs to link it in. While loading you simply memcmp() the block with
what you're expecting and fail if it doesn't match.

Note, this is significantly more finegrained, in that it can pickup
descrepicies in HAVE_INT64_TIMESTAMP, NAMEDATALEN, INDEX_MAX_KEYS, etc.
The kind of things that currently appear in pg_controldata. In the
future maybe a 32/64 bit flag.

If we don't like imposing link time constraints, we could require
people to include:

#ifdef PG_MAGIC_BLOCK
PG_MAGIC_BLOCK;
#endif

In any one of their source files and put the definition in a header
file somewhere. This may be even better.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: SIGSEGV taken on 8.1 during dump/reload
Следующее
От: Tom Lane
Дата:
Сообщение: Re: SIGSEGV taken on 8.1 during dump/reload