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

1587: drop/create database DB before restoring it #1604

Closed

Conversation

romankuzmik
Copy link
Contributor

@romankuzmik romankuzmik commented Oct 18, 2023

SUMMARY

Currently we require re-create PVC used by Postgres or remove all data manually before running restore. See https://github.com/ansible/awx-operator/tree/devel/roles/restore#requirements

This might not be always possible neither it is convenient for end users. This PR introduces simpler solution:

  • Force drop existing database
  • Re-create empty database
  • Resume as usual (pg_resore & Co)
ISSUE TYPE
  • New or Enhanced Feature
ADDITIONAL INFORMATION

See Issue 1587

@rooftopcellist
Copy link
Member

rooftopcellist commented Nov 1, 2023

@romankuzmik I could see how this would be useful, but we probably don't want to run it every time because of the nature of how dangerous DROP DATABASE is. We probably only want users to do this when issues arise.

What do you think about adding a force boolean parameter on the AWXRestore object that would optionally inject those lines into the pg_restore command? That way users could be intentional about doing this.

@TheRealHaoLiu
Copy link
Member

@romankuzmik i created a PR based on yours #1639

@romankuzmik
Copy link
Contributor Author

@TheRealHaoLiu , I like it. Hope we can get an approval and merge it sooner or later.

@rooftopcellist
Copy link
Member

rooftopcellist commented Nov 29, 2023

Closing as this logic was merged as part of #1639

Thank you for your contribution!

@haifang-zh
Copy link

Hi,
I am using AWX-operator of 2.19.1 when I set force_drop_db to true db user 'awx' need privilege of create DB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants