bt_recheck_sibling_links contrib/amcheck/verify_nbtree.c

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: bt_recheck_sibling_links contrib/amcheck/verify_nbtree.c
Date: 2023-07-24 14:06:34
Message-ID: CACJufxH8D-4xw7Qq-uMFCStWATisSLuL+oYT54C3_dRLZh37Yw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

hi.
I am confused with bt_recheck_sibling_links.

>
> ereport(ERROR,
> (errcode(ERRCODE_INDEX_CORRUPTED),
> errmsg("left link/right link pair in index \"%s\" not in agreement",
> RelationGetRelationName(state->rel)),
> errdetail_internal("Block=%u left block=%u left link from block=%u.",
> state->targetblock, leftcurrent,
> btpo_prev_from_target)));

should we put the above code into the branch {if (!state->readonly)} ?
I can understand it if put inside.
now the whole function be like:

if (!state->readonly)
{}
erreport{}.

---------------------------------------------------------------------------------
if (btpo_prev_from_target == leftcurrent)
{
/* Report split in left sibling, not target (or new target) */
ereport(DEBUG1,
(errcode(ERRCODE_INTERNAL_ERROR),
errmsg_internal("harmless concurrent page split detected in index \"%s\"",
RelationGetRelationName(state->rel)),
errdetail_internal("Block=%u new right sibling=%u original right sibling=%u.",
leftcurrent, newtargetblock,
state->targetblock)));
return;
}

only concurrency read case, (btpo_prev_from_target == leftcurrent)
will be true? If so, then I am confused with the ereport content.

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2023-07-24 14:52:05 Re: logical decoding and replication of sequences, take 2
Previous Message Alvaro Herrera 2023-07-24 13:54:33 Re: [BUG] Crash on pgbench initialization.