blog-banner

The Specified Directory is Not A MyDumper Backup

  • BACKUP
  • MYDUMPER
  • MySql

This is one of the errors that annoyed me much at work lately. This happened when I had to restore a database from mydumper backup. If you are engaged in maintaining relatively big (in terms of data size) and dynamic database-driven sites, you would have probably heard about this mighty DB backup utility.

Mydumper as described by its Developers,
Mydumper (aka. MySQL Data Dumper) is a high-performance multi-threaded backup (and restore) toolset for MySQL and Drizzle. The main developers originally worked as Support Engineers at MySQL (one has moved to Facebook and another to SkySQL) and this is how they would envisage mysqldump based on years of user feedback.
 
Features
  • Lightweight C source
  • Up to 10x faster dumps compared to mysqldump
  • Consistent snapshots for transactional and non-transactional tables
  • File compression on-the-fly
  • Binary log dumps
  • Multi-threaded restore utility
  • Daemon mode for timed snapshots and continuous binary logs
Indeed!! as advertised it does offer a lot of benefits, especially in terms of speed in backup/ restoring and relatively simple to use.
 
There are a lot of blogs that elucidate the best usage of this utility and benchmark reports to ascertain and see where it stands among similar tools, see https://dom.as/2009/02/03/mydumper/ for instance. In this blog, I'm going to keep the content limited to errors that I encountered.
** (myloader:766): CRITICAL **: the specified directory is not a mydumper backup
This error was repeatedly noticed when I was trying to restore the database in the development server with mydumper export from the live server. I had no clues about where the error message was, and also failed to get any useful reference from Google search as well.
 
After pounding with this issue for a while, I lost patience and started exploring the mydumper code. Ran grep the command for the words in the error message "the specified directory" and found the lines that did the check-in reporting the error message. I have quoted the same below,
 
        } else {
char *p= g_strdup_printf("%s/metadata", directory);
if (!g_file_test(p, G_FILE_TEST_EXISTS)) {
g_critical("the specified directory is not a mydumper backup\n");
exit(EXIT_FAILURE);
}
}
 
It is noticed that the error was triggered due to lapse in locating meta-file named metadata, which is a hidden file in mydumper 0.2.3 (with dot prefixed), while in version 0.5.1, it is a standard plain text file. This little convention change in a different version of mydumper made me 'run in a circle' for a couple of hours. Changing the metadata file as needed solved the issue.
 
I'm sharing this issue in this blog as I see this could be a common issue to arise for anyone trying to achieve the same as I did. It is likely that different servers could use different distributions or the package manager could be outdated, etc. which might unknowingly motivate us to use different versions of the same utility. I hope this helps the readers and avoid a throw into confusion.