Skip to content

Commit

Permalink
Merge pull request #1528 from mwiencek/slow-reports
Browse files Browse the repository at this point in the history
Prevent two statement timeouts in reports
  • Loading branch information
mwiencek committed May 22, 2020
2 parents 8fae485 + 73dc083 commit b8f1f06
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 3 deletions.
6 changes: 6 additions & 0 deletions lib/MusicBrainz/Server/Report/QueryReport.pm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ sub run {
my $qualified_table = $self->qualified_table;
my $query = $self->query;

if ($self->can('statement_timeout')) {
$self->sql->do(
'SET LOCAL statement_timeout = ?',
$self->statement_timeout,
);
}
$self->sql->do("DROP TABLE IF EXISTS $qualified_table");
$self->sql->do(
"SELECT s.*
Expand Down
2 changes: 2 additions & 0 deletions lib/MusicBrainz/Server/Report/RecordingTrackDifferentName.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ use Moose;
with 'MusicBrainz::Server::Report::RecordingReport',
'MusicBrainz::Server::Report::FilterForEditor::RecordingID';

sub statement_timeout { '120s' }

sub query {
"
SELECT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ use Moose;
with 'MusicBrainz::Server::Report::RecordingReport',
'MusicBrainz::Server::Report::FilterForEditor::RecordingID';

# MBS-10843: This report has been disabled since the upgrade to PG 12,
# because its query can no longer execute in under 5 minutes in
# production.

sub query {
"
SELECT
Expand Down
3 changes: 1 addition & 2 deletions lib/MusicBrainz/Server/ReportFactory.pm
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ use MusicBrainz::Server::PagedReport;
RecordingsWithoutVALink
RecordingsWithEarliestReleaseRelationships
RecordingsWithVaryingTrackLengths
RecordingsSameNameDifferentArtistsSameName
RecordingTrackDifferentName
ReleasedTooEarly
ReleaseGroupsWithoutVACredit
Expand Down Expand Up @@ -146,7 +145,7 @@ use MusicBrainz::Server::Report::RecordingsWithoutVACredit;
use MusicBrainz::Server::Report::RecordingsWithoutVALink;
use MusicBrainz::Server::Report::RecordingsWithEarliestReleaseRelationships;
use MusicBrainz::Server::Report::RecordingsWithVaryingTrackLengths;
use MusicBrainz::Server::Report::RecordingsSameNameDifferentArtistsSameName;
#use MusicBrainz::Server::Report::RecordingsSameNameDifferentArtistsSameName;
use MusicBrainz::Server::Report::RecordingTrackDifferentName;
use MusicBrainz::Server::Report::ReleasedTooEarly;
use MusicBrainz::Server::Report::ReleaseGroupsWithoutVACredit;
Expand Down
7 changes: 6 additions & 1 deletion root/report/ReportsIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,12 @@ const ReportsIndex = ({$c}: {$c: CatalystContextT}) => (
to VA`)}
</a>
</li>
<li>
{/*
* MBS-10843: This report has been disabled since the upgrade
* to PG 12, because its query can no longer execute in under
* 5 minutes in production.
*/}
<li style={{display: 'none'}}>
<a href="/report/RecordingsSameNameDifferentArtistsSameName">
{l(`Recordings with the same name by different artists
with the same name`)}
Expand Down

0 comments on commit b8f1f06

Please sign in to comment.