Skip to content

bvfs: Prevent from unique key violations on .bvfs_update#545

Merged
sduehr merged 1 commit intomasterfrom
dev/sduehr/master/fix-bvfs-update-constraint-violation
Jul 17, 2020
Merged

bvfs: Prevent from unique key violations on .bvfs_update#545
sduehr merged 1 commit intomasterfrom
dev/sduehr/master/fix-bvfs-update-constraint-violation

Conversation

@sduehr
Copy link
Member

@sduehr sduehr commented Jun 15, 2020

When multiple .bvfs_update operations were run simultaneously and
both jobs have many common paths, it was possible that this caused
unique constraint violation errors (PostgreSQL) or duplicate entry
errors (MySQL/MariaDB). While this did not cause any functional
problem, it could bloat logs with lots of error messages in some
cases. This change adds an explicit exclusive write lock to prevent
from such error messages.

When multiple .bvfs_update operations were run simultaneously and
both jobs have many common paths, it was possible that this caused
unique constraint violation errors (PostgreSQL) or duplicate entry
errors (MySQL/MariaDB). While this did not cause any functional
problem, it could bloat logs with lots of error messages in some
cases. This change adds an explicit exclusive write lock to prevent
from such error messages.
@sduehr sduehr requested a review from arogge June 18, 2020 10:02
Copy link
Member

@arogge arogge left a comment

Choose a reason for hiding this comment

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

I could sleep a lot better if the transaction wasn't started and committed implicitly by the commands without the abstraction layer knowing what is going on.
Could we have StartTransaction() and EndTransaction() in the code and then just the lock and unlock queries in the actual query-files?
This will require a NO-OP query in case of PostgreSQL, but I think I'd still like that better.

Copy link
Member

@arogge arogge left a comment

Choose a reason for hiding this comment

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

After learning the hurdles of doing this right, I think it is OK to do it this way.

@sduehr sduehr merged commit fb7305d into master Jul 17, 2020
@sduehr sduehr deleted the dev/sduehr/master/fix-bvfs-update-constraint-violation branch July 17, 2020 10:54
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