-
-
Notifications
You must be signed in to change notification settings - Fork 218
feat: multiple versions for the timescaledb-apache extension
#1749
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
Changes from 10 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
12e9433
chores: opted-out nix-fast-build
yvan-sraka dd833ab
chores: set up nix-github-actions
yvan-sraka a17d9af
chores: comment out vestigal testinfra-ami-build
yvan-sraka 6509b7c
chores: use custom github runners
yvan-sraka 7ddc794
feat: multiple versions for the timescaledb-apache extension
yvan-sraka b2fcade
feat: multiversion timescaledb
samrose 34b5f28
fix: refactor a bit to complete the extension
samrose 28659b0
test: remove older version of integration test
samrose 578af45
fix: make sure integration tests
samrose 638c0b4
test: revert to use test in nix/tests for timescale
samrose 7db6348
fix: integrtion tests
samrose 5466049
Move timescaledb nixos test to nix/ext/tests
jfroche f921941
chore: bump for test
samrose 90c5e4b
fix: need to also handle timescaledb-loader
samrose 7cce2c2
chore: bump version for fix
samrose 5cbce8f
fix: didn't need "loader"
samrose bdfc3e1
chore: bump version for testing
samrose c0e5f3f
fix: does need loader
samrose 33d6a4f
feat: switch both timescaledb and its loader when switching versions
jfroche eb7407a
chore: bump to test
samrose c7604f1
fix: must symlink to timescaledb.so on switch
samrose 24d7bc2
chore: bump for release
samrose File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -186,6 +186,7 @@ builtins.listToAttrs ( | |
| "index_advisor" | ||
| "pg_cron" | ||
| "pg_net" | ||
| "timescaledb" | ||
| "vector" | ||
| "wrappers" | ||
| ] | ||
|
|
||
This file was deleted.
Oops, something went wrong.
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| { self, pkgs }: | ||
| let | ||
| inherit (pkgs) lib; | ||
| installedExtension = | ||
| postgresMajorVersion: | ||
| self.packages.${pkgs.system}."psql_${postgresMajorVersion}/exts/timescaledb-all"; | ||
| versions = (installedExtension "15").versions; | ||
| firstVersion = lib.head versions; | ||
| postgresqlWithExtension = | ||
| postgresql: | ||
| let | ||
| majorVersion = lib.versions.major postgresql.version; | ||
| pkg = pkgs.buildEnv { | ||
| name = "postgresql-${majorVersion}-timescaledb"; | ||
| paths = [ | ||
| postgresql | ||
| postgresql.lib | ||
| (installedExtension majorVersion) | ||
| ]; | ||
| passthru = { | ||
| inherit (postgresql) version psqlSchema; | ||
| lib = pkg; | ||
| withPackages = _: pkg; | ||
| }; | ||
| nativeBuildInputs = [ pkgs.makeWrapper ]; | ||
| pathsToLink = [ | ||
| "/" | ||
| "/bin" | ||
| "/lib" | ||
| ]; | ||
| postBuild = '' | ||
| wrapProgram $out/bin/postgres --set NIX_PGLIBDIR $out/lib | ||
| wrapProgram $out/bin/pg_ctl --set NIX_PGLIBDIR $out/lib | ||
| wrapProgram $out/bin/pg_upgrade --set NIX_PGLIBDIR $out/lib | ||
| ''; | ||
| }; | ||
| in | ||
| pkg; | ||
| in | ||
| self.inputs.nixpkgs.lib.nixos.runTest { | ||
| name = "timescaledb"; | ||
| hostPkgs = pkgs; | ||
| nodes.server = | ||
| { ... }: | ||
| { | ||
| virtualisation = { | ||
| forwardPorts = [ | ||
| { | ||
| from = "host"; | ||
| host.port = 13022; | ||
| guest.port = 22; | ||
| } | ||
| ]; | ||
| }; | ||
| services.openssh = { | ||
| enable = true; | ||
| }; | ||
| users.users.root.openssh.authorizedKeys.keys = [ | ||
| "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIArkmq6Th79Z4klW6Urgi4phN8yq769/l/10jlE00tU9" | ||
| ]; | ||
|
|
||
| services.postgresql = { | ||
| enable = true; | ||
| package = postgresqlWithExtension self.packages.${pkgs.system}.postgresql_15; | ||
| settings = { | ||
| shared_preload_libraries = "timescaledb"; | ||
| }; | ||
| }; | ||
|
|
||
| specialisation.postgresql15.configuration = { | ||
| services.postgresql = { | ||
| package = lib.mkForce (postgresqlWithExtension self.packages.${pkgs.system}.postgresql_15); | ||
| }; | ||
| }; | ||
| }; | ||
| testScript = | ||
| { ... }: | ||
| '' | ||
| def run_sql(query): | ||
| return server.succeed(f"""sudo -u postgres psql -t -A -F\",\" -c \"{query}\" """).strip() | ||
| def check_upgrade_path(): | ||
| with subtest("Check timescaledb upgrade path"): | ||
| server.succeed("sudo -u postgres psql -c 'DROP EXTENSION IF EXISTS timescaledb;'") | ||
| run_sql(r"""CREATE EXTENSION timescaledb WITH VERSION \"${firstVersion}\";""") | ||
| installed_version = run_sql(r"""SELECT extversion FROM pg_extension WHERE extname = 'timescaledb';""") | ||
| assert installed_version == "${firstVersion}", f"Expected timescaledb version ${firstVersion}, but found {installed_version}" | ||
| for version in [${lib.concatStringsSep ", " (map (s: ''"${s}"'') versions)}][1:]: | ||
| run_sql(f"""ALTER EXTENSION timescaledb UPDATE TO '{version}';""") | ||
| installed_version = run_sql(r"""SELECT extversion FROM pg_extension WHERE extname = 'timescaledb';""") | ||
| assert installed_version == version, f"Expected timescaledb version {version}, but found {installed_version}" | ||
| start_all() | ||
| server.wait_for_unit("multi-user.target") | ||
| server.wait_for_unit("postgresql.service") | ||
| check_upgrade_path() | ||
samrose marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ''; | ||
| } | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.