From: | Himanshu Upadhyaya <upadhyaya(dot)himanshu(at)gmail(dot)com> |
---|---|
To: | Aleksander Alekseev <aleksander(at)timescale(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com> |
Subject: | Re: HOT chain validation in verify_heapam() |
Date: | 2022-09-19 16:20:40 |
Message-ID: | CAPF61jD6zewYmYY88hq5XYzW1bAuRBYChnRYGuCQ7cAZ9C3vPA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mon, Sep 19, 2022 at 8:27 PM Aleksander Alekseev <
aleksander(at)timescale(dot)com> wrote:
> Hi Himanshu,
>
> > Done, updated in the v3 patch.
>
> Thanks for the updated patch.
>
> Here is v4 with fixed compiler warnings and some minor tweaks from me.
>
> I didn't put too much thought into the algorithm but I already see
> something strange. At verify_heapam.c:553 you declared curr_xmax and
> next_xmin. However the variables are not used/initialized until you
> do:
>
> ```
> if (lp_valid[nextoffnum] && lp_valid[ctx.offnum] &&
> TransactionIdIsValid(curr_xmax) &&
> TransactionIdEquals(curr_xmax, next_xmin)) {
> /* ... */
> ```
>
> In v4 I elected to initialize both curr_xmax and next_xmin with
> InvalidTransactionId for safety and in order to silence the compiler
> but still there is no way this condition can succeed.
>
> Please make sure there is no logic missing.
>
>
Hi Aleksander,
Thanks for sharing the feedback,
It's my mistake, sorry about that, I was trying to merge two if conditions
and forgot to move the initialization part for xmin and xmax. Now I think
that it will be good to have nested if, and have an inner if condition to
test xmax and xmin matching. This way we can retrieve and populate xmin and
xmax when it is actually required for the inner if condition.
I have changed this in the attached patch.
--
Regards,
Himanshu Upadhyaya
EnterpriseDB: http://www.enterprisedb.com
Attachment | Content-Type | Size |
---|---|---|
v4-0001-HOT-chain-validation-in-verify_heapam.patch | text/x-patch | 9.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Zhang Mingli | 2022-09-19 16:27:30 | Re: Free list same_input_transnos in preprocess_aggref |
Previous Message | Japin Li | 2022-09-19 16:19:58 | Tab complete for CREATE SUBSCRIPTION ... CONECTION does not work |