Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

error when upgrading

47 views
Skip to first unread message

Ross, Christine

unread,
Oct 30, 2017, 12:42:07 PM10/30/17
to support-...@lists.mozilla.org
I have done upgrades before and imported the database and run checksetup.pl without problems. I am upgrading from 4.2.1 to 4.4.12 on unix with a mysql database. I install the software, import the database, import the existing data and localconfig file. When I run checksetup.pl it fails on

Setting up foreign keys...
DBD::mysql::db do failed: Can't create table 'bugzilla.#sql-98e_8' (errno: 121) [for Statement "ALTER TABLE attach_data ADD
CONSTRAINT fk_attach_data_id_attachments_attach_id FOREIGN KEY (id)
REFERENCES attachments(attach_id)
ON UPDATE CASCADE ON DELETE CASCADE"] at Bugzilla/DB.pm line 638.
Bugzilla::DB::bz_add_fks(Bugzilla::DB::Mysql=HASH(0xf5f700), "attach_data", HASH(0x29a33a4), HASH(0x4dc0408)) called at Bugzilla/DB.pm line 542
Bugzilla::DB::bz_setup_foreign_keys(Bugzilla::DB::Mysql=HASH(0xf5f700)) called at Bugzilla/Install/DB.pm line 722
Bugzilla::Install::DB::update_table_definitions(HASH(0x5927bc)) called at ./checksetup.pl line 170


I want to import the old database but can't get further.

I have searched and searched, without success.

Help would be appreciated.

Christine

Gervase Markham

unread,
Oct 31, 2017, 6:16:46 AM10/31/17
to Ross, Christine
On 27/10/17 21:30, Ross, Christine wrote:
> I have done upgrades before and imported the database and run
> checksetup.pl without problems. I am upgrading from 4.2.1 to 4.4.12
> on unix with a mysql database. I install the software, import the
> database, import the existing data and localconfig file.

What do you mean by "import" in each of these cases? Bugzilla is
designed to be upgraded in-place. Are you creating a new instance of
Bugzilla cloned from the old one and upgrading that?

Is your Bugzilla customized in any way?

Does your MySQL user have sufficient permissions to alter the database?

> When I
> run checksetup.pl it fails on
>
> Setting up foreign keys... DBD::mysql::db do failed: Can't create
> table 'bugzilla.#sql-98e_8' (errno: 121)

I don't know why a foreign key constraint creation would be failing
because we check for existence before creating them...

Gerv

christin...@gmail.com

unread,
Dec 5, 2017, 2:52:24 PM12/5/17
to
I installed bugzilla on a new server and imported the database and data directory. When I run checksetup.pl and importing the data, I get this error.

WARNING: There were invalid values in attach_data.id that have been
deleted: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 73, 74,
...

BD::mysql::db do failed: Can't create table 'bugzilla.#sql-322d_6' (errno: 121) [for Statement "ALTER TABLE attach_data ADD
CONSTRAINT fk_attach_data_id_attachments_attach_id FOREIGN KEY (id)
REFERENCES attachments(attach_id)
ON UPDATE CASCADE ON DELETE CASCADE"] at Bugzilla/DB.pm line 638.
Bugzilla::DB::bz_add_fks('Bugzilla::DB::Mysql=HASH(0x677e5f8)', 'attach_data', 'HASH(0x6051378)', 'HASH(0x9ae0240)') called at Bugzilla/DB.pm line 542
Bugzilla::DB::bz_setup_foreign_keys('Bugzilla::DB::Mysql=HASH(0x677e5f8)') called at Bugzilla/Install/DB.pm line 722
Bugzilla::Install::DB::update_table_definitions('HASH(0x2914d20)') called at ./checksetup.pl line 170

Any ideas?

Thorsten Schöning

unread,
Dec 5, 2017, 3:28:07 PM12/5/17
to support-...@lists.mozilla.org
Guten Tag christin...@gmail.com,
am Dienstag, 5. Dezember 2017 um 20:52 schrieben Sie:

> I installed bugzilla on a new server and imported the database and
> data directory. When I run checksetup.pl and importing the data, I get this error.

Which versions of Bugzilla are you using, new and old?

> WARNING: There were invalid values in attach_data.id that have been
> deleted: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 73, 74,
> ...

Try running sanity check in the old installation.

> BD::mysql::db do failed: Can't create table 'bugzilla.#sql-322d_6'
> (errno: 121) [for Statement "ALTER TABLE attach_data ADD
> CONSTRAINT fk_attach_data_id_attachments_attach_id FOREIGN KEY (id)
> REFERENCES attachments(attach_id)
> ON UPDATE CASCADE ON DELETE CASCADE"] at Bugzilla/DB.pm line 638.

Are you sure that the new database has been empty before importing
your dump and running checksetup.pl? If you ran checksetup.pl multiple
times in the same database already, drop it and start with a fresh new
database.

Error 121 most likely means that a foreign key with that name is
already available or that it can't be created because of wrong data.
So you need to have a closer look at your database.

Mit freundlichen Grüßen,

Thorsten Schöning

--
Thorsten Schöning E-Mail: Thorsten....@AM-SoFT.de
AM-SoFT IT-Systeme http://www.AM-SoFT.de/

Telefon...........05151- 9468- 55
Fax...............05151- 9468- 88
Mobil..............0178-8 9468- 04

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow

christin...@gmail.com

unread,
Dec 5, 2017, 3:36:07 PM12/5/17
to
Hi. Yes the database is empty before importing. The old version is 4.2.1 and the new is 4.4.12. Already tried the sanity check.

christin...@gmail.com

unread,
Dec 5, 2017, 3:37:40 PM12/5/17
to
I also tried turning off foreign keys check in bugzilla-4.4.12/Bugzilla/DB.pm but that didn't help.

christin...@gmail.com

unread,
Dec 5, 2017, 4:21:43 PM12/5/17
to
> > > AM-SoFT GmbH IT/var/www/html/bugzilla-4.4.12/Bugzilla/Install/DB.pm-Systeme, Brandenburger Str. 7c, 31789 Hameln
> > > AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow
>
> I also tried turning off foreign keys check in
bugzilla-4.4.12/Bugzilla/DB.pm but that didn't help.

Correction, I turned off foreign key check in

/var/www/html/bugzilla-4.4.12/Bugzilla/Install/DB.pm line 153 but that didn't help.

12/05/2017 - CSR add the following $dbh->do('SET foreign_key_checks = 0');
sub update_table_definitions {
my $old_params = shift;
my $dbh = Bugzilla->dbh;
$dbh->do('SET foreign_key_checks = 0');

Thorsten Schöning

unread,
Dec 6, 2017, 3:25:18 AM12/6/17
to support-...@lists.mozilla.org
Guten Tag christin...@gmail.com,
am Dienstag, 5. Dezember 2017 um 21:36 schrieben Sie:

> The old version is 4.2.1 and the new is 4.4.12.

Any special reason you don't try the latest stable version 5.0.3? It
may contain relevant fixes.

> Already tried the sanity check.

So what's the result, no problems, everything fixed, something else?

christin...@gmail.com

unread,
Dec 6, 2017, 9:26:49 AM12/6/17
to
Hello.

No, I can't get past the foreign keys error when running checksetup.pl. Even after editing the install/DB.pm file not to check (suggested in a post). Does v5.0.3 address failing foreign keys checks please? I would love to get this installed. Thanks for your responses though.

Thorsten Schöning

unread,
Dec 6, 2017, 11:49:03 AM12/6/17
to support-...@lists.mozilla.org
Guten Tag christin...@gmail.com,
am Mittwoch, 6. Dezember 2017 um 15:26 schrieben Sie:

> No, I can't get past the foreign keys error when running
> checksetup.pl.

I don't understand that answer, is it related to the sanity check in
your old Bugzilla or to using version 5.0.3?

If it's for sanity check, trying to upgrade without fixing the error
before doesn't make much sense, so focus on finding and fixing the
errors in your database in the old version.

If it's related to 5.0.3, you don't need to upgrade step-by-step, but
can simply try to upgrade to 5.0.3 from your 4.2 directly. It may or
may not change things.

> Even after editing the install/DB.pm file not to
> check (suggested in a post).

In my opinion, this is no good advice at all, because that would keep
your broken data and you would run into the same problems during each
and every upgrade. You need to fix the root cause.

> Does v5.0.3 address failing foreign keys checks please?

I don't no, I guess that heavily depends on the problems with your
data. My assumption is that either 5.0.3 can repair your data or not,
in which case you need to have a more detailed look at your data and
fix it manually. In that case, start at looking the tables attach_data
and attachment with the columns mentioned in your original error
message. There is surely something wrong with IDs, it's not normal
that Bugzilla deletes rows in its own. That should make you question
things already: Why are those rows there? What is missing? What do
those rows contain etc.? Deleting attachments is disabled by default
for example.

> allow_attachment_deletion
0 new messages