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

Charm conflicts with extension enabled via SQL #536

Closed
TeodorPt opened this issue Jun 28, 2024 · 4 comments
Closed

Charm conflicts with extension enabled via SQL #536

TeodorPt opened this issue Jun 28, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@TeodorPt
Copy link

TeodorPt commented Jun 28, 2024

Steps to reproduce

  1. Deploy a postgresql-k8s charm.
  2. Run CREATE EXTENSION IF NOT EXISTS pg_trgm WITH SCHEMA pg_catalog; in the resulting database, directly.
  3. Create an index using the extension, e.g. CREATE INDEX example_idx ON example USING gin(name gin_trgm_ops);.

Expected behavior

(?)

Actual behavior

The extension is successfully created in the instance. Later, on various juju events, the charm actively tries to remove pg_trgm because it is not enabled via the plugin_pg_trgm_enable config. It however fails to do so because there's an index depending on it. This is an excerpt from the Postgres logs:

user=operator,db=<redacted>,app=[unknown],client=<redacted>,line=7 LOG:  statement: DROP EXTENSION IF EXISTS pg_trgm;
user=operator,db=<redacted>,app=[unknown],client=<redacted>,line=8 ERROR:  cannot drop extension pg_trgm because other objects depend on it
user=operator,db=<redacted>,app=[unknown],client=<redacted>,line=9 DETAIL:  index <redacted> depends on operator class gin_trgm_ops for access method gin
user=operator,db=<redacted>,app=[unknown],client=<redacted>,line=10 HINT:  Use DROP ... CASCADE to drop the dependent objects too.
user=operator,db=<redacted>,app=[unknown],client=<redacted>,line=11 STATEMENT:  DROP EXTENSION IF EXISTS pg_trgm;

Versions

Juju CLI: 3.5.1-ubuntu-amd64
Juju agent: 3.4.2
Charm revision: 264, version 14.11

Additional Context

I am not sure if this is actually a bug or just a peculiar behavior that we have observed. Nevertheless, reporting here in case there's anything that can be done to improve the experience.

@TeodorPt TeodorPt added the bug Something isn't working label Jun 28, 2024
Copy link
Contributor

@marceloneppel
Copy link
Member

Hi, @TeodorPt! Thanks for the report.

We'll be working to fix this issue in the next two weeks.

@lucasgameiroborges
Copy link
Member

Hi there @TeodorPt, this issue was addressed in #567, where we now have a blocked status in case where the charm tries to disable a plugin but it can't. In such a scenario, the user can proceed in 2 ways:

  • Keep the blocking objects and enable the plugin via juju config,
  • Delete the blocking objects and wait for update-status event for the plugin to get disabled,

Both actions should unblock the charm. We hope this will provide better UX, for you, feel free to re-open this issue if something behaves unexpectedly. Thank you!

@TeodorPt
Copy link
Author

TeodorPt commented Aug 8, 2024

Nice, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants