fix: silence noisy "Ignoring duplicate key error" messages. Fixes #14344 #14357
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #14344
Motivation
When offloading a workflow, it's possible for multiple workers to concurrently call
Save()
with the same workflow, which leads toERROR: duplicate key value violates unique constraint "argo_workflows_pkey"
messages in the logs, along with a stack trace.These messages are cluttering the logs and confusing users. Duplicate key errors are harmless:
Save()
detects them automatically and will return theversion
hash. Sinceversion
is part of the primary key of theargo_workflows
table, that means it's guaranteed to be identical to the previously-inserted row.Modifications
This decreases the log level of that message to
DEBUG
so that it doesn't clutter the logs. I thought about removing it entirely, but I figured it's worth keeping just in case there's an edge case we need to debug.Verification
I wasn't able to reproduce the error locally, but I verified workflow offloading works by following these steps:
ALWAYS_OFFLOAD_NODE_STATUS
enabled:make start PROFILE=postgres UI=true ALWAYS_OFFLOAD_NODE_STATUS=true
Documentation
N/A