Skip to content

Commit

Permalink
Do not suspend compute if autovacuum is active (#6322)
Browse files Browse the repository at this point in the history
## Problem

Se.e
https://github.com/orgs/neondatabase/projects/49/views/13?pane=issue&itemId=48282912

## Summary of changes


Do not suspend compute if there are active auto vacuum workers

## Checklist before requesting a review

- [ ] I have performed a self-review of my code.
- [ ] If it is a core feature, I have added thorough tests.
- [ ] Do we need to implement analytics? if so did you add the relevant
metrics to the dashboard?
- [ ] If this PR requires public announcement, mark it with
/release-notes label and add several sentences in this section.

## Checklist before merging

- [ ] Do not forget to reformat commit message to not include the above
checklist

---------

Co-authored-by: Konstantin Knizhnik <knizhnik@neon.tech>
  • Loading branch information
knizhnik and Konstantin Knizhnik authored Jan 14, 2024
1 parent 60ced06 commit 31a4eb4
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions compute_tools/src/monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,28 @@ fn watch_compute_activity(compute: &ComputeNode) {
continue;
}
}
//
// Do not suspend compute if autovacuum is running
//
let autovacuum_count_query = "select count(*) from pg_stat_activity where backend_type = 'autovacuum worker'";
match cli.query_one(autovacuum_count_query, &[]) {
Ok(r) => match r.try_get::<&str, i64>("count") {
Ok(num_workers) => {
if num_workers > 0 {
compute.update_last_active(Some(Utc::now()));
continue;
}
}
Err(e) => {
warn!("failed to parse autovacuum workers count: {:?}", e);
continue;
}
},
Err(e) => {
warn!("failed to get list of autovacuum workers: {:?}", e);
continue;
}
}
}
Err(e) => {
debug!("could not connect to Postgres: {}, retrying", e);
Expand Down

1 comment on commit 31a4eb4

@github-actions
Copy link

Choose a reason for hiding this comment

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

2318 tests run: 2229 passed, 0 failed, 89 skipped (full report)


Flaky tests (4)

Postgres 16

  • test_lfc_resize: debug
  • test_pageserver_restarts_under_worload: debug

Postgres 15

  • test_emergency_mode: release
  • test_pageserver_catchup_while_compute_down: debug

Code coverage (full report)

  • functions: 54.6% (10207 of 18705 functions)
  • lines: 81.4% (58631 of 72018 lines)

The comment gets automatically updated with the latest test results
31a4eb4 at 2024-01-14T08:12:36.623Z :recycle:

Please sign in to comment.