Bug 724894 - Can't create bacula MySQL tables
Summary: Can't create bacula MySQL tables
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: bacula
Version: 15
Hardware: All
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Andreas Thienemann
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-07-22 08:17 UTC by Edouard Bourguignon
Modified: 2012-07-18 09:19 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-07-18 09:19:14 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
proposed patch which adds quotes to MaxValue column (7.05 KB, patch)
2011-08-17 10:54 UTC, Honza Horak
no flags Details | Diff
Patch for MaxValue issue from upstream git (2.07 KB, patch)
2011-10-24 09:04 UTC, Lukáš Nykrýn
no flags Details | Diff

Description Edouard Bourguignon 2011-07-22 08:17:48 UTC
Description of problem:
After the bacula database have been created with bacula's scripts, the tables creation fails on a mysql syntax error. Only the "Counters" table is not created, but this table is certainly mandatory.

Version-Release number of selected component (if applicable):
bacula-director-mysql-5.0.3-9.fc15.x86_64
bacula-director-common-5.0.3-9.fc15.x86_64

How reproducible:
static

Steps to Reproduce:
1. yum install mysql-server bacula-director-mysql
2. /usr/libexec/bacula/create_bacula_database
3. /usr/libexec/bacula/make_mysql_tables
  
Actual results:
Script make_mysql_tables fails with:
manual that corresponds to your MySQL server version for the right syntax to use near 'MaxValue INTEGER DEFAULT 0,
   CurrentValue INTEGER DEFAULT 0,
   WrapCounter TI' at line 4


Expected results:
All tables should be created

Additional info:
Is there any readme file for fedora installation of bacula?

Comment 1 Edouard Bourguignon 2011-07-25 13:08:04 UTC
MaxValue is a reserved word in mysql 5.5 cf http://dev.mysql.com/doc/refman/5.5/en/reserved-words.html

Comment 2 Edouard Bourguignon 2011-07-25 13:22:09 UTC
Have reported this bug upstream:
http://bugs.bacula.org/view.php?id=1753

Comment 3 Edouard Bourguignon 2011-07-25 15:04:04 UTC
Here is the patch found on the bacula mantis:

--- make_mysql_tables.orig	2010-02-15 16:05:14.000000000 +0200
+++ make_mysql_tables	2010-02-15 16:09:50.000000000 +0200
@@ -322,12 +322,12 @@
 
 
 
-CREATE TABLE Counters (
-   Counter TINYBLOB NOT NULL,
-   MinValue INTEGER DEFAULT 0,
-   MaxValue INTEGER DEFAULT 0,
-   CurrentValue INTEGER DEFAULT 0,
-   WrapCounter TINYBLOB NOT NULL,
+CREATE TABLE \`Counters\` (
+   \`Counter\` TINYBLOB NOT NULL,
+   \`MinValue\` INTEGER DEFAULT 0,
+   \`MaxValue\` INTEGER DEFAULT 0,
+   \`CurrentValue\` INTEGER DEFAULT 0,
+   \`WrapCounter\` TINYBLOB NOT NULL,
    PRIMARY KEY (Counter(128))
    );

I try and it works now. Can someone integrate it in a new release of bacula packages?

Comment 4 Honza Horak 2011-08-17 10:54:30 UTC
Created attachment 518652 [details]
proposed patch which adds quotes to MaxValue column

This patch adds quotes to all sql queries where MaxValue is used. I've tested it only in some use cases, so another tests are welcome.

Comment 5 Lukáš Nykrýn 2011-10-24 09:04:23 UTC
Created attachment 529756 [details]
Patch for MaxValue issue from upstream git

In bacula git they have solved it only for files in src/cats/. But they have used different type of quotation in .c files.

Comment 6 Lukáš Nykrýn 2011-11-03 13:23:35 UTC
Fix commited to git -> http://lists.fedoraproject.org/pipermail/scm-commits/2011-November/679426.html ->modified

Comment 7 Fedora Update System 2011-11-03 13:48:10 UTC
bacula-5.0.3-10.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/bacula-5.0.3-10.fc15

Comment 8 Fedora Update System 2011-11-04 20:26:15 UTC
Package bacula-5.0.3-10.fc15:
* should fix your issue,
* was pushed to the Fedora 15 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing bacula-5.0.3-10.fc15'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2011-15370
then log in and leave karma (feedback).

Comment 9 Fedora Update System 2012-01-02 08:56:35 UTC
bacula-5.0.3-16.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/bacula-5.0.3-16.fc15


Note You need to log in before you can comment on or make changes to this bug.