Re: [sqlsmith] crashes in RestoreSnapshot on hot standby

Поиск
Список
Период
Сортировка
От Thomas Munro
Тема Re: [sqlsmith] crashes in RestoreSnapshot on hot standby
Дата
Msg-id CAEepm=1EEesHpk8a=YFisNYyqHwELYD3vFKS=AHhKmCQi1v69A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [sqlsmith] crashes in RestoreSnapshot on hot standby  (Amit Kapila <amit.kapila16@gmail.com>)
Ответы Re: [sqlsmith] crashes in RestoreSnapshot on hot standby  (Amit Kapila <amit.kapila16@gmail.com>)
Список pgsql-hackers
On Fri, Jul 1, 2016 at 3:25 PM, Amit Kapila <amit.kapila16@gmail.com> wrote:
> On Fri, Jul 1, 2016 at 8:48 AM, Thomas Munro <thomas.munro@enterprisedb.com>
> wrote:
>> If serialized_snapshot->xcnt == 0, then snapshot->xip never gets
>> initialized to a non-NULL value.  Then if serialized_snapshot->subxcnt
>> > 0, we set snapshot->subxip = snapshot->xip +
>> serialized_snapshot->xcnt (so that's NULL too).  Then in line the line
>> you show we call memcpy(snapshot->subxip, ...).  The fix might be
>> something like the attached.
>
> I was just typing the mail, when I see this mail.  I also reached to the
> conclusion that this is the reason of crash.  You can see how CopySnapshot
> calculates the subxipoff, may be writing code that way will be more
> consistent.

Or maybe just like this?

-               snapshot->subxip = snapshot->xip + serialized_snapshot->xcnt;
+               snapshot->subxip = ((TransactionId *) (snapshot + 1)) +
+                       serialized_snapshot->xcnt;

--
Thomas Munro
http://www.enterprisedb.com

Вложения

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

Предыдущее
От: Noah Misch
Дата:
Сообщение: Re: Bug in batch tuplesort memory CLUSTER case (9.6 only)
Следующее
От: Noah Misch
Дата:
Сообщение: Re: Broken handling of lwlocknames.h