Skip to content
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.

Duplicate key values when inserting values from multiple connections #9

Open
Adzox opened this issue Jun 13, 2018 · 0 comments
Open
Assignees

Comments

@Adzox
Copy link

Adzox commented Jun 13, 2018

I have two connections to the database using pg_prometheus, which both insert data on the form test_id{sender=nina} id timestamp, to the database with different id values and timestamps. I sometimes, two times out of 5 perhaps, get the following exception:

IntegrityError: duplicate key value violates unique constraint "metrics_labels_metric_name_labels_key" DETAIL: Key (metric_name, labels)=(test_id, {"sender": "nina1"}) already exists. CONTEXT: SQL statement " INSERT INTO metrics_labels (metric_name, labels) VALUES ('test_id', '{"sender": "nina1"}') RETURNING id

from the following function: PL/pgSQL function prometheus.insert_view_normal() line 20 at EXECUTE

Worth noting is that I am using python 3 + psycopg2 lib, using execute_values() with an upsert doing nothing on conflict.

Is the problem at your side, or is it bad timing/my setup/the library I'm using?

Thanks in advance~

@bboule bboule self-assigned this Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants