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

Attempt to continue when encountering errors in createDBIfNotExist #258

Merged
merged 4 commits into from
Dec 13, 2023
Merged

Attempt to continue when encountering errors in createDBIfNotExist #258

merged 4 commits into from
Dec 13, 2023

Conversation

mortenlj
Copy link
Contributor

The database might already exist even if we encounter errors in createDBIfNotExist, so instead of erroring out, log warnings and attempt to continue.

Fixes k3s-io/k3s#9033

@mortenlj mortenlj requested a review from a team as a code owner December 12, 2023 21:50
The database might already exist even if we encounter errors in createDBIfNotExist, so instead of erroring out, log warnings and attempt to continue.

Signed-off-by: Morten Lied Johansen <[email protected]>
Copy link
Member

@brandond brandond left a comment

Choose a reason for hiding this comment

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

I am pretty sure this will crash on error as-is.

@mortenlj
Copy link
Contributor Author

I am pretty sure this will crash on error as-is.

You are entirely right, not sure how I missed that. Serves me right for trying to crank it out just before bedtime 🙂.

I'll take another pass over this today if I get the time.

@mortenlj
Copy link
Contributor Author

@brandond I think I'm happy with this now, anything you think should be changed?

Copy link
Member

@brandond brandond left a comment

Choose a reason for hiding this comment

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

one nit on the log message, lgtm otherwise!

pkg/drivers/pgsql/pgsql.go Outdated Show resolved Hide resolved
Co-authored-by: Brad Davidson <[email protected]>
Signed-off-by: Morten Lied Johansen <[email protected]>
@brandond brandond merged commit a03b5c9 into k3s-io:master Dec 13, 2023
3 checks passed
@mortenlj mortenlj deleted the postgres-createdbifnotexist branch December 14, 2023 07:25
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.

k3s server fails to start when using postgres datastore with no existing database named postgres
2 participants