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(query): duplicate key violating unique restraint #3446

Merged
merged 14 commits into from
Jun 26, 2024

Conversation

sicoyle
Copy link
Contributor

@sicoyle sicoyle commented Jun 18, 2024

Description

Upon sidecar restart I see

 ERROR:  duplicate key value violates unique constraint "pg_type_typname_nsp_index"
2024-06-18 14:28:06.558 GMT [1349] DETAIL:  Key (typname, typnamespace)=(dapr_metadata, 2200) already exists.
2024-06-18 14:28:06.558 GMT [1349] STATEMENT:  CREATE TABLE IF NOT EXISTS dapr_metadata (
                                        key text NOT NULL PRIMARY KEY,
                                        value text NOT NULL
                                )

This PR attempts to address this issue from postgres.

Issue reference

We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.

Please reference the issue this PR will close: #[issue number]

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation / Created issue in the https://github.com/dapr/docs/ repo: dapr/docs#[issue number]

Signed-off-by: Samantha Coyle <sam@diagrid.io>
@sicoyle sicoyle requested review from a team as code owners June 18, 2024 20:20
Copy link
Contributor

@ItalyPaleAle ItalyPaleAle left a comment

Choose a reason for hiding this comment

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

Can you provide more details as to when this error happens? Just restarting the sidecar should not make the error show up, and we use locks to prevent concurrent migrations

state/postgresql/v1/migrations.go Outdated Show resolved Hide resolved
@sicoyle
Copy link
Contributor Author

sicoyle commented Jun 20, 2024

this should be ready

Signed-off-by: Samantha Coyle <sam@diagrid.io>
…onents-contrib into fix-pg-metadata-table-query
Signed-off-by: Samantha Coyle <sam@diagrid.io>
@sicoyle
Copy link
Contributor Author

sicoyle commented Jun 21, 2024

ready @ItalyPaleAle :)

@sicoyle
Copy link
Contributor Author

sicoyle commented Jun 21, 2024

test failure is unrelated to my changes

--- FAIL: Test_EndToEnd (0.62s)
    --- FAIL: Test_EndToEnd/http (0.20s)
        --- FAIL: Test_EndToEnd/http/consoleLog_multiple_requests (0.09s)
            e2e_test.go:118: 
                	Error Trace:	/home/runner/work/components-contrib/components-contrib/middleware/http/wasm/internal/e2e_test.go:118
                	            				/home/runner/work/components-contrib/components-contrib/middleware/http/wasm/internal/e2e_test.go:221
                	Error:      	"time=\"2024-06-21T18:55:21.684750[127](https://github.com/dapr/components-contrib/actions/runs/9618437105/job/26532323112?pr=3446#step:9:128)Z\" level=info msg=\"main ConsoleLog\" instance=fv-az1117-234 scope=Test_EndToEnd type=log ver=unknown\ntime=\"2024-06-21T18:55:21.684979733Z\" level=info msg=\"main ConsoleLog\" instance=fv-az1117-234 scope=Test_EndToEnd type=log ver=unknown\ntime=\"2024-06-21T18:55:21.685019186Z\" level=info msg=\"request[0] ConsoleLog\" instance=fv-az1117-234 scope=Test_EndToEnd type=log ver=unknown\ntime=\"2024-06-21T18:55:21.68514746Z\" level=debug msg=\"wasm stdout: main Stdout\\nmain Stdout\\nrequest[0] Stdout\\n\" instance=fv-az1117-234 scope=Test_EndToEnd type=log ver=unknown\ntime=\"2024-06-21T18:55:21.685161336Z\" level=debug msg=\"wasm stderr: main Stderr\\nmain Stderr\\nrequest[0] Stderr\\n\" instance=fv-az1117-234 scope=Test_EndToEnd type=log ver=unknown\ntime=\"2024-06-21T18:55:21.685185461Z\" level=info msg=\"request[0] ConsoleLog\" instance=fv-az1117-234 scope=Test_EndToEnd type=log ver=unknown\ntime=\"2024-06-21T18:55:21.685192364Z\" level=debug msg=\"wasm stdout: request[0] Stdout\\n\" instance=fv-az1117-234 scope=Test_EndToEnd type=log ver=unknown\ntime=\"2024-06-21T18:55:21.685196952Z\" level=debug msg=\"wasm stderr: request[0] Stderr\\n\" instance=fv-az1117-234 scope=Test_EndToEnd type=log ver=unknown\ntime=\"2024-06-21T18:55:21.685205909Z\" level=info msg=\"request[1] ConsoleLog\" instance=fv-az1117-234 scope=Test_EndToEnd type=log ver=unknown\ntime=\"2024-06-21T18:55:21.685210167Z\" level=debug msg=\"wasm stdout: request[1] Stdout\\n\" instance=fv-az1117-234 scope=Test_EndToEnd type=log ver=unknown\ntime=\"2024-06-21T18:55:21.685213453Z\" level=debug msg=\"wasm stderr: request[1] Stderr\\n\" instance=fv-az1117-234 scope=Test_EndToEnd type=log ver=unknown\n" does not contain "level=debug msg=\"wasm stdout: main Stdout\\nrequest[0] Stdout\\n\""
                	Test:       	Test_EndToEnd/http/consoleLog_multiple_requests

@ItalyPaleAle ItalyPaleAle added this to the v1.14 milestone Jun 21, 2024
state/postgresql/v1/migrations.go Outdated Show resolved Hide resolved
state/postgresql/v1/migrations.go Outdated Show resolved Hide resolved
state/postgresql/v2/postgresql.go Outdated Show resolved Hide resolved
@ItalyPaleAle
Copy link
Contributor

@sicoyle please see linter failures otherwise LGTM

@berndverst berndverst merged commit bf07ca5 into dapr:main Jun 26, 2024
90 of 91 checks passed
@sicoyle sicoyle deleted the fix-pg-metadata-table-query branch June 26, 2024 19:32
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.

None yet

3 participants