v10-0006-Debug-messages.patch
text/x-patch
Filename: v10-0006-Debug-messages.patch
Type: text/x-patch
Part: 5
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch v10-0006
Subject: Debug messages
| File | + | − |
|---|---|---|
| src/backend/replication/pgoutput/pgoutput.c | 14 | 0 |
| src/test/subscription/t/020_row_filter.pl | 1 | 0 |
From 7a855df32c456ead8f0634f122c569c82022ba88 Mon Sep 17 00:00:00 2001
From: Euler Taveira <euler.taveira@enterprisedb.com>
Date: Fri, 29 Jan 2021 23:28:13 -0300
Subject: [PATCH 6/7] Debug messages
---
src/backend/replication/pgoutput/pgoutput.c | 14 ++++++++++++++
src/test/subscription/t/020_row_filter.pl | 1 +
2 files changed, 15 insertions(+)
diff --git a/src/backend/replication/pgoutput/pgoutput.c b/src/backend/replication/pgoutput/pgoutput.c
index dd6f3bda3a..17a728c0bf 100644
--- a/src/backend/replication/pgoutput/pgoutput.c
+++ b/src/backend/replication/pgoutput/pgoutput.c
@@ -518,6 +518,10 @@ pgoutput_row_filter_exec_expr(ExprState *state, ExprContext *econtext)
ret = ExecEvalExprSwitchContext(state, econtext, &isnull);
+ elog(DEBUG2, "pgoutput_row_filter_exec_expr: ret: %d ; isnull: %d",
+ DatumGetBool(ret) ? 1 : 0,
+ isnull ? 1 : 0);
+
if (isnull)
return false;
@@ -543,6 +547,8 @@ pgoutput_row_filter(Relation relation, HeapTuple oldtuple, HeapTuple newtuple, L
if (list_length(rowfilter) == 0)
return true;
+ elog(DEBUG1, "table %s has row filter", get_rel_name(relation->rd_id));
+
tupdesc = RelationGetDescr(relation);
estate = create_estate_for_relation(relation);
@@ -566,6 +572,7 @@ pgoutput_row_filter(Relation relation, HeapTuple oldtuple, HeapTuple newtuple, L
Oid exprtype;
Expr *expr;
ExprState *exprstate;
+ char *s = NULL;
/* Prepare expression for execution */
exprtype = exprType(rfnode);
@@ -585,6 +592,13 @@ pgoutput_row_filter(Relation relation, HeapTuple oldtuple, HeapTuple newtuple, L
result = pgoutput_row_filter_exec_expr(exprstate, ecxt);
/* If the tuple does not match one of the row filters, bail out */
+ s = TextDatumGetCString(DirectFunctionCall2(pg_get_expr, CStringGetTextDatum(nodeToString(rfnode)), ObjectIdGetDatum(relation->rd_id)));
+ if (result)
+ elog(DEBUG2, "pgoutput_row_filter: row filter \"%s\" matched", s);
+ else
+ elog(DEBUG2, "pgoutput_row_filter: row filter \"%s\" not matched", s);
+ pfree(s);
+
if (!result)
break;
}
diff --git a/src/test/subscription/t/020_row_filter.pl b/src/test/subscription/t/020_row_filter.pl
index b8c059d44b..ea1d7c30ae 100644
--- a/src/test/subscription/t/020_row_filter.pl
+++ b/src/test/subscription/t/020_row_filter.pl
@@ -8,6 +8,7 @@ use Test::More tests => 6;
# create publisher node
my $node_publisher = get_new_node('publisher');
$node_publisher->init(allows_streaming => 'logical');
+$node_publisher->append_conf('postgresql.conf', 'log_min_messages = DEBUG2');
$node_publisher->start;
# create subscriber node
--
2.20.1