Bug #84529 Wrong error message (MEB restore)
Submitted: 17 Jan 2017 11:23 Modified: 26 Jan 2017 5:41
Reporter: Jörg Brühe (OCA) Email Updates:
Status: Not a Bug Impact on me:
Category:MySQL Enterprise Backup Severity:S3 (Non-critical)
Version:4.0.3 OS:Any
Assigned to: CPU Architecture:Any
Tags: message

[17 Jan 2017 11:23] Jörg Brühe
For test purposes and to see the symptom, I tried to restore a single-image backup without doing the "apply-log" step.

I got a totally misleading message:
    Could not load contents of directory '<<backup-dir value>>'

That directory was perfectly ok, empty.

Changing the command from "copy-back" to "copy-back-and-apply-log" got me rid of the message.

How to repeat:
1) Do a backup using the "backup-to-image" command.

2) Try a restore using the "copy-back" command,
   it will fail with the message quoted above.

Suggested fix:
Generate an error message that points the user at the missing 'apply-log' step.

At the very least, add an "error messages" section to the documentation which lists the messages and the possible causes. For the ordinary user, there is no connection between "apply-log is missing" and the contents or readability of the "backup-dir" directory.

Currently, the only section for this is headed "Error codes of MySQL Enterprise Backup", and all it contains is this single sentence:
    The return code of the MySQL Enterprise Backup (mysqlbackup) process
    is 0 if the backup or restore run succeeds.
    If the run fails for any reason, the return code is 1.

First: It mixes "error code" and "return code" which are different things.

Second: Return code 0 for "ok", non-zero for any failure is so basic that this sentence doesn't contain any information for anybody but a most basic novice.

Third: In a section with that heading, I expect to see the most frequent error codes (or messages, as there was no code number or symbol) with the (assumed) typical causes.
[19 Jan 2017 12:49] MySQL Verification Team
Hello Jörg Brühe,

Thank you for the report and feedback.
Could you please provide exact commands used to trigger this issue? In my tests I'm seeing relatively different error with the steps from how to.

 mysqlbackup: ERROR: Can not perform copy-back operation using raw backup snapshot.
      The backup_variables.txt meta file of the backup indicates that
      the apply-log operation has not been performed yet.
      Please run apply-log operation first before copy-back.

[25 Jan 2017 15:09] Jörg Brühe
I stand corrected:
In the call that generated the misleading error message, I had also given the wrong value of "--backup-dir".
I had copied too much of the "backup-to-image" call, included the "--backup-dir" option, without paying attention to its totally different meaning in a restore call.
With a correct value for "--backup-dir", I also get the correct error message.

IMNSHO it is a bad interface design to use the same option with two totally different meanings:
- On backup, it is the root of the tree holding the backup images.
- On restore, it is a directory for temporary files.
But it is probably too late to fix that.

Returning to this bug report: My fault, sorry.
Please close it as "Not a bug", that status is not offered to me.
[26 Jan 2017 5:41] MySQL Verification Team
Thank you Jörg Brühe for confirming.
Closing as !bg.