diff options
author | Michael Paquier <michael@paquier.xyz> | 2023-07-14 11:16:10 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2023-07-14 11:16:10 +0900 |
commit | bdaaf1bf1d90d8c510f18f81edbe90e54262c9df (patch) | |
tree | b25678e5e538f07a662e79cadcf769202ed3d269 /src | |
parent | c89d74c18b508a865849a422d5ac1df1299ac898 (diff) | |
download | postgresql-bdaaf1bf1d90d8c510f18f81edbe90e54262c9df.tar.gz postgresql-bdaaf1bf1d90d8c510f18f81edbe90e54262c9df.zip |
Add indisreplident to fields refreshed by RelationReloadIndexInfo()
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
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/utils/cache/relcache.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index c37e43a9044..ad5511247a4 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -2318,6 +2318,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, |