Skip to content

Conversation

robstradling
Copy link
Contributor

@robstradling robstradling commented Mar 18, 2025

When enabled, the CTFE IssuanceChainStorage feature attempts to INSERT a row into the IssuanceChain table for every single add-chain and add-pre-chain request. Often a duplicate key exception will be raised, in which case CTFE will ignore it; however, each time such an exception is raised on the database server, an error of the following form is added to the PostgreSQL log file:

2025-03-14 19:09:48.407 UTC [79887] ctlog@ctlog ERROR: duplicate key value violates unique constraint "issuancechain_pkey"
2025-03-14 19:09:48.407 UTC [79887] ctlog@ctlog DETAIL: Key (identityhash)=(\x75fd98459142f4ad8a38a620c728d994057d980ab64a44190badccd265dd4d4a) already exists.
2025-03-14 19:09:48.407 UTC [79887] ctlog@ctlog STATEMENT: INSERT INTO IssuanceChain(IdentityHash, ChainValue) VALUES ($1, $2)

Since these "errors" are expected to occur and do not represent an actual problem, it's not useful or desirable to log them.

This PR stops adds ON CONFLICT DO NOTHING to the INSERT statement, so that no exception is raised and these errors will not appear in the PostgreSQL log file.

Checklist

…plicate key errors when inserting into the IssuanceChain table
@robstradling robstradling changed the title In the IssuanceChainStorage PostgreSQL implementation, don't throw duplicate key errors when inserting into the IssuanceChain table Suppress unnecessary duplicate key errors in the IssuanceChainStorage PostgreSQL implementation Mar 18, 2025
@robstradling robstradling marked this pull request as ready for review March 21, 2025 11:50
@robstradling robstradling requested a review from a team as a code owner March 21, 2025 11:50
@robstradling robstradling requested review from roger2hk and removed request for a team March 21, 2025 11:50
@roger2hk
Copy link
Contributor

/gcbrun

@roger2hk roger2hk merged commit 909030c into google:master Mar 21, 2025
7 checks passed
@robstradling robstradling deleted the issuancechainstorage_ignore_duplicate_inserts branch March 21, 2025 15:03
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.

2 participants