The Samba-Bugzilla – Bug 9995
Rsync 3.1.0 mysql db code needs fixing
Last modified: 2013-07-12 21:46:07 UTC
Sorry, I am french , my english is not very fluent.
Just a word, i wish to thank Wayne Davison for his work.
I 'm testing Rsync 3.1, with the db.diff Patch, especially the checksum feature.
The build has no troubles.
But, to initialize the tables in the Mysql Database, i have found an error :
dvu@alix:~/LADHYX/Dev/Rsync/Git/rsync> /opt/Rsync/bin/rsyncdb --db=/opt/Rsync/dbconfig --init --mounts
Creating DB rsync (if it does not exist)
Dropping old tables (if they exist))
Creating empty tables ...
[rsyncdb] Prepare failed: Table 'rsync.disk' doesn't exist
INSERT INTO disk SET host = ?, last_seen = ?, mount_uniq = ?, devno = ? ON DUPLICATE KEY UPDATE last_seen = VALUES(last_seen), devno = VALUES(devno)
Marking mount "Mount of /dev/sda4" (2052) as recently seen
Erreur de segmentation
The Mysql query in db.c file do not work.
CREATE TABLE disk (
disk_id integer unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
host varchar(256) NOT NULL default 'localhost',
mount_uniq varchar(256) default NULL,
devno bigint unsigned NOT NULL,
last_seen bigint NOT NULL,
UNIQUE KEY mount_lookup (host, mount_uniq),
KEY dev_lookup (devno, host)
I have tested it inside Mysql :
MariaDB [rsync]> CREATE TABLE disk (disk_id integer unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
-> host varchar(256) NOT NULL default 'localhost',
-> mount_uniq varchar(256) default NULL,
-> devno bigint unsigned NOT NULL,
-> last_seen bigint NOT NULL,
-> UNIQUE KEY mount_lookup (host, mount_uniq),
-> KEY dev_lookup (devno, host)
ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes
I dont know if it's a Mysql's bug.
The db code is in active development at the moment, so the issue you saw with prepare being called prior to the table creation was found and fixed a little while back. I have been doing a lot of testing on the sqlite side, so I hadn't tested the mysql side recently and it had a couple other issues that had crept into the code. I just corrected these in my just-committed patch. With those changes I did some simple init/mounts/update/clean testing and it worked well.
I don't know why you're seeing an index issue with your manual table creation. The table that rsync creates works fine for me. I'm using mysql 5.5, though -- dunno if that makes a difference. Give the auto-creation a try, and if you still have issues, you might try lowering the 256 values a little to get it to fit (and tweak the code to match).
Thanks for testing, and let me know if you run into further issues.
FYI, the latest patch also narrows the fields from 256 to 128 chars, which should be plenty.