File tree 3 files changed +12
-4
lines changed
3 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -769,9 +769,10 @@ allow_immediate_pgstat_restart(void)
769
769
/* ----------
770
770
* pgstat_report_stat() -
771
771
*
772
- * Called from tcop/postgres.c to send the so far collected per-table
773
- * and function usage statistics to the collector. Note that this is
774
- * called only when not within a transaction, so it is fair to use
772
+ * Must be called by processes that performs DML: tcop/postgres.c, logical
773
+ * receiver processes, SPI worker, etc. to send the so far collected
774
+ * per-table and function usage statistics to the collector. Note that this
775
+ * is called only when not within a transaction, so it is fair to use
775
776
* transaction stop time as an approximation of current time.
776
777
* ----------
777
778
*/
Original file line number Diff line number Diff line change @@ -114,9 +114,15 @@ StringInfo copybuf = NULL;
114
114
static void pg_attribute_noreturn ()
115
115
finish_sync_worker (void )
116
116
{
117
- /* Commit any outstanding transaction. */
117
+ /*
118
+ * Commit any outstanding transaction. This is the usual case, unless
119
+ * there was nothing to do for the table.
120
+ */
118
121
if (IsTransactionState ())
122
+ {
119
123
CommitTransactionCommand ();
124
+ pgstat_report_stat (false);
125
+ }
120
126
121
127
/* And flush all writes. */
122
128
XLogFlush (GetXLogWriteRecPtr ());
Original file line number Diff line number Diff line change @@ -462,6 +462,7 @@ apply_handle_commit(StringInfo s)
462
462
/* Process any tables that are being synchronized in parallel. */
463
463
process_syncing_tables (commit_data .end_lsn );
464
464
465
+ pgstat_report_stat (false);
465
466
pgstat_report_activity (STATE_IDLE , NULL );
466
467
}
467
468
You can’t perform that action at this time.
0 commit comments