[pkg-bacula-devel] Bug#975970: bacula-director-mysql broken SQL schema for mariadb-server-10.5

Sven Hartge sven at svenhartge.de
Fri Nov 27 15:10:18 GMT 2020


Um 13:58 Uhr am 27.11.20 schrieb Radoslav Bodó:

> ```
> # /usr/bin/mysql -NB bacula <
> /usr/share/dbconfig-common/data/bacula-director-mysql/install/mysql
> ERROR 1005 (HY000) at line 35: Can't create table `bacula`.`File`
> (errno: 150 "Foreign key constraint is incorrectly formed")
> ```

Yes, I can confirm the problem. Getting this solved may prove interesting,
as upstream does not officially support MariaDB.

After analyzing the problem for a bit, it seems a two part problem:

1) The order of table creation matters because tables whose keys get
referenced need to exist before referencing them. I have not yet found the
correct order and it seems the tables are referenced in a circular pattern
so there will never be a correct order.

In that case "SET FOREIGN_KEY_CHECKS=0;" at the start of the schema file
might be necessary.

2) After disabling those checks, there is still a different error in
bacula.Job and bacula.Pool:

,----
| Error in foreign key constraint of table `bacula`.`Pool`:
| Create table `bacula`.`Pool` with foreign key (ScratchPoolId) constraint
| failed. There is only prefix index in the referenced table where the
| referenced columns appear as the first columns.
`----

I have not yet found any explanation about that specific error on the net
anywhere.

Grüße,
Sven.



More information about the pkg-bacula-devel mailing list