amcheck: detect duplicate PostingItem keys in GIN posting trees - Mailing list pgsql-hackers

From Stepan Neretin
Subject amcheck: detect duplicate PostingItem keys in GIN posting trees
Date
Msg-id CA+Yyo5TGUHKaMF25S5wUp6seOuez_4BnpcnGJzn6VoUuVT_png@mail.gmail.com
Whole thread
Responses Re: amcheck: detect duplicate PostingItem keys in GIN posting trees
List pgsql-hackers
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.
Attachment

pgsql-hackers by date:

Previous
From: Noah Misch
Date:
Subject: Re: sequencesync worker race with REFRESH SEQUENCES
Next
From: Christoph Berg
Date:
Subject: Re: meson vs. llvm bitcode files