Re: "type with xxxx does not exist" when doing ExecMemoize()

Поиск
Список
Период
Сортировка
От Tender Wang
Тема Re: "type with xxxx does not exist" when doing ExecMemoize()
Дата
Msg-id CAHewXNkjBAPY8L+-yiLGOvee41A3aoHZArkcUm1OCtYhDp8eTQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: "type with xxxx does not exist" when doing ExecMemoize()  (Tender Wang <tndrwang@gmail.com>)
Ответы Re: "type with xxxx does not exist" when doing ExecMemoize()  (Andrei Lepikhov <a.lepikhov@postgrespro.ru>)
Список pgsql-hackers
Hi,

When I think about how to add a test case for v5 version patch, and I want to test if v5 version patch has memory leak.
This thread [1] provided a way how to repeat the memory leak, so I used it to test v5 patch. I didn't found memory leak on
v5 patch.

But I found other interesting issue. When changed whereClause in [1],  the query reported below error:

"ERROR could not find memoization table entry"

the query:
EXPLAIN analyze
select sum(q.id_table1)
from (
SELECT t2.*
FROM table1 t1
JOIN table2 t2
ON (t2.id_table1 + t2.id_table1) = t1.id) q;

But on v5 patch, it didn't report error.

I guess it is the same reason that data in probeslot was reset in Hash function.

I debug the above query, and get this:
before
(gdb) p *(DatumGetNumeric(mstate->probeslot->tts_values[0]))
$1 = {vl_len_ = 48, choice = {n_header = 32770, n_long = {n_sign_dscale = 32770, n_weight = 60, n_data = 0x564632ebd708}, n_short = {n_header = 32770, n_data = 0x564632ebd706}}}
after
(gdb) p *(DatumGetNumeric(mstate->probeslot->tts_values[0]))
$2 = {vl_len_ = 264, choice = {n_header = 32639, n_long = {n_sign_dscale = 32639, n_weight = 32639, n_data = 0x564632ebd6a8}, n_short = {n_header = 32639, n_data = 0x564632ebd6a6}}}

So after call ResetExprContext() in Hash function, the data in probeslot is corrupted.  It is not sure what error will happen when executing on corrupted data.

During debug, I learned that numeric_add doesn't have type check like rangetype, so aboved query will not report "type with xxx does not exist".

And I realize that  the test case added by Andrei Lepikhov  in v3 is right. So in v6 patch I add Andrei Lepikhov's test case.  Thanks a lot.

Now I think the v6 version patch seems to be complete now.




--
Tender Wang
OpenPie:  https://en.openpie.com/
Вложения

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

Предыдущее
От: Bertrand Drouvot
Дата:
Сообщение: Re: Synchronizing slots from primary to standby
Следующее
От: "Zhijie Hou (Fujitsu)"
Дата:
Сообщение: RE: Synchronizing slots from primary to standby