Skip to content
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

Handle extensions enabled with LOAD #489

Merged
merged 20 commits into from
Jan 22, 2024
Merged

Handle extensions enabled with LOAD #489

merged 20 commits into from
Jan 22, 2024

Conversation

ianstanton
Copy link
Member

@ianstanton ianstanton commented Jan 17, 2024

Some postgres extensions are enabled with LOAD or added to shared_preload_libraries instead of the traditional CREATE EXTENSION command (example: auto_explain). This PR adds logic to handle those types of extensions.

  • Check if one of these extensions is installed by looking for <extension_name>.so in /var/lib/postgresql/data/tembo/15/lib
  • Fetch trunk project metadata for a given extension
    • Example:
    [
      {
        "name": "auto_explain",
        "description": "The auto_explain module provides a means for logging execution plans of slow statements automatically, without having to run EXPLAIN by hand.",
        "documentation_link": "https://www.postgresql.org/docs/current/auto-explain.html",
        "repository_link": "https://github.com/postgres/postgres/tree/master/contrib/auto_explain",
        "version": "15.3.0",
        "postgres_versions": [
          15
        ],
        "extensions": [
          {
            "extension_name": "auto_explain",
            "version": "15.3.0",
            "trunk_project_name": "auto_explain",
            "dependencies_extension_names": null,
            "loadable_libraries": [
              {
                "library_name": "auto_explain",
                "requires_restart": true,
                "priority": 2147483647
              }
            ],
            "configurations": null,
            "control_file": {
              "absent": true,
              "content": null
            }
          }
        ],
        "downloads": [
          {
            "link": "https://cdb-plat-use1-prod-pgtrunkio.s3.amazonaws.com/extensions/auto_explain/auto_explain-pg15-15.3.0.tar.gz",
            "pg_version": 15,
            "platform": "linux/amd64",
            "sha256": "23eb345e8b5892c20f24a51d3c0de97198cde95a17c72426180f6d9b9ad8692b"
          }
        ]
      }
    ]
    
  • If the extension has no control file && has a loadable library, skip traditional CREATE EXTENSION and add to shared_preload_libraries

Signed-off-by: Ian Stanton <ian@tembo.io>
Signed-off-by: Ian Stanton <ian@tembo.io>
Signed-off-by: Ian Stanton <ian@tembo.io>
Signed-off-by: Ian Stanton <ian@tembo.io>
Signed-off-by: Ian Stanton <ian@tembo.io>
Signed-off-by: Ian Stanton <ian@tembo.io>
Signed-off-by: Ian Stanton <ian@tembo.io>
Signed-off-by: Ian Stanton <ian@tembo.io>
Signed-off-by: Ian Stanton <ian@tembo.io>
Signed-off-by: Ian Stanton <ian@tembo.io>
Signed-off-by: Ian Stanton <ian@tembo.io>
Signed-off-by: Ian Stanton <ian@tembo.io>
Signed-off-by: Ian Stanton <ian@tembo.io>
Signed-off-by: Ian Stanton <ian@tembo.io>
Signed-off-by: Ian Stanton <ian@tembo.io>
Signed-off-by: Ian Stanton <ian@tembo.io>
Signed-off-by: Ian Stanton <ian@tembo.io>
@ianstanton ianstanton changed the title DRAFT: Handle extensions enabled with LOAD Handle extensions enabled with LOAD Jan 22, 2024
@ianstanton ianstanton marked this pull request as ready for review January 22, 2024 00:16

let cmd = vec![
"ls".to_owned(),
"/var/lib/postgresql/data/tembo/15/lib".to_owned(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note this will need to be configurable soon as the coming changes for supporting pg14/16 come through.

Signed-off-by: Ian Stanton <ian@tembo.io>
@ianstanton ianstanton merged commit adfb8db into main Jan 22, 2024
9 checks passed
@ianstanton ianstanton deleted the tem-2773-3 branch January 22, 2024 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants