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

Prevent massive database errors on screenshot insertion #2597

Merged
merged 1 commit into from
Dec 12, 2019

Conversation

okurz
Copy link
Member

@okurz okurz commented Dec 12, 2019

The previous approach was to catch conflicts on screenshot insertion in
perl context yielding the right functional behaviour but also causing a
log entry for every image object amounting to multiple gigabytes of
postgres database error log files which can cause obvious problems. By
using a similar approach as is already done in
lib/OpenQA/Schema/Result/Jobs.pm with raw SQL we can ask the database
for silent conflict handling and more efficiently not involving perl
exception handling.

Related progress issue: https://progress.opensuse.org/issues/60926

The previous approach was to catch conflicts on screenshot insertion in
perl context yielding the right functional behaviour but also causing a
log entry for every image object amounting to multiple gigabytes of
postgres database error log files which can cause obvious problems. By
using a similar approach as is already done in
lib/OpenQA/Schema/Result/Jobs.pm with raw SQL we can ask the database
for silent conflict handling and more efficiently not involving perl
exception handling.

Related progress issue: https://progress.opensuse.org/issues/60926
@codecov
Copy link

codecov bot commented Dec 12, 2019

Codecov Report

Merging #2597 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2597      +/-   ##
==========================================
+ Coverage   91.57%   91.59%   +0.01%     
==========================================
  Files         181      181              
  Lines       11233    11226       -7     
==========================================
- Hits        10287    10282       -5     
+ Misses        946      944       -2
Impacted Files Coverage Δ
lib/OpenQA/Schema/Result/Screenshots.pm 100% <ø> (ø) ⬆️
lib/OpenQA/Schema/ResultSet/Screenshots.pm 100% <100%> (ø) ⬆️
lib/OpenQA/Worker/Job.pm 71.45% <0%> (+0.33%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a77e8a6...f8daf5a. Read the comment docs.

Copy link
Contributor

@Martchus Martchus left a comment

Choose a reason for hiding this comment

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

Nice test - have you executed it without the actual code change to see whether it actually works?

@okurz
Copy link
Member Author

okurz commented Dec 12, 2019

Nice test - have you executed it without the actual code change to see whether it actually works?

of course!

    #   Failed test 'no unique constraint error in dabatabase logs'
    #   at t/42-screenshots.t line 96.
    #          got: '1'
    #     expected: anything else
    # Looks like you failed 1 test of 1.

#   Failed test 'no errors in database log'
#   at t/42-screenshots.t line 97.

@okurz okurz merged commit bd1d48e into os-autoinst:master Dec 12, 2019
@okurz okurz deleted the feature/clone_custom_list branch December 12, 2019 16:15
okurz added a commit to okurz/openQA that referenced this pull request Dec 18, 2019
Same as previously for screenshots where we fixed the same error in both
locations where a DB insertion is done already in
os-autoinst#1792 and
os-autoinst#2597 we should also prevent
expected conflicts to cause an error entry in postgres logs about job
modules. This is a followup to ecb7d1d where the unique constraint for
job modules was introduced.

Related progress issue: https://progress.opensuse.org/issues/60923
okurz added a commit to okurz/openQA that referenced this pull request Dec 18, 2019
Same as previously for screenshots where we fixed the same error in both
locations where a DB insertion is done already in
os-autoinst#1792 and
os-autoinst#2597 we should also prevent
expected conflicts to cause an error entry in postgres logs about job
modules. This is a followup to ecb7d1d where the unique constraint for
job modules was introduced.

Related progress issue: https://progress.opensuse.org/issues/60923
okurz added a commit to okurz/openQA that referenced this pull request Dec 18, 2019
Same as previously for screenshots where we fixed the same error in both
locations where a DB insertion is done already in
os-autoinst#1792 and
os-autoinst#2597 we should also prevent
expected conflicts to cause an error entry in postgres logs about job
modules. This is a followup to ecb7d1d where the unique constraint for
job modules was introduced.

Related progress issue: https://progress.opensuse.org/issues/60923
okurz added a commit to okurz/openQA that referenced this pull request Jan 24, 2020
Same as previously for screenshots where we fixed the same error in both
locations where a DB insertion is done already in
os-autoinst#1792 and
os-autoinst#2597 we should also prevent
expected conflicts to cause an error entry in postgres logs about job
modules. This is a followup to ecb7d1d where the unique constraint for
job modules was introduced.

Related progress issue: https://progress.opensuse.org/issues/60923
okurz added a commit to okurz/openQA that referenced this pull request Mar 2, 2020
Same as previously for screenshots where we fixed the same error in both
locations where a DB insertion is done already in
os-autoinst#1792 and
os-autoinst#2597 we should also prevent
expected conflicts to cause an error entry in postgres logs about job
modules. This is a followup to ecb7d1d where the unique constraint for
job modules was introduced.

Related progress issue: https://progress.opensuse.org/issues/60923
okurz added a commit to okurz/openQA that referenced this pull request Mar 2, 2020
Same as previously for screenshots where we fixed the same error in both
locations where a DB insertion is done already in
os-autoinst#1792 and
os-autoinst#2597 we should also prevent
expected conflicts to cause an error entry in postgres logs about job
modules. This is a followup to ecb7d1d where the unique constraint for
job modules was introduced.

Related progress issue: https://progress.opensuse.org/issues/60923
okurz added a commit to okurz/openQA that referenced this pull request Mar 4, 2020
Same as previously for screenshots where we fixed the same error in both
locations where a DB insertion is done already in
os-autoinst#1792 and
os-autoinst#2597 we should also prevent
expected conflicts to cause an error entry in postgres logs about job
modules. This is a followup to ecb7d1d where the unique constraint for
job modules was introduced.

Related progress issue: https://progress.opensuse.org/issues/60923
okurz added a commit to okurz/openQA that referenced this pull request Mar 4, 2020
Same as previously for screenshots where we fixed the same error in both
locations where a DB insertion is done already in
os-autoinst#1792 and
os-autoinst#2597 we should also prevent
expected conflicts to cause an error entry in postgres logs about job
modules. This is a followup to ecb7d1d where the unique constraint for
job modules was introduced.

Related progress issue: https://progress.opensuse.org/issues/60923
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.

None yet

3 participants