aboutsummaryrefslogtreecommitdiff
path: root/src/backend/replication/logical/worker.c
diff options
context:
space:
mode:
authorAmit Kapila <akapila@postgresql.org>2022-06-16 08:32:10 +0530
committerAmit Kapila <akapila@postgresql.org>2022-06-16 08:32:10 +0530
commit0980adfd4d021e3329bf41452ce1a1210321974f (patch)
tree2d8b140d999463fe6afa1acc38d9869f84adb7e4 /src/backend/replication/logical/worker.c
parentd457cb4e8a5e25fe16420cb91cb8450d8fca49d3 (diff)
downloadpostgresql-0980adfd4d021e3329bf41452ce1a1210321974f.tar.gz
postgresql-0980adfd4d021e3329bf41452ce1a1210321974f.zip
Fix data inconsistency between publisher and subscriber.
We were not updating the partition map cache in the subscriber even when the corresponding remote rel is changed. Due to this data was getting incorrectly replicated for partition tables after the publisher has changed the table schema. Fix it by resetting the required entries in the partition map cache after receiving a new relation mapping from the publisher. Reported-by: Shi Yu Author: Shi Yu, Hou Zhijie Reviewed-by: Amit Langote, Amit Kapila Backpatch-through: 13, where it was introduced Discussion: https://postgr.es/m/OSZPR01MB6310F46CD425A967E4AEF736FDA49@OSZPR01MB6310.jpnprd01.prod.outlook.com
Diffstat (limited to 'src/backend/replication/logical/worker.c')
-rw-r--r--src/backend/replication/logical/worker.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/backend/replication/logical/worker.c b/src/backend/replication/logical/worker.c
index 833b2809d0b..bf97fa44ba2 100644
--- a/src/backend/replication/logical/worker.c
+++ b/src/backend/replication/logical/worker.c
@@ -1191,6 +1191,9 @@ apply_handle_relation(StringInfo s)
rel = logicalrep_read_rel(s);
logicalrep_relmap_update(rel);
+
+ /* Also reset all entries in the partition map that refer to remoterel. */
+ logicalrep_partmap_reset_relmap(rel);
}
/*