On the newly created job Koha_Master_D9_MDB_Latest: koha_1 | # Looks like you planned 2 tests but ran 1. koha_1 | koha_1 | # Failed test 'AddReturn logging on statistics table (item-level_itypes=0)' koha_1 | # at t/db_dependent/Circulation/Returns.t line 249. koha_1 | Can't call method "itemtype" on an undefined value at t/db_dependent/Circulation/Returns.t line 247. I recreate locally with this configuration (latest MariaDB version), and tried to debug: modified: t/db_dependent/Circulation/Returns.t @ Returns.t:245 @ subtest "AddReturn logging on statistics table (item-level_itypes=0)" => sub { branch => $branch, type => 'return', itemnumber => $item_without_itemtype->{ itemnumber } - }, { order_by => { -asc => 'datetime' } })->next(); + }, { order_by => { -asc => 'datetime' } }); + warn $stat->count; + $stat = $stat->next; is( $stat->itemtype, $blevel_itemtype, "biblio-level itype recorded on statistics for return"); }; subtest 'Handle ids duplication' => sub { Guess what? ->count returns 1 but ->next returns undef!
Created attachment 96153 [details] [review] Bug 24148: Using some black magic
Recreated from the MariaDB CLI. MariaDB [koha_kohadev]> SELECT itemnumber, `type`, borrowernumber from statistics WHERE ( `itemnumber` = 1087 AND `type` = 'return' ); +------------+--------+----------------+ | itemnumber | type | borrowernumber | +------------+--------+----------------+ | 1087 | return | 122 | +------------+--------+----------------+ 1 row in set (0.00 sec) MariaDB [koha_kohadev]> SELECT itemnumber, borrowernumber, datetime from statistics WHERE ( `itemnumber` = 1087 AND `type` = 'return' ) ORDER BY `datetime` ASC; +------------+----------------+---------------------+ | itemnumber | borrowernumber | datetime | +------------+----------------+---------------------+ | 1087 | 122 | 2019-12-10 13:35:55 | +------------+----------------+---------------------+ 1 row in set (0.00 sec) MariaDB [koha_kohadev]> SELECT itemnumber, borrowernumber, datetime, type from statistics WHERE ( `itemnumber` = 1087 AND `type` = 'return' ) ORDER BY `datetime` ASC; +------------+----------------+---------------------+--------+ | itemnumber | borrowernumber | datetime | type | +------------+----------------+---------------------+--------+ | 1087 | 122 | 2019-12-10 13:35:55 | return | +------------+----------------+---------------------+--------+ 1 row in set (0.00 sec) MariaDB [koha_kohadev]> SELECT * from statistics WHERE ( `itemnumber` = 1087 AND `type` = 'return' ) ORDER BY `datetime` ASC; Empty set (0.00 sec) MariaDB [koha_kohadev]> SELECT * from statistics WHERE ( `itemnumber` = 1087 AND `type` = 'return' ) ORDER BY `itemnumber` ASC; +---------------------+-----------+--------+--------+-------+------------+----------+----------+----------------+----------------------------------------------------------------------------------+ | datetime | branch | value | type | other | itemnumber | itemtype | location | borrowernumber | ccode | +---------------------+-----------+--------+--------+-------+------------+----------+----------+----------------+----------------------------------------------------------------------------------+ | 2019-12-10 13:35:55 | iObbbKovf | 0.0000 | return | | 1087 | SgqzzzD | NULL | 122 | vghO1ljHGphe13fp_LDxGDhsYFQqTSEMJ3S2aQXYyK2gMVlo1Q3b3rpn_FQCEPKqlIgCv0iSHpc1tRdy | +---------------------+-----------+--------+--------+-------+------------+----------+----------+----------------+----------------------------------------------------------------------------------+ 1 row in set (0.00 sec) MariaDB [koha_kohadev]> SELECT * from statistics WHERE ( `itemnumber` = 1087 AND `type` = 'return' ) ORDER BY `datetime` ASC; Empty set (0.00 sec) MariaDB [koha_kohadev]> SELECT itemnumber, borrowernumber from statistics WHERE ( `itemnumber` = 1087 AND `type` = 'return' ) ORDER BY `datetime` ASC; +------------+----------------+ | itemnumber | borrowernumber | +------------+----------------+ | 1087 | 122 | +------------+----------------+ 1 row in set (0.00 sec)
MariaDB [koha_kohadev]> SELECT `type`, `itemnumber` FROM `statistics` WHERE ( ( `branch` = 'iObbbKovf' AND `itemnumber` = 1087 AND `type` = 'return' ) ) ORDER BY `datetime` ASC; +--------+------------+ | type | itemnumber | +--------+------------+ | return | 1087 | +--------+------------+ 1 row in set (0.00 sec) MariaDB [koha_kohadev]> SELECT `type`, `itemnumber`, `other` FROM `statistics` WHERE ( ( `branch` = 'iObbbKovf' AND `itemnumber` = 1087 AND `type` = 'return' ) ) ORDER BY `datetime` ASC; Empty set (0.00 sec) MariaDB [koha_kohadev]> SELECT `type`, `itemnumber`, `borrowernumber` FROM `statistics` WHERE ( ( `branch` = 'iObbbKovf' AND `itemnumber` = 1087 AND `type` = 'return' ) ) ORDER BY `datetime` ASC; +--------+------------+----------------+ | type | itemnumber | borrowernumber | +--------+------------+----------------+ | return | 1087 | 122 | +--------+------------+----------------+ 1 row in set (0.00 sec) MariaDB [koha_kohadev]> SELECT `type`, `itemnumber`, `itemtype` FROM `statistics` WHERE ( ( `branch` = 'iObbbKovf' AND `itemnumber` = 1087 AND `type` = 'return' ) ) ORDER BY `datetime` ASC; +--------+------------+----------+ | type | itemnumber | itemtype | +--------+------------+----------+ | return | 1087 | SgqzzzD | +--------+------------+----------+ 1 row in set (0.00 sec) MariaDB [koha_kohadev]> SELECT `type`, `itemnumber`, `other` FROM `statistics` WHERE ( ( `branch` = 'iObbbKovf' AND `itemnumber` = 1087 AND `type` = 'return' ) ) ORDER BY `itemnumber` ASC; +--------+------------+-------+ | type | itemnumber | other | +--------+------------+-------+ | return | 1087 | | +--------+------------+-------+ 1 row in set (0.00 sec) MariaDB [koha_kohadev]> SELECT `type`, `itemnumber`, `other` FROM `statistics` WHERE ( ( `branch` = 'iObbbKovf' AND `itemnumber` = 1087 AND `type` = 'return' ) ) ORDER BY `borrowernumber` ASC; Empty set (0.00 sec)
This has been fixed in our CI between run 7 (Dec 10) and 8 (Dec 11) I do no longer recreate in a docker container with stretch and MariaDB 10.4.11
(In reply to Jonathan Druart from comment #4) > This has been fixed in our CI between run 7 (Dec 10) and 8 (Dec 11) > > I do no longer recreate in a docker container with stretch and MariaDB > 10.4.11 Note that 10.4.11 has been released on Dec 11! https://mariadb.com/kb/en/library/mariadb-10411-release-notes/