Skip to content

Commit ecb81f4

Browse files
committed
Merge branch 'master' into development
* master: Bumped version to 202500611.1 Revert "Bug 1965553 - Uplift approval set in bugzilla without relman approval" Bug 1967336 - The error message generated by timeout of long running searches needs to also work with REST API in addition to the web UI Bug 1970652 - Move SQL comment to beginning of SQL statement so it is not truncated away in Googles Query Insights Bug 1965553 - Uplift approval set in bugzilla without relman approval Bumped version to 20250529.1 Bug 1969307 - BMO ETL: Fix logic bug introduced by bug 1968044 that caused the looping of database rows to exit too early leaving out data
2 parents e26c2f9 + ed60335 commit ecb81f4

File tree

7 files changed

+47
-30
lines changed

7 files changed

+47
-30
lines changed

Bugzilla.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use warnings;
1313

1414
use Bugzilla::Logging;
1515

16-
our $VERSION = '20250513.1';
16+
our $VERSION = '20250611.1';
1717

1818
use Bugzilla::Auth;
1919
use Bugzilla::Auth::Persist::Cookie;

Bugzilla/DB/Mysql.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ sub on_dbi_connected {
7777
# causing bug 321645. TRADITIONAL sets these modes (among others) as
7878
# well, so it has to be stipped as well
7979
my $new_sql_mode = join(",",
80-
grep { $_ !~ /^STRICT_(?:TRANS|ALL)_TABLES|TRADITIONAL$/ }
80+
grep { $_ !~ /^STRICT_(?:TRANS|ALL)_TABLES|TRADITIONAL|ONLY_FULL_GROUP_BY$/ }
8181
split(/,/, $sql_mode));
8282

8383
if ($sql_mode ne $new_sql_mode) {

Bugzilla/Search.pm

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use Bugzilla::Error;
2222
use Bugzilla::Field;
2323
use Bugzilla::Group;
2424
use Bugzilla::Keyword;
25+
use Bugzilla::Logging;
2526
use Bugzilla::Search::Clause;
2627
use Bugzilla::Search::ClauseGroup;
2728
use Bugzilla::Search::Condition qw(condition);
@@ -845,8 +846,8 @@ sub data {
845846
}
846847

847848
# Do we just want bug IDs to pass to the 2nd query or all the data immediately?
848-
#my $func = $all_in_bugs_table ? 'selectall_arrayref' : 'selectcol_arrayref';
849-
#my $bug_ids = $dbh->$func($sql);
849+
my $func = $all_in_bugs_table ? 'selectall_arrayref' : 'selectcol_arrayref';
850+
my $bug_ids = $self->_sql_execute($sql, $func);
850851
my @extra_data = ({sql => $sql, time => tv_interval($start_time)});
851852

852853
# Restore the original 'fields' argument, just in case.
@@ -883,9 +884,7 @@ sub data {
883884

884885
$start_time = [gettimeofday()];
885886
$sql = $search->_sql;
886-
$sth = $dbh->prepare($sql);
887-
$dbh->bz_call_with_timeout($sth);
888-
my $unsorted_data = $sth->fetchall_arrayref();
887+
my $unsorted_data = $search->_sql_execute($sql, 'selectall_arrayref');
889888
push(@extra_data, {sql => $sql, time => tv_interval($start_time)});
890889

891890
# Let's sort the data. We didn't do it in the query itself because
@@ -987,21 +986,48 @@ sub _sql {
987986
my $user_agent = $cgi->user_agent || $cgi->script_name;
988987
my $query_string = $cgi->canonicalize_query();
989988
my $query = <<END;
990-
SELECT $timeout_comment $select
991-
FROM $from
992-
WHERE $where
993-
$group_by$order_by$limit
994989
/*
995990
user-id: $user_id
996991
remote-ip: $remote_ip
997992
user-agent: $user_agent
998993
query-string: $query_string
999994
*/
995+
SELECT $timeout_comment $select
996+
FROM $from
997+
WHERE $where
998+
$group_by$order_by$limit
1000999
END
10011000
$self->{sql} = $query;
10021001
return $self->{sql};
10031002
}
10041003

1004+
sub _sql_execute {
1005+
my ($self, $sql, $func) = @_;
1006+
my $dbh = Bugzilla->dbh;
1007+
1008+
my $results;
1009+
do {
1010+
local $SIG{__DIE__} = undef;
1011+
local $SIG{__WARN__} = undef;
1012+
1013+
$results = eval { $dbh->$func($sql) };
1014+
1015+
# If the search query failed, handle Throw*Error correctly, or for all other
1016+
# failures log it and return an empty list of bugs.
1017+
if (my $search_err = $@) {
1018+
return if ref $search_err eq 'ARRAY' && $search_err->[0] eq "EXIT\n";
1019+
if (!ref $search_err
1020+
&& $search_err =~ /maximum statement execution time exceeded/)
1021+
{
1022+
ThrowUserError('db_search_timeout');
1023+
}
1024+
ERROR(Dumper($self->_params) . ' ' . Dumper($search_err));
1025+
}
1026+
};
1027+
1028+
return $results;
1029+
}
1030+
10051031
sub search_description {
10061032
my ($self, $params) = @_;
10071033
my $desc = $self->{'search_description'} ||= [];

Bugzilla/WebService/Bug.pm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use Bugzilla::Comment::TagWeights;
1818
use Bugzilla::Constants;
1919
use Bugzilla::Error;
2020
use Bugzilla::Field;
21+
use Bugzilla::Logging;
2122
use Bugzilla::WebService::Constants;
2223
use Bugzilla::WebService::Util
2324
qw(extract_flags filter filter_wants validate translate);
@@ -35,6 +36,7 @@ use Bugzilla::Search::Quicksearch;
3536

3637
use List::Util qw(max);
3738
use List::MoreUtils qw(uniq);
39+
use Mojo::Util qw(dumper);
3840
use Storable qw(dclone);
3941
use Types::Standard -all;
4042
use Type::Utils;
@@ -695,6 +697,8 @@ sub search {
695697
$options{params} = $match_params;
696698

697699
my $search = new Bugzilla::Search(%options);
700+
701+
# Execute the query.
698702
my ($data) = $search->data;
699703

700704
# BMO if the caller only wants the count, that's all we need to return

Bugzilla/WebService/Constants.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ use constant WS_ERROR_CODE => {
229229

230230
# Search errors are 1000-1100
231231
buglist_parameters_required => 1000,
232+
db_search_timeout => 1001,
232233

233234
# Job queue errors 1400-1500
234235
jobqueue_status_error => 1400,

buglist.cgi

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -721,24 +721,10 @@ $::SIG{TERM} = 'DEFAULT';
721721
$::SIG{PIPE} = 'DEFAULT';
722722

723723
# Execute the query.
724-
my ($data, $extra_data);
725-
do {
726-
local $SIG{__DIE__} = undef;
727-
local $SIG{__WARN__} = undef;
728-
($data, $extra_data) = eval { $search->data };
729-
# If the search query failed, handle Throw*Error correctly, or for all other
730-
# failures log it and return an empty list of bugs.
731-
if (my $search_err = $@) {
732-
return if ref $search_err eq 'ARRAY' && $search_err->[0] eq "EXIT\n";
733-
if (!ref $search_err && $search_err =~ /maximum statement execution time exceeded/) {
734-
ThrowUserError('db_search_timeout');
735-
}
736-
use Data::Dumper;
737-
ERROR 'buglist.cgi?' . $cgi->query_string . " " . Dumper($search_err);
738-
}
739-
};
724+
my ($data, $extra_data) = $search->data;
740725

741726
$vars->{'search_description'} = $search->search_description;
727+
742728
if ( $cgi->param('debug')
743729
&& Bugzilla->params->{debug_group}
744730
&& $user->in_group(Bugzilla->params->{debug_group}))

template/en/default/global/user-error.html.tmpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -491,9 +491,9 @@
491491

492492
[% ELSIF error == "db_search_timeout" %]
493493
[% title = "Request Timed Out" %]
494-
Sorry, its taking too long to get the information you asked for. Please
495-
try again in a moment. If it still doesnt work, try using a simpler
496-
search or narrowing down your request.
494+
Sorry, it's taking too long to get the information you asked for. Please
495+
try again in a moment. If it still doesn't work, try using a simpler
496+
search or narrowing down your request.
497497

498498
[% ELSIF error == "dependency_loop_multi" %]
499499
[% title = "Dependency Loop Detected" %]

0 commit comments

Comments
 (0)