Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

storage/postgres: Always send keepalives for the replication slot with a tokio::interval #30631

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ParkMyCar
Copy link
Member

We've encountered at least one issue in local testing where the upstream Postgres DB's wal_sender_timeout is low enough that the timeout elapses before any of our existing inputs trigger a keepalive message to be sent.

This PR adds a tokio::Interval to the existing loop so we can make sure we are sending a standby update/keepalive at least a healthy interval.

Motivation

Fix an issue we've encountered in local testing with Neon.

Related to: https://github.com/MaterializeInc/incidents-and-escalations/issues/146

Tips for reviewer

This is my first foray into storage code! It's a relatively simple change, but there could be nuances with control flow that I'm missing

Checklist

  • This PR has adequate test coverage / QA involvement has been duly considered. (trigger-ci for additional test/nightly runs)
  • This PR has an associated up-to-date design doc, is a design doc (template), or is sufficiently small to not require a design.
  • If this PR evolves an existing $T ⇔ Proto$T mapping (possibly in a backwards-incompatible way), then it is tagged with a T-proto label.
  • If this PR will require changes to cloud orchestration or tests, there is a companion cloud PR to account for those changes that is tagged with the release-blocker label (example).
  • If this PR includes major user-facing behavior changes, I have pinged the relevant PM to schedule a changelog post.

@ParkMyCar ParkMyCar requested a review from a team as a code owner November 26, 2024 15:59
Copy link
Member

@benesch benesch left a comment

Choose a reason for hiding this comment

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

Makes sense to me, but I'll leave the official approval to @petrosagg.

Copy link
Contributor

@petrosagg petrosagg left a comment

Choose a reason for hiding this comment

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

Looks great! Thank you!

@ParkMyCar ParkMyCar enabled auto-merge (squash) November 26, 2024 20:16
let mut feedback_timer = tokio::time::interval(feedback_interval);
//
// Set a minimum interval to guard against feedback_interval being 0.
let minimum_interval = tokio::time::Duration::from_secs(1);
Copy link
Contributor

Choose a reason for hiding this comment

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

How can this happen? If it can indeed happen then the code below is problematic since it will be sending a keepalive back for every single message received

Copy link
Contributor

Choose a reason for hiding this comment

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

(I mean the original code, not the one you added)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants