aboutsummaryrefslogtreecommitdiff
path: root/src/backend/replication/logical/worker.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/replication/logical/worker.c')
-rw-r--r--src/backend/replication/logical/worker.c48
1 files changed, 27 insertions, 21 deletions
diff --git a/src/backend/replication/logical/worker.c b/src/backend/replication/logical/worker.c
index 98c26002e83..689a66cc72d 100644
--- a/src/backend/replication/logical/worker.c
+++ b/src/backend/replication/logical/worker.c
@@ -1477,12 +1477,13 @@ apply_handle_update_internal(ApplyExecutionData *edata,
else
{
/*
- * The tuple to be updated could not be found.
+ * The tuple to be updated could not be found. Do nothing except for
+ * emitting a log message.
*
- * TODO what to do here, change the log level to LOG perhaps?
+ * XXX should this be promoted to ereport(LOG) perhaps?
*/
elog(DEBUG1,
- "logical replication did not find row for update "
+ "logical replication did not find row to be updated "
"in replication target relation \"%s\"",
RelationGetRelationName(localrel));
}
@@ -1589,9 +1590,14 @@ apply_handle_delete_internal(ApplyExecutionData *edata,
}
else
{
- /* The tuple to be deleted could not be found. */
+ /*
+ * The tuple to be deleted could not be found. Do nothing except for
+ * emitting a log message.
+ *
+ * XXX should this be promoted to ereport(LOG) perhaps?
+ */
elog(DEBUG1,
- "logical replication did not find row for delete "
+ "logical replication did not find row to be deleted "
"in replication target relation \"%s\"",
RelationGetRelationName(localrel));
}
@@ -1728,31 +1734,31 @@ apply_handle_tuple_routing(ApplyExecutionData *edata,
found = FindReplTupleInLocalRel(estate, partrel,
&part_entry->remoterel,
remoteslot_part, &localslot);
-
- oldctx = MemoryContextSwitchTo(GetPerTupleMemoryContext(estate));
- if (found)
- {
- /* Apply the update. */
- slot_modify_data(remoteslot_part, localslot,
- part_entry,
- newtup);
- MemoryContextSwitchTo(oldctx);
- }
- else
+ if (!found)
{
/*
- * The tuple to be updated could not be found.
+ * The tuple to be updated could not be found. Do nothing
+ * except for emitting a log message.
*
- * TODO what to do here, change the log level to LOG
- * perhaps?
+ * XXX should this be promoted to ereport(LOG) perhaps?
*/
elog(DEBUG1,
- "logical replication did not find row for update "
- "in replication target relation \"%s\"",
+ "logical replication did not find row to be updated "
+ "in replication target relation's partition \"%s\"",
RelationGetRelationName(partrel));
+ return;
}
/*
+ * Apply the update to the local tuple, putting the result in
+ * remoteslot_part.
+ */
+ oldctx = MemoryContextSwitchTo(GetPerTupleMemoryContext(estate));
+ slot_modify_data(remoteslot_part, localslot, part_entry,
+ newtup);
+ MemoryContextSwitchTo(oldctx);
+
+ /*
* Does the updated tuple still satisfy the current
* partition's constraint?
*/