Skip to content

Commit 4950f09

Browse files
committed
Fix thinko when ending progress report for a backend
The logic ending progress reporting for a backend entry introduced by b6fb647 causes callers of pgstat_progress_end_command() to do some extra work when track_activities is enabled as the process fields are reset in the backend entry even if no command were started for reporting. This resets the fields only if a command is registered for progress reporting, and only if track_activities is enabled. Author: Masahiho Sawada Discussion: https://postgr.es/m/CAD21AoCry_vJ0E-m5oxJXGL3pnos-xYGCzF95rK5Bbi3Uf-rpA@mail.gmail.com Backpatch-through: 9.6
1 parent dbbae33 commit 4950f09

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/backend/postmaster/pgstat.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3181,10 +3181,10 @@ pgstat_progress_end_command(void)
31813181
{
31823182
volatile PgBackendStatus *beentry = MyBEEntry;
31833183

3184-
if (!beentry)
3184+
if (!beentry || !pgstat_track_activities)
31853185
return;
3186-
if (!pgstat_track_activities
3187-
&& beentry->st_progress_command == PROGRESS_COMMAND_INVALID)
3186+
3187+
if (beentry->st_progress_command == PROGRESS_COMMAND_INVALID)
31883188
return;
31893189

31903190
PGSTAT_BEGIN_WRITE_ACTIVITY(beentry);

0 commit comments

Comments
 (0)