Skip to content

Commit

Permalink
Backpressure: reset ps display after it is done. (#8980)
Browse files Browse the repository at this point in the history
Previously we set the 'backpressure throttling' status, but overwrote
current one and never reset it back.
  • Loading branch information
arssher authored Oct 1, 2024
1 parent 17672c8 commit 62e22df
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions pgxn/neon/walproposer_pg.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,9 @@ backpressure_throttling_impl(void)
TimestampTz start,
stop;
bool retry = false;
char *new_status = NULL;
const char *old_status;
int len;

if (PointerIsValid(PrevProcessInterruptsCallback))
retry = PrevProcessInterruptsCallback();
Expand All @@ -442,14 +445,24 @@ backpressure_throttling_impl(void)
if (lag == 0)
return retry;

/* Suspend writers until replicas catch up */
set_ps_display("backpressure throttling");

old_status = get_ps_display(&len);
new_status = (char *) palloc(len + 64 + 1);
memcpy(new_status, old_status, len);
snprintf(new_status + len, 64, "backpressure throttling: lag %lu", lag);
set_ps_display(new_status);
new_status[len] = '\0'; /* truncate off " backpressure ..." to later reset the ps */

elog(DEBUG2, "backpressure throttling: lag %lu", lag);
start = GetCurrentTimestamp();
pg_usleep(BACK_PRESSURE_DELAY);
stop = GetCurrentTimestamp();
pg_atomic_add_fetch_u64(&walprop_shared->backpressureThrottlingTime, stop - start);

/* Reset ps display */
set_ps_display(new_status);
pfree(new_status);

return true;
}

Expand Down

1 comment on commit 62e22df

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5022 tests run: 4863 passed, 1 failed, 158 skipped (full report)


Failures on Postgres 17

# Run all failed tests locally:
scripts/pytest -vv -n $(nproc) -k "test_pageserver_compaction_smoke[release-pg17]"
Flaky tests (1)

Postgres 17

Test coverage report is not available

The comment gets automatically updated with the latest test results
62e22df at 2024-10-01T18:35:54.300Z :recycle:

Please sign in to comment.