Bug #812 mysqlhotcopy fails to copy tables but does not indicate a failure
Submitted: 8 Jul 2003 12:54 Modified: 10 Jul 2003 7:14
Reporter: Lenz Grimmer Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version: OS:Linux (Linux)
Assigned to: Guilhem Bichot CPU Architecture:Any

[8 Jul 2003 12:54] Lenz Grimmer
Description:
mysqlhotbackup claims to have copied all tables, but the backup directory
remains empty. No error message or return code indicates a failure.

How to repeat:
[Taken from a customer message]

To repeat the bug, I recommend creating eg. 10,000 MyISAM tables in a
MySQL database and using mysqlhotcopy to back it up.

Here's how I did it:

---------------------------------------------------------------------
edit /etc/init.d/mysql to have "ulimit -n 400000" at top of script
# echo "500000" > /proc/sys/fs/file-max
# perl -e 'for ($i=1; $i<10000; $i++) { print "create table tab_$i (col varchar(255)) ;\n" }' > tmp.sql
# mysql -u root test
mysql> \. tmp.sql
# mysqlhotcopy -u root test /tmp
---------------------------------------------------------------------

The first two lines is so you won't run out of file descriptors (error
24). I repeated this bug with 4.0.12gamma, so it still happens as of
then. Here's the output.

<snip>
Copying 29997 files...
Copying indices for 0 files...
Unlocked tables.
mysqlhotcopy copied 9999 tables (29997 files) in 55 seconds (111 seconds
overall).
# ls -al /tmp/test/
total 2
drwxr-x---    2 root     root           48 Jun 30 16:15 ./
drwxrwxrwt   15 root     root          944 Jun 30 16:15 ../
#
[8 Jul 2003 13:14] Lenz Grimmer
I could reproduce this here - investigating.
[9 Jul 2003 5:41] Lenz Grimmer
OK, I've now fixed the script to properly abort when the copying of tables
was not successful - there was a typo in the script. This does not fix the
actual problem (tables have not been copied), but at least will now clearly 
indicate the failure instead of silently ignoring it. Fix will be included
in MySQL 4.0.14.

ChangeSet
  1.1509 03/07/08 23:29:55 lenz@mysql.com +1 -0
   - Fixed mysqlhotcopy to actually abort if copying the tables failed.
     (BUG#812)
[9 Jul 2003 14:45] Guilhem Bichot
I fixed it (after which I was able to make mysqlhotcopy work with 30000 files without problem) in my own source tree. I will clean my patch and submit it internally tomorrow.
[root@gbichot2 tmp]# ll /tmp/test | head
total 160080
-rw-rw----    1 guilhem  qq           8548 Jul  6 16:33 aa.frm
-rw-rw----    1 guilhem  qq              0 Jul  6 16:33 aa.MYD
-rw-rw----    1 guilhem  qq           1024 Jul  6 16:33 aa.MYI
-rw-rw----    1 guilhem  qq           8552 Jul  9 19:43 tab_1000.frm
-rw-rw----    1 guilhem  qq              0 Jul  9 19:43 tab_1000.MYD
-rw-rw----    1 guilhem  qq           1024 Jul  9 19:43 tab_1000.MYI
-rw-rw----    1 guilhem  qq           8552 Jul  9 19:43 tab_1001.frm
-rw-rw----    1 guilhem  qq              0 Jul  9 19:43 tab_1001.MYD
-rw-rw----    1 guilhem  qq           1024 Jul  9 19:43 tab_1001.MYI
[root@gbichot2 tmp]# ll /tmp/test | wc -l
  30013
[10 Jul 2003 7:14] Guilhem Bichot
Thank you for your bug report. This issue has been fixed in the latest
development tree for that product. You can find more information about
accessing our development trees at 
    http://www.mysql.com/doc/en/Installing_source_tree.html

fixed in changeset 1.1513. Patch sent to customer.