Fix tuple search during apply after concurrent index DDL. When searching the local relation by index, the apply worker can use the first match only if the index is the relation's replica identity or primary key. Otherwise, every match must be compared with the search slot.
Only the index OID was saved in the relation map, so this was determined again during the search. Concurrent DROP INDEX or REINDEX can change the index status between these two checks, causing the tuple search to fail and the change to be silently skipped as an update_missing conflict. Fix this by recording the answer as idxisreplident in the relation map entry and avoid getting it second time in FindReplTupleInLocalRel() and RelationFindReplTupleByIndex(). Oversight in 89e46da5e5. Author: Mikhail Nikalayeu <[email protected]> Author: vignesh C <[email protected]> Reviewed-by: Amit Kapila <[email protected]> Reviewed-by: Zhijie Hou <[email protected]> Discussion: https://postgr.es/m/cadzflwujovfcnkncc9wjzkecx9xecgngzc2r2tmv8h4qdd_...@mail.gmail.com Backpatch-through: 16, where it was introduced Branch ------ REL_16_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/2389f898eea60b445191b1bcaafada29781ab9dc Modified Files -------------- src/backend/executor/execReplication.c | 37 ++++++++++--- src/backend/replication/logical/relation.c | 18 +++++-- src/backend/replication/logical/worker.c | 83 +++++++++++++++++------------- src/include/executor/executor.h | 5 ++ src/include/replication/logicalrelation.h | 4 ++ 5 files changed, 98 insertions(+), 49 deletions(-)
