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

fix(core): policy db should use pool connection hook to set search_path #1443

Merged
merged 4 commits into from
Aug 23, 2024

Conversation

jakedoublev
Copy link
Contributor

@jakedoublev jakedoublev commented Aug 22, 2024

Resolves #1442

Instead of executing the SET search_path on the first connection found when a pool is instantiated, we should utilize the AfterConnect PGX hook which exposes a connection immediately after it's opened and before it's utilized.

@jakedoublev jakedoublev requested a review from a team as a code owner August 22, 2024 22:00
@jakedoublev
Copy link
Contributor Author

Tested these changes under simulated flakiness with:
while true; do docker restart <postgresql container id>; sleep 30; done

Every time, I got a log:
level=INFO msg="successfully set database client search_path" schema=opentdf_policy

I never had a failed policy LIST attributes call.

Running the same test on main, I reproduced the error reported: time=2024-08-22T16:07:39.361-07:00 level=ERROR msg="ERROR: relation \"attribute_definitions\" does not exist (SQLSTATE 42P01)" error="ERROR: relation \"attribute_definitions\" does not exist (SQLSTATE 42P01)"

strantalis
strantalis previously approved these changes Aug 22, 2024
service/pkg/db/db.go Outdated Show resolved Hide resolved
@jrschumacher jrschumacher added this pull request to the merge queue Aug 23, 2024
Merged via the queue into main with commit 8501ff5 Aug 23, 2024
19 checks passed
@jrschumacher jrschumacher deleted the fix/search_path branch August 23, 2024 08:12
github-merge-queue bot pushed a commit that referenced this pull request Aug 23, 2024
🤖 I have created a release *beep* *boop*
---


##
[0.4.21](service/v0.4.20...service/v0.4.21)
(2024-08-23)


### Features

* **core:** KID in NanoTDF KAS ResourceLocator borrowed from Protocol
([#1222](#1222))
([e5ee4ef](e5ee4ef))


### Bug Fixes

* **authz:** entitlements fqn casing
([#1446](#1446))
([2ffc66b](2ffc66b)),
closes [#1359](#1359)
* **core:** Autobump service
([#1417](#1417))
([e6db378](e6db378))
* **core:** Autobump service
([#1441](#1441))
([e17deab](e17deab))
* **core:** Autobump service
([#1449](#1449))
([7e443da](7e443da))
* **core:** case sensitivity in AccessPDP
([#1439](#1439))
([aed7633](aed7633)),
closes [#1359](#1359)
* **core:** policy db should use pool connection hook to set search_path
([#1443](#1443))
([8501ff5](8501ff5))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: opentdf-automation[bot] <149537512+opentdf-automation[bot]@users.noreply.github.com>
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.

Policy: intermittent table not found error where schema in search_path is not used in queries
3 participants