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

upgrade neon extension on startup #7029

Merged
merged 1 commit into from Mar 6, 2024
Merged

Conversation

skyzh
Copy link
Member

@skyzh skyzh commented Mar 5, 2024

Problem

Fix #7003. Fix #6982. Currently, neon extension is only upgraded when new compute spec gets applied, for example, when creating a new role or creating a new database. This also resolves neon.lfc_stat not found warnings in prod.

Summary of changes

This pull request adds the logic to spawn a background thread to upgrade the neon extension version if the compute is a primary. If for whatever reason the upgrade fails, it reports an error to the console and does not impact compute node state.

This change can be further applied to 3rd-party extension upgrades. We can silently upgrade the version of 3rd party extensions in the background in the future.

Questions:

  • Does alter extension takes some kind of lock that will block user requests?
  • Does ALTER EXTENSION writes to the database if nothing needs to be upgraded? (may impact storage size).

Otherwise it's safe to land this pull request.

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

Signed-off-by: Alex Chi Z <chi@neon.tech>
Copy link

github-actions bot commented Mar 5, 2024

2490 tests run: 2367 passed, 0 failed, 123 skipped (full report)


Code coverage* (full report)

  • functions: 28.8% (6983 of 24262 functions)
  • lines: 47.4% (42894 of 90550 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
0d79d0d at 2024-03-05T19:04:13.639Z :recycle:

@skyzh skyzh requested a review from save-buffer March 5, 2024 20:11
@lubennikovaav
Copy link
Contributor

Does alter extension takes some kind of lock that will block user requests?
nothing extra.
it should not affect users, especially given that we install neon extension in postgres database, which is not default for users.

Does ALTER EXTENSION writes to the database if nothing needs to be upgraded? (may impact storage size).

no, it does lookup in postgres catalog and in extension control file to check current version and expected version.
if they match , UPDATE is noop.

Copy link
Contributor

@lubennikovaav lubennikovaav left a comment

Choose a reason for hiding this comment

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

lgtm

@skyzh skyzh merged commit 0b330e1 into main Mar 6, 2024
53 checks passed
@skyzh skyzh deleted the skyzh/upgrade-neon-extension branch March 6, 2024 17:20
skyzh added a commit that referenced this pull request Mar 14, 2024
This pull request disables neon extension auto upgrade to help the next
compute image upgrade smooth.

## Summary of changes

We have two places to auto-upgrade neon extension: during compute spec
update, and when the compute node starts. The compute spec update logic
is always there, and the compute node start logic is added in
#7029. In this pull request, we
disable both of them, so that we can still roll back to an older version
of compute before figuring out the best way of extension
upgrade-downgrade. #6936

We will enable auto-upgrade in the next release following this release.

There are no other extension upgrades from release 4917 and therefore
after this pull request, it would be safe to revert to release 4917.

Impact:

* Project created after unpinning the compute image -> if we need to
roll back, **they will stuck**, because the default neon extension
version is 1.3. Need to manually pin the compute image version if such
things happen.
* Projects already stuck on staging due to not downgradeable -> I don't
know their current status, maybe they are already running the latest
compute image?
* Other projects -> can be rolled back to release 4917.

Signed-off-by: Alex Chi Z <chi@neon.tech>
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.

neon extension did not get auto-upgraded neon.neon_lfc_stats errors in compute logs
2 participants