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 two statement timeouts in reports #1528

Merged
merged 2 commits into from
May 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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