-
Notifications
You must be signed in to change notification settings - Fork 663
[teams 1/5] Reset database #3496
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gefjon
approved these changes
Oct 27, 2025
Shubham8287
approved these changes
Oct 27, 2025
cloutiertyler
approved these changes
Nov 4, 2025
Contributor
cloutiertyler
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code owned files LGTM
So far, the `--clear-database` option to `publish` has simply dropped and then re-created the database (if it did exist). This will no longer work when databases can have "children": because dropping and re-creating is not atomic, children would either become orphans, or be dropped as well. To solve this, `reset_database` is introduced as a separate action that: - shuts down all replicas - if a `program_bytes` is supplied, replaces the database's initial program - if a `host_type` is supplied, replaces the database's host type - starts `num_replicas` or the previous number of replicas, which initialize themselves as normal As this could be its own CLI command, the action is provided as its own API endpoint (undocumented). However, since `publish` has no way of knowing whether the database it operates on actually exists, the `publish_database` handler will just invoke the `reset_database` handler if `clear=true` and the database exists, and return its result. This is to avoid starting the transfer of the program in the request body, only to receive a redirect. Some refactoring was necessary to dissect and understand the flow.
624d9fc to
e55816e
Compare
github-merge-queue bot
pushed a commit
that referenced
this pull request
Nov 5, 2025
# Description of Changes This reverts commit #3496. # API and ABI breaking changes Technically maybe yes? But definitely nothing is using the new code yet. # Expected complexity level and risk 1 # Testing CI only Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
So far, the
--clear-databaseoption topublishhas simply droppedand then re-created the database (if it did exist).
This will no longer work when databases can have "children": because
dropping and re-creating is not atomic, children would either become
orphans, or be dropped as well.
To solve this,
reset_databaseis introduced as a separate action that:program_bytesis supplied, replaces the database's initialprogram
host_typeis supplied, replaces the database's host typenum_replicasor the previous number of replicas, whichinitialize themselves as normal
As this could be its own CLI command, the action is provided as its own
API endpoint (undocumented).
However, since
publishhas no way of knowing whether the database itoperates on actually exists, the
publish_databasehandler will justinvoke the
reset_databasehandler ifclear=trueand the databaseexists, and return its result. This is to avoid starting the transfer of
the program in the request body, only to receive a redirect.
Some refactoring was necessary to dissect and understand the flow.
API and ABI breaking changes
Introduces a new, undocumented API endpoint.
We may want to nest it under
/unstable.Expected complexity level and risk
2
Testing
From the outside, the observed behavior should be as before,
so smoketests should cover it.