File tree Expand file tree Collapse file tree 3 files changed +12
-4
lines changed
Expand file tree Collapse file tree 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)
769769/* ----------
770770 * pgstat_report_stat() -
771771 *
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
775776 * transaction stop time as an approximation of current time.
776777 * ----------
777778 */
Original file line number Diff line number Diff line change @@ -114,9 +114,15 @@ StringInfo copybuf = NULL;
114114static void pg_attribute_noreturn ()
115115finish_sync_worker (void )
116116{
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+ */
118121 if (IsTransactionState ())
122+ {
119123 CommitTransactionCommand ();
124+ pgstat_report_stat (false);
125+ }
120126
121127 /* And flush all writes. */
122128 XLogFlush (GetXLogWriteRecPtr ());
Original file line number Diff line number Diff line change @@ -462,6 +462,7 @@ apply_handle_commit(StringInfo s)
462462 /* Process any tables that are being synchronized in parallel. */
463463 process_syncing_tables (commit_data .end_lsn );
464464
465+ pgstat_report_stat (false);
465466 pgstat_report_activity (STATE_IDLE , NULL );
466467}
467468
You can’t perform that action at this time.
0 commit comments