Re: BUG #17792: MERGE uses uninitialized pointer and crashes when target tuple is updated concurrently

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: BUG #17792: MERGE uses uninitialized pointer and crashes when target tuple is updated concurrently
Дата
Msg-id 20230214112933.cshqgnzpcioedizy@alvherre.pgsql
обсуждение исходный текст
Ответ на BUG #17792: MERGE uses uninitialized pointer and crashes when target tuple is updated concurrently  (PG Bug reporting form <noreply@postgresql.org>)
Ответы Re: BUG #17792: MERGE uses uninitialized pointer and crashes when target tuple is updated concurrently  (Alexander Lakhin <exclusion@gmail.com>)
Re: BUG #17792: MERGE uses uninitialized pointer and crashes when target tuple is updated concurrently  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Список pgsql-bugs
On 2023-Feb-14, PG Bug reporting form wrote:

> When executing the following queries with valgrind:
> echo "
> CREATE TABLE source (sid integer);
> INSERT INTO source VALUES (1);
> CREATE TABLE target (tid integer, tval integer);
> INSERT INTO target VALUES (1, 1);
> " | psql

> At nodeModifyTable.c:2992 I see:
>                     if (!TupIsNull(context->cpUpdateRetrySlot))
> 
> It looks like cpUpdateRetrySlot was not initialized on the context creation
> in ExecModifyTable(), and ExecCrossPartitionUpdate(), where it could get a
> value, just not called for this case.

Hmm, yeah: because this is not a partitioned table, we are definitely
not expecting that cpUpdateRetrySlot will be set.  Can you still
reproduce the problem with the attached patch?


I'm not sure that the location of the initialization is best.  My first
impulse was to add it in line 3618, with the "Set global context" lines;
but then I think it's possible for one tuple of a partition to be routed
correctly and a later one that is concurrently updated suffer from an
improper value in cpUpdateRetrySlot.

Also, the comment is not great ...

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/

Вложения

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

Предыдущее
От: PG Bug reporting form
Дата:
Сообщение: BUG #17793: Query with large number of joins crashes PostgreSQL
Следующее
От: Francisco Olarte
Дата:
Сообщение: Re: BUG #17793: Query with large number of joins crashes PostgreSQL