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

backend/postgres: Various improvments #35

Merged
merged 5 commits into from
Oct 20, 2023
Merged

Conversation

AlexisMontagne
Copy link
Member

What does this PR do?

This PR packs 3 improvemnt:

  • 1- Explicitly handle SSLSNI dsn mode:

lib/pq brings a new sslsni option turns on by default: lib/pq#1088. It breaks our setup with RDS CA.

  • 2- Make cancelation error play nice with Go.

if a context is canceled mid request now errors.Is(err, context.Canceled) should return tru

  • 3- Accepting multiple CACerts at once.

For CA key rotation it will be critical

What are the observable changes?

Good PR checklist

  • Title makes sense
  • Is against the correct branch
  • Only addresses one issue
  • Properly assigned
  • Added/updated tests
  • Added/updated documentation
  • Properly labeled

Additional Notes

@AlexisMontagne AlexisMontagne self-assigned this Oct 17, 2023
@AlexisMontagne AlexisMontagne requested a review from a team as a code owner October 17, 2023 18:24
@AlexisMontagne AlexisMontagne requested review from Sypheos and BillotP and removed request for a team October 17, 2023 18:24
backend/postgres/db.go Show resolved Hide resolved
@@ -5,13 +5,13 @@ go 1.18
require (
github.com/lib/pq v1.4.0
github.com/mattn/go-sqlite3 v1.13.1-0.20200416054559-98a44bcf5949
github.com/stretchr/testify v1.6.1
github.com/stretchr/testify v1.8.4
Copy link
Member

Choose a reason for hiding this comment

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

also bump the go version ? (and in the workflow file)

}

func (qce *queryCanceledError) Is(target error) bool {
return target == context.Canceled
Copy link
Member

Choose a reason for hiding this comment

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

Should we fall back to a the wrapped error if the condition failed ?

Suggested change
return target == context.Canceled
if target == context.Canceled {
return true
}
return errors.Is(qce.cause, target)

?

Copy link
Member Author

Choose a reason for hiding this comment

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

it is done directly by the std lib in the implementation of errors.Is

Copy link
Member

Choose a reason for hiding this comment

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

Won't we need the Unwrap method to be implemented on this type then ?

Copy link

@xgoffin xgoffin left a comment

Choose a reason for hiding this comment

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

Other than that lgtm

@AlexisMontagne AlexisMontagne merged commit f059df7 into master Oct 20, 2023
4 checks passed
@AlexisMontagne AlexisMontagne deleted the am/postgres-update branch October 20, 2023 14:42
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