Add indisreplident to fields refreshed by RelationReloadIndexInfo()
authorMichael Paquier <[email protected]>
Fri, 14 Jul 2023 02:16:08 +0000 (11:16 +0900)
committerMichael Paquier <[email protected]>
Fri, 14 Jul 2023 02:16:08 +0000 (11:16 +0900)
RelationReloadIndexInfo() is a fast-path used for index reloads in the
relation cache, and it has always forgotten about updating
indisreplident, which is something that would happen after an index is
selected for a replica identity.  This can lead to incorrect cache
information provided when executing a command in a transaction context
that updates indisreplident.

None of the code paths currently on HEAD that need to check upon
pg_index.indisreplident fetch its value from the relation cache, always
relying on a fresh copy on the syscache.  Unfortunately, this may not be
the case of out-of-core code, that could see out-of-date value.

Author: Shruthi Gowda
Reviewed-by: Robert Haas, Dilip Kumar, Michael Paquier
Discussion: https://postgr.es/m/CAASxf_PBcxax0wW-3gErUyftZ0XrCs3Lrpuhq4-Z3Fak1DoW7Q@mail.gmail.com
Backpatch-through: 11

src/backend/utils/cache/relcache.c

index dcf56d4790097ffd55260cdf72a32e1599310a49..6c7a5a04fcbe4990ccf7659aa4d91d1d0ba4f495 100644 (file)
@@ -2296,6 +2296,7 @@ RelationReloadIndexInfo(Relation relation)
        relation->rd_index->indcheckxmin = index->indcheckxmin;
        relation->rd_index->indisready = index->indisready;
        relation->rd_index->indislive = index->indislive;
+       relation->rd_index->indisreplident = index->indisreplident;
 
        /* Copy xmin too, as that is needed to make sense of indcheckxmin */
        HeapTupleHeaderSetXmin(relation->rd_indextuple->t_data,