amcheck: detect duplicate PostingItem keys in GIN posting trees
От
Stepan Neretin
Тема
amcheck: detect duplicate PostingItem keys in GIN posting trees
Дата
Msg-id
CA+Yyo5TGUHKaMF25S5wUp6seOuez_4BnpcnGJzn6VoUuVT_png@mail.gmail.com
Список
Дерево обсуждения
amcheck: detect duplicate PostingItem keys in GIN posting trees Stepan Neretin <slpmcf@gmail.com>
Re: amcheck: detect duplicate PostingItem keys in GIN posting trees Sofia Kopikova <s.kopikova@postgrespro.ru>
Hi,
gin_index_check() compares adjacent separator keys on posting-tree
internal pages with ItemPointerCompare(...) < 0, so it reports
out-of-order keys but misses duplicates.
Equal separators should not occur: each PostingItem key is the child
page's right bound (dataPrepareDownlink), and leaf TIDs are strictly
increasing, so siblings must be strictly ascending. dataLocateItem
also treats equal keys as an exact match to that downlink. Entry-tree
checks already reject equals (>= 0); posting trees should do the same.
The attached patch changes the comparison to <= 0 and adds a TAP test
that corrupts two adjacent keys to be equal.
Best regards, Stepan Neretin.
gin_index_check() compares adjacent separator keys on posting-tree
internal pages with ItemPointerCompare(...) < 0, so it reports
out-of-order keys but misses duplicates.
Equal separators should not occur: each PostingItem key is the child
page's right bound (dataPrepareDownlink), and leaf TIDs are strictly
increasing, so siblings must be strictly ascending. dataLocateItem
also treats equal keys as an exact match to that downlink. Entry-tree
checks already reject equals (>= 0); posting trees should do the same.
The attached patch changes the comparison to <= 0 and adds a TAP test
that corrupts two adjacent keys to be equal.
Best regards, Stepan Neretin.
В списке pgsql-hackers по дате отправления