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.