aboutsummaryrefslogtreecommitdiff
path: root/src/backend/replication/logical/decode.c
diff options
context:
space:
mode:
authorAmit Kapila <akapila@postgresql.org>2021-05-06 11:21:26 +0530
committerAmit Kapila <akapila@postgresql.org>2021-05-06 11:21:26 +0530
commit592f00f8dec68038301467a904ac514eddabf6cd (patch)
tree5bc251cc881aa61308c32e9996a9ca770acf5279 /src/backend/replication/logical/decode.c
parent7f2e10baa2482494dbcf70e0ae6f0469771e0b4c (diff)
downloadpostgresql-592f00f8dec68038301467a904ac514eddabf6cd.tar.gz
postgresql-592f00f8dec68038301467a904ac514eddabf6cd.zip
Update replication statistics after every stream/spill.
Currently, replication slot statistics are updated at prepare, commit, and rollback. Now, if the transaction is interrupted the stats might not get updated. Fixed this by updating replication statistics after every stream/spill. In passing update the docs to change the description of some of the slot stats. Author: Vignesh C, Sawada Masahiko Reviewed-by: Amit Kapila Discussion: https://postgr.es/m/20210319185247.ldebgpdaxsowiflw@alap3.anarazel.de
Diffstat (limited to 'src/backend/replication/logical/decode.c')
-rw-r--r--src/backend/replication/logical/decode.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/backend/replication/logical/decode.c b/src/backend/replication/logical/decode.c
index 7924581cdcd..888e064ec0f 100644
--- a/src/backend/replication/logical/decode.c
+++ b/src/backend/replication/logical/decode.c
@@ -746,9 +746,10 @@ DecodeCommit(LogicalDecodingContext *ctx, XLogRecordBuffer *buf,
}
/*
- * Update the decoding stats at transaction prepare/commit/abort. It is
- * not clear that sending more or less frequently than this would be
- * better.
+ * Update the decoding stats at transaction prepare/commit/abort.
+ * Additionally we send the stats when we spill or stream the changes to
+ * avoid losing them in case the decoding is interrupted. It is not clear
+ * that sending more or less frequently than this would be better.
*/
UpdateDecodingStats(ctx);
}
@@ -828,9 +829,10 @@ DecodePrepare(LogicalDecodingContext *ctx, XLogRecordBuffer *buf,
ReorderBufferPrepare(ctx->reorder, xid, parsed->twophase_gid);
/*
- * Update the decoding stats at transaction prepare/commit/abort. It is
- * not clear that sending more or less frequently than this would be
- * better.
+ * Update the decoding stats at transaction prepare/commit/abort.
+ * Additionally we send the stats when we spill or stream the changes to
+ * avoid losing them in case the decoding is interrupted. It is not clear
+ * that sending more or less frequently than this would be better.
*/
UpdateDecodingStats(ctx);
}