Actions
action #154735
closed[error in gru journal] DBIx::Class::Storage::DBI::select_single(): Query returned more than one row size:S
Start date:
2024-02-01
Due date:
% Done:
0%
Estimated time:
Tags:
Description
Observation¶
In osd gru journal I can find several of those messages:
Jan 31 14:47:54 openqa openqa-gru[20400]: DBIx::Class::Storage::DBI::select_single(): Query returned more than one row. SQL that returns multiple rows is DEPRECATED for ->find and ->single at /usr/share/openqa/script/../lib/OpenQA/Schema/Result/ScheduledProducts.pm line 707
The code is getting one row of the WORKER_CLASS settings from a job and its parent and then compares them:
https://github.com/os-autoinst/openQA/blob/master/lib/OpenQA/Schema/Result/ScheduledProducts.pm#L707-L711
$worker_class = $job->settings->find({key => 'WORKER_CLASS'});
$worker_class = $worker_class ? $worker_class->value : '';
}
my $parent_worker_class
= $schema->resultset('JobSettings')->find({job_id => $parent, key => 'WORKER_CLASS'});
Not sure how that's supposed to work as the WORKER_CLASSes are in multiple rows. I assume it "works" because the first row is usually consistent because postgres orders by id by default?
Suggestions¶
- Read documentation about DBIx::Class on https://metacpan.org/pod/DBIx::Class::ResultSet#METHODS about find/single/search. Understand what is going wrong here and adjust the database queries to return only one row or change to search and select one row afterwards.
- Adjust in https://github.com/os-autoinst/openQA/blob/master/lib/OpenQA/Schema/Result/ScheduledProducts.pm#L707-L711
$schema->resultset('JobSettings')->search({...}, {rows => 1})->first
Actions