Pulp
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Help
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
# Zero Downtime Working Group https://discourse.pulpproject.org/t/support-zero-downtime-updates/645 ## Upcoming * Maybe a great example to excercise zdu migrations https://github.com/pulp/pulpcore/issues/3400 * Labels are persisted as a large join table, but maybe an HStoreField is better suited and more performant. This would give a rather intricate migration we can start to learn with. ## Oct 20, 2022 ### Attendees: dkliban, ipanova, mdellweg, bmbouter ## Oct 27 ### Attendees: awcrosby, ggainey, ipanova, mdellweg, bmbouter ## Nov 14 ### Attendees: bmbouter, dkliban, mdellweg, ggainey * When to meet next? - Dec 01 1100 EST * Since last meeting, an [epic](https://github.com/pulp/pulpcore/issues/3278) has been opened * reviewed the above * worker-serializer could/should include version-info desired * workers have a minimal/maximal? * do we really need 3365? * discussion ensues * maybe not necessary? * this was to let migrations decide "this might be bad" - really only need info from the db * discussion on [3368](https://github.com/pulp/pulpcore/issues/3368) * tasks *must* be backwards-compatible? * "if you're going to add a new, required, parameter, the policy is 'you need to have a new method', not change the old one" * do we need version-info at task-added-to-queue time? And have workers know "their" acceptable versions? * how can worker decide "I can't pick up this task?" ### Problem Statement Roundup Migrations need to run while Pulp is offline Solution: run them online Problems running migrations while Pulp is online: * Old application code is not compatible with new data format Migrations running with long transactions lead to deadlock issues. * "real" deadlocks? Or just "it's taking too long, there might be a problem somewhere" * for whole-table updates, might be better to have the migration lock **the table** to update it Plugin migrations depend on pulpcore migrations. ### Upgrade Path Migration Problems Plugins cannot upgrade many releases at a time ## Examples * A database table is added * A database table is renamed * A database table is removed * A database column is renamed * A database column is removed * A database column s added * The data of a column is reformatted, e.g. a new choice is added to a choice field ## Hypothetical Zero Downtime Upgrade Steps 1. Run the migrations while old pulp code is online (old code, new data format) 2. Rolling restart old code to become new code * old and new code is running at the same time! 3. Apply post-upgrade migrations ## What if... * Breaking change migrations specify which versions of which components "must be" running before this change can be allowed * Such migrations start by querying the DB for the current status (via heartbeat-msgs) of everything running in the system/cluster * If anything is running at lower-than-required, the migration is DENIED and the upgrade stops * In this situation, the "old" components are identified, and what-they-need-to-be-running is identified, and the admin is expected to upgrade/shut down any pods w/ old-code * At that point, the upgrade can be restarted * AI: All components MUST have a heartbeat-checkin, for this to work * API-workers prob need this * gunicorn processes? ## Detailed Example Assume the tasking system has RUNNING and CANCELED but not CANCELING. The change is to add CANCELING in the new application code. Assume the original column was named "states". The migration would: * Create a new column named "new_states" in postgresql but the ORM can refer to it as the same name. It would have all 3 states. * Maybe invent a versioning scheme: "states@v2". * You can tell django orm to use a different name for the db column than the python object. * A trigger would be setup to cause a write to "new_states" column to set the value on "states" as part of the write. * If RUNNING written, write RUNNING to "states" * If CANCELED written, write CANCELED to "states" * If CANCELING written, do not write anything to "states". The old application code is not prepared to deal with this * A second trigger would be setup to cause a write to "states" column to set the value on "new states" as part of the write. * If RUNNING written, write RUNNING to "new_states" * If CANCELED written, write CANCELED to "new_states" * Data from the existing column would be copied to the new column transactionally in batches as the migration ran ## Questions * What happens when new-column has an initial-condition that is new? * db-triggers have to be thought about REALLY HARD in terms of "what to do" in this case * How about "migration-dependent app-code paths"? * python code queries "is migration-001-foo applied to the db?", and runs new-code if so, else runs old-code-path ## Relavent tickets See the EPIC here: https://github.com/pulp/pulpcore/issues/3278 ## Scratchpad Notes * Zero downtime does not come as a free gift. We cannot just add a library that takes care of it, but we need to be very careful writing migrations, in a way that both new and old code can work with it. We may need a lot of database version aware code. * In any case, it is worth shutting down workers while migrating. * Maybe we can introduce a maintenance mode where no costly tasks can be dispatched, but at least the content app stays online to reduce the code that needs awareness. * Our plugin infrastructure makes things additionally complex. * We cannot upgrade from anywhere without downtime. * We need to select windows for zero downtime upgrades. (single commits; whole releases?) * We probably need to align destructive database migrations with the deprecation policy. * Not allowing migrations in z-stream releases was a very wise decision.

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully