Bug #36854 Backup: error message truncated.
Submitted: 21 May 2008 15:45 Modified: 30 Oct 2008 19:44
Reporter: Rafal Somla Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Backup Severity:S3 (Non-critical)
Version:6.0-backup OS:Any
Assigned to: Jørgen Løland CPU Architecture:Any

[21 May 2008 15:45] Rafal Somla
Description:
Sometimes RESTORE can report such error:

mysql> RESTORE FROM '1';
ERROR 1714 (HY000): Tablespace `a` needed by tables being restored has changed on the
server. The original definition of the required tablespace is 'CREATE TABLESPACE `a` ADD
DATAFILE 'x' ENGINE=FALCON' while the same tablespace is defined on the server as 'CREATE
TABLESPACE `a` ADD DATAFILE 'y

One can see that the message is not complete - it is truncated probably because of a limit of the length of a single error message.

Also, formulation "tablespace has changed" is not entirely correct because we can restore on a different server than the one on which we did backup.

How to repeat:
Here is how the above error can be triggered.

mysql> CREATE DATABASE d1;
Query OK, 1 row affected (0.00 sec)

mysql> CREATE DATABASE d2;
Query OK, 1 row affected (0.00 sec)

mysql> CREATE TABLESPACE a ADD DATAFILE 'x' ENGINE=FALCON;
Query OK, 0 rows affected (0.22 sec)

mysql> CREATE TABLE d1.t (s1 INT) ENGINE=FALCON TABLESPACE a;
Query OK, 0 rows affected (0.06 sec)

mysql> BACKUP DATABASE d1 TO '1';
+-----------+
| backup_id |
+-----------+
| 1         | 
+-----------+
1 row in set (0.07 sec)

mysql> SHOW WARNINGS;
Empty set (0.00 sec)

mysql> DROP TABLE d1.t;
Query OK, 0 rows affected (0.00 sec)

mysql> DROP TABLESPACE a ENGINE=FALCON;
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE TABLESPACE a ADD DATAFILE 'y' ENGINE=FALCON;
Query OK, 0 rows affected (0.26 sec)

mysql> CREATE TABLE d1.t (s1 CHAR) ENGINE=FALCON TABLESPACE a;
Query OK, 0 rows affected (0.06 sec)

mysql> CREATE TABLE d2.t (s1 INT) ENGINE=FALCON TABLESPACE a;
Query OK, 0 rows affected (0.07 sec)

mysql> RESTORE FROM '1';
ERROR 1714 (HY000): Tablespace `a` needed by tables being restored has changed on the
server. The original definition of the required tablespace is 'CREATE TABLESPACE `a` ADD
DATAFILE 'x' ENGINE=FALCON' while the same tablespace is defined on the server as 'CREATE
TABLESPACE `a` ADD DATAFILE 'y

Suggested fix:
Increase the error message length limit or reformulate the message so that it is shorter (perhaps split it into several).
[6 Oct 2008 11:26] Jørgen Løland
The error message is truncated because some of the many char[] the error message is stored in are too small. 

This particular error message (including the two create statements) is 291 chars long. At different parts of the code, however, the message is stored in varying size char[]:

@ sql/backup/kernel.cc#send_error: char buf[ERRMSGSIZE + 20]
@ sql/backup/logger.cc#write_message: char buf[ERRMSGSIZE + 30];
@ mysys/my_error.c#my_printf_error: char ebuff[ERRMSGSIZE+20];

ERRMSGSIZE is 256 (defined in my_global.h), so all of these are too small. There is also another constant for error message size, MYSQL_ERRMSG_SIZE, that is 512 (defined in mysql_com.h). 

Changing ERRMSGSIZE to 512 solves the problem, but not sure if there are other intolerable consequences yet.
[8 Oct 2008 11:32] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/55725

2702 Jorgen Loland	2008-10-08
      Bug#36854 - Backup: error message truncated.
      
      Patch changes the text of the very long error message for ER_BACKUP_TS_CHANGE
[13 Oct 2008 12:37] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/56118

2707 Jorgen Loland	2008-10-13
      Bug#36854 - Backup: error message truncated.
            
      * Changes the text of the very long error message for ER_BACKUP_TS_CHANGE. 
      * Removes si_object#describe_tablespace, which is no longer in use
[14 Oct 2008 12:38] Øystein Grøvlen
Good to push.
[14 Oct 2008 17:33] Rafal Somla
Good to push.
[30 Oct 2008 12:45] Bugs System
Pushed into 6.0.8-alpha  (revid:jorgen.loland@sun.com-20081013123710-k4t1xsx4l5691ind) (version source revid:jorgen.loland@sun.com-20081013123710-k4t1xsx4l5691ind) (pib:5)
[30 Oct 2008 19:44] Paul DuBois
Noted in 6.0.8 changelog.

Long error messages for RESTORE could be truncated.