1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-15 19:21:59 +03:00

Invalidate relcache when changing REPLICA IDENTITY index.

When changing REPLICA IDENTITY INDEX to another one, the target table's
relcache was not being invalidated. This leads to skipping update/delete
operations during apply on the subscriber side as the columns required to
search corresponding rows won't get logged.

Author: Tang Haiying, Hou Zhijie
Reviewed-by: Euler Taveira, Amit Kapila
Backpatch-through: 10
Discussion: https://postgr.es/m/OS0PR01MB61133CA11630DAE45BC6AD95FB939@OS0PR01MB6113.jpnprd01.prod.outlook.com
This commit is contained in:
Amit Kapila
2021-11-16 08:34:24 +05:30
parent 99389cb66b
commit 232fd72a5e
2 changed files with 89 additions and 1 deletions

View File

@ -15344,6 +15344,12 @@ relation_mark_replica_identity(Relation rel, char ri_type, Oid indexOid,
CatalogTupleUpdate(pg_index, &pg_index_tuple->t_self, pg_index_tuple);
InvokeObjectPostAlterHookArg(IndexRelationId, thisIndexOid, 0,
InvalidOid, is_internal);
/*
* Invalidate the relcache for the table, so that after we commit
* all sessions will refresh the table's replica identity index
* before attempting any UPDATE or DELETE on the table.
*/
CacheInvalidateRelcache(rel);
}
heap_freetuple(pg_index_tuple);
}