Skip to content

Commit 270eee5

Browse files
committed
add 2pc to test_decoding
1 parent 85a83ef commit 270eee5

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

contrib/test_decoding/test_decoding.c

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,10 +232,25 @@ pg_decode_commit_txn(LogicalDecodingContext *ctx, ReorderBufferTXN *txn,
232232
return;
233233

234234
OutputPluginPrepareWrite(ctx, true);
235+
236+
switch(txn->xact_action)
237+
{
238+
case XLOG_XACT_COMMIT:
239+
appendStringInfoString(ctx->out, "COMMIT");
240+
break;
241+
case XLOG_XACT_PREPARE:
242+
appendStringInfoString(ctx->out, "PREPARE");
243+
break;
244+
case XLOG_XACT_COMMIT_PREPARED:
245+
appendStringInfoString(ctx->out, "COMMIT PREPARED");
246+
break;
247+
case XLOG_XACT_ABORT_PREPARED:
248+
appendStringInfoString(ctx->out, "ABORT PREPARED");
249+
break;
250+
}
251+
235252
if (data->include_xids)
236-
appendStringInfo(ctx->out, "COMMIT %u", txn->xid);
237-
else
238-
appendStringInfoString(ctx->out, "COMMIT");
253+
appendStringInfo(ctx->out, " %u", txn->xid);
239254

240255
if (data->include_timestamp)
241256
appendStringInfo(ctx->out, " (at %s)",

0 commit comments

Comments
 (0)