checksetup.pl fails to create the database if it doesn't exist
Categories
(Bugzilla :: Installation & Upgrading, defect)
Tracking
()
People
(Reporter: justdave, Assigned: justdave)
References
Details
(Keywords: regression)
Attachments
(2 files, 1 obsolete file)
Same thing happens for both MariaDB and MySQL.
Checking for DBD-MariaDB (any) ok: found v1.23
Checking for MariaDB (v10.0.5) ok: found v10.06.1600
DBI connect('host=localhost;database=bugs_5_0_6','bugs_test',...) failed: Unknown database 'bugs_5_0_6' at /usr/lib/x86_64-linux-gnu/perl5/5.34/DBI.pm line 691.
DBI::__ANON__(undef, undef) called at /usr/lib/x86_64-linux-gnu/perl5/5.34/DBI.pm line 748
DBI::connect("DBI", "dbi:MariaDB:host=localhost;database=bugs_5_0_6", "bugs_test", "mypassword", HASH(0x5561e9d22350)) called at /usr/share/perl5/DBIx/Connector.pm line 31
DBIx::Connector::_connect(DBIx::Connector=HASH(0x5561e9d378b0)) called at /usr/share/perl5/DBIx/Connector.pm line 75
DBIx::Connector::dbh(DBIx::Connector=HASH(0x5561e9d378b0)) called at (eval 540) line 17
Bugzilla::DB::dbh(Bugzilla::DB::MariaDB=HASH(0x5561e9ca66b0)) called at Bugzilla/DB.pm line 64
Bugzilla::DB::__ANON__(Bugzilla::DB::MariaDB=HASH(0x5561e9ca66b0), "SHOW VARIABLES LIKE 'max\\_allowed\\_packet'") called at Bugzilla/DB/MariaDB.pm line 314
Bugzilla::DB::MariaDB::bz_setup_database(Bugzilla::DB::MariaDB=HASH(0x5561e9ca66b0)) called at checksetup.pl line 133
at /usr/share/perl5/DBIx/Connector.pm line 31.
This works in 5.0.6 and does not in 5.2, so this is a regression. I would tag the regression bug, but it appears to have been committed without an associated bug number (grrr). This is the offending commit: https://github.com/bugzilla/bugzilla/commit/6eafd6a807ede6f2ca9e397d1d95fe44404a74c0
Tracing the code, the bz_create_database function in Bugzilla/DB.pm is checking whether it gets a handle back or not when attempting to connect to the database with the configured database name specified. Bugzilla 5.2 switched to using DBIx::Connector instead of using the DBDs raw. The connect method now apparently returns a database handle even if the specified database name isn't there, and even though it flags an error.
Assignee | ||
Updated•5 months ago
|
Assignee | ||
Comment 2•5 months ago
|
||
so it looks like DBIx:Connector->new returns a database handle whether or not the connection is successful because it doesn't actually try to connect. The connection isn't made until the first time you try to do something that requires it. Adding a $dbh->ping() immediately after the connection attempt makes it actually attempt the connection.
Comment 3•5 months ago
|
||
Comment 4•5 months ago
|
||
Assignee | ||
Updated•5 months ago
|
Assignee | ||
Updated•5 months ago
|
Assignee | ||
Comment 5•5 months ago
|
||
Comment on attachment 9401368 [details] [review]
[bugzilla/bugzilla] Bug 1896338: properly detect if the DB already exists during setup (#181)
https://github.com/bugzilla/bugzilla/commit/cc0cb77cc0b9b3058e1dc210e2dcb0b315bed1d0
Assignee | ||
Comment 6•5 months ago
|
||
Comment on attachment 9401370 [details] [review]
[bugzilla/harmony] Bug 1896338: properly detect if the DB already exists during setup (#132)
https://github.com/bugzilla/harmony/commit/e41274deddc91f69300065c9b34806fe3e494eff
Assignee | ||
Updated•5 months ago
|
Description
•