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

Flush request to database #566

Merged
merged 1 commit into from
Oct 3, 2023
Merged

Conversation

lipoja
Copy link
Contributor

@lipoja lipoja commented Sep 18, 2023

Flush request to database to prevent UniqueViolation due to parallel requests processing.

[CLOUDDST-20061]

iib/web/models.py Outdated Show resolved Hide resolved
xDaile
xDaile previously approved these changes Sep 18, 2023
@yashvardhannanavati
Copy link
Collaborator

yashvardhannanavati commented Sep 18, 2023

Flush request to database to prevent UniqueViolation due to parallel requests processing.

I wonder how parallel requests processing is causing the UniqueViolation. Although the pullspec is same, the primary key i.e. ID for the two parallel requests would be different, no?

@lipoja
Copy link
Contributor Author

lipoja commented Sep 18, 2023

Flush request to database to prevent UniqueViolation due to parallel requests processing.

I wonder how parallel requests processing is causing the UniqueViolation. Although the pullspec is same, the primary key i.e. ID for the two parallel requests would be different, no?

Bu there is unique on pullspec.
see

pull_specification: Mapped[str] = db.mapped_column(index=True, unique=True)

Imaging running two requests on two workers almost at the same time.
First worker added this pullspec to db.session.
Second worker checked if pullspec is in DB., it was not there since it was not flushed yet.
First db.sessoin.flush()
Second worker hit the flush few moments later when there was the insert of pullspec again and it failed.

This is my hypotheses, I will sum it up in RCA tomorrow.

The question is if by adding this flush we do not flush some items to DB too early.

JAVGan
JAVGan previously approved these changes Sep 20, 2023
chandwanitulsi
chandwanitulsi previously approved these changes Sep 26, 2023
@lipoja lipoja dismissed stale reviews from chandwanitulsi and JAVGan via 0531f99 September 27, 2023 11:28
@lipoja lipoja force-pushed the flush_db branch 5 times, most recently from cd2c78d to 6a3b66c Compare October 3, 2023 10:31
xDaile
xDaile previously approved these changes Oct 3, 2023
@lipoja lipoja merged commit f682e9a into release-engineering:master Oct 3, 2023
2 checks passed
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.

5 participants