-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Extension Updating #11677
Merged
Mytherin
merged 62 commits into
duckdb:main
from
samansmink:install-extension-version-merged
May 21, 2024
Merged
Extension Updating #11677
Mytherin
merged 62 commits into
duckdb:main
from
samansmink:install-extension-version-merged
May 21, 2024
Conversation
This file contains 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
1 task
This solves also the problem of reentrancy in the Load in a more solid way
Mytherin
reviewed
May 17, 2024
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.
Thanks for the fixes! Looks great - some minor comments then this is good to go
extension-updating: | ||
name: Extension updating test | ||
runs-on: ubuntu-20.04 | ||
# needs: linux-memory-leaks TODO revert |
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.
TODO
Thanks! |
github-actions bot
pushed a commit
to duckdb/duckdb-r
that referenced
this pull request
May 21, 2024
Merge pull request duckdb/duckdb#11677 from samansmink/install-extension-version-merged
3 tasks
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.
This PR adds better support for Extension updating. It adds on top of @carlopi's work with #11515
Features
Extension Repositories
This PR introduces extension repositories. This is a concepts that was effectively already existing through the
custom_extension_repository
setting. But this is now made a little more concrete.5 repositories have been added here:
Repositories are currently only used as an alias for an http endpoint to download extensions from in a structured way. They can be used to select where to install an extension from:
Note here that the
core
repository is the default one. Also note that the community repository does not exist (yet).Extension installation metadata
In this PR, we add the concept of
ExtensionInstallInfo
:The ExtensionInstallInfo is created on installation of an extension. And written to
~/.duckdb/extensions/<duck_version>/<platform>/<ext_name>.duckdb_extension.info
.This information is then used during updating and for the
duckdb_extensions()
table function.UPDATE EXTENSIONS syntax
The main thing this PR adds the
UPDATE EXTENSIONS
statement. This statement adds support for updating extensions in a slightly more clever way than theFORCE INSTALL
that is now used to update an extension.UPDATE EXTENSIONS will go through all currently installed extensions and try to update them, then return a table containing the information on what happened for each extensions that it tried to update:
Passing a list of extensions to be explicitly updated is also possible using:
UPDATE EXTENSIONS (json, httpfs);
update_result
is an enum printed using its ToString of the following class:Finally note that when installing extensions directly using a full path, they will be marked as a CUSTOM_PATH extension that will be disregarded during updating. This differentiation is printed by
duckdb_extensions()
to make this clear and the NOT_A_REPOSITORY update_result will be printed whenUPDATE EXTENSIONS
is run with an extension installed through a direct path.Install specific version of an extension
Another syntax addition that was added in this PR is the possibility to install a specific version of an extension, using:
What this allows us to do is have multiple versions of an extension be available at the same time. Note that this is currently not done, nor necessarily desired. It is mostly a useful function to have working as a workaround for when extensions get more complex/mature in the future.
Errors on invalid extensions
With this PR, behaviour for extension installation has changed to be more strict. The metadata in the extension footer is checked both on installation and loading. Note that there is a setting allow bypassing these checks:
allow_extensions_metadata_mismatch
. Note that when loading and extension,allow_extensions_metadata_mismatch
only works when duckdb is started withallow_unsigned_extensions
;Write order of Metadata file
Before this PR, extension installation was atomic: the extensions were written to a tmp file, then copied using the filesystem. With the introduction of the metadata file, this is no longer the case. Therefore, its important that we properly handle the various cases things can get corrupted. The file write code is as follows:
To properly handle corruption caused by crashes in this function, DuckDB should:
Note that all these cases are tested in the
update_extensions_ci.test
described belowTesting
Extension updating is a little annoying to test but I've done my best. The crux is tested by
test/extension/update_extensions_ci.test
. This test runs in a separate ci job in the nightly workflow. This test should quite extensively test this mechanism testing: