PDA

View Full Version : Backup Module Issues when Restoring


Peter Olivia
02-07-05, 03:31 PM
I recently had to rebuild my Fedore Core 3 server and used the 2.x backup module from CVS. I had saved a backup to xml (as well as sql just in case) for restoring my DB once I finished rebuilding. Everything seemed to go just fine at the time of restore via xml. Over time I have found at least 2 probs that I was able to fix manually but I just wanted to see if it is a bug or an end user mess up.

By comparing sql to xml, I noticed the following:

1) All the sql INSERTs into sysvals for column sysval_value that had a \n got messed up. Values were missing due to the \n. If I recall correctly, the last entry in each cloumn was what was in the DB. The xml had each entry on a new line.

2) All the CREATE tables with float NOT NULL DEFAULT '0' became decimal (10,0). This essentially truncated all decimal portions of the restores INSERT entries. The xml for these entries had type="N".

Header section of the SQL and xml backups are identical to current settings: Orig:
# OS: Linux
# PHP version: 4.3.11
# MySQL version: 3.23.58
<?xml version="1.0"?>
<schema version="0.2">

Latest backup:
# OS: Linux
# PHP version: 4.3.11
# MySQL version: 3.23.58
<?xml version="1.0"?>
<schema version="0.2">

I also did a diff between my original backup module dir and the one I just installed and I could not find differences. Diff spit out that there were diffs, but an sdiff did not show code changes (just dos2unix issues)

I'll let the pros figure it out. BTW, thanks for this killer app.

Peter Olivia
05-07-05, 07:32 AM
Upon further review, it seems all the task log entries with a \n we truncated as well. I decided to just use the SQL backups to do the restore. I found issues there as well. It seems that almost every CREATE TABLE entry in the sql backup that has a PRIMARY KEY entry has a missing comma on the line previous to it. For example:

CREATE TABLE `billingcode` (
`billingcode_id` bigint(20) NOT NULL auto_increment,
`billingcode_name` varchar(25) NOT NULL,
`billingcode_value` float NOT NULL DEFAULT '0',
`billingcode_desc` varchar(255) NOT NULL,
`billingcode_status` int(1) NOT NULL DEFAULT '0',
`company_id` bigint(20) NOT NULL DEFAULT '0'
PRIMARY KEY ( `billingcode_id` )
);

should be:

CREATE TABLE `billingcode` (
`billingcode_id` bigint(20) NOT NULL auto_increment,
`billingcode_name` varchar(25) NOT NULL,
`billingcode_value` float NOT NULL DEFAULT '0',
`billingcode_desc` varchar(255) NOT NULL,
`billingcode_status` int(1) NOT NULL DEFAULT '0',
`company_id` bigint(20) NOT NULL DEFAULT '0',
PRIMARY KEY ( `billingcode_id` )
);

Seems like it might just be a simple code fix as it was only happening to the lines prior to the PRIMARY KEY line. The weird part is that a few correctly had the comma on the prvious line. Once I added the commas, the SQL worked like a charm.

Anyway, I hope this helps improve the project or help others in a similar situation. It has been an awesome tool so far.