Bug #79290 5.6 crashes on a 5.7 datadir
Submitted: 16 Nov 2015 8:56 Modified: 3 Feb 2016 16:22
Reporter: Daniël van Eeden (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Logging Severity:S3 (Non-critical)
Version:5.6.27, 5.6.29 OS:Any
Assigned to: CPU Architecture:Any
Tags: downgrade

[16 Nov 2015 8:56] Daniël van Eeden
Description:
When starting 5.6.27 on a 5.7.9 datadir:

07:40:48 UTC - mysqld got signal 11 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed, 
something is definitely wrong and this may fail.

key_buffer_size=805306368
read_buffer_size=131072
max_used_connections=0
max_threads=3000
thread_count=0
connection_count=0
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 4280822 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x7ffcbf02acd0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 7ffcbf02e000 thread_stack 0x40000
/usr/sbin/mysqld(my_print_stacktrace+0x35)[0x8ddb85]
/usr/sbin/mysqld(handle_fatal_signal+0x494)[0x665b44]
/lib64/libpthread.so.0(+0xf790)[0x7f9a9d37b790]
/usr/sbin/mysqld(_Z18ha_resolve_by_nameP3THDPK19st_mysql_lex_stringb+0xb1)[0x5aae41]
/usr/sbin/mysqld(_Z14open_table_defP3THDP11TABLE_SHAREj+0x1897)[0x775867]
/usr/sbin/mysqld(_Z15get_table_shareP3THDP10TABLE_LISTPKcjjPij+0x1b2)[0x6952e2]
/usr/sbin/mysqld(_Z10open_tableP3THDP10TABLE_LISTP18Open_table_context+0x729)[0x69e0d9]
/usr/sbin/mysqld(_Z11open_tablesP3THDPP10TABLE_LISTPjjP19Prelocking_strategy+0xc9f)[0x6a041f]
/usr/sbin/mysqld(_Z20open_and_lock_tablesP3THDP10TABLE_LISTbjP19Prelocking_strategy+0x44)[0x6a05f4]
/usr/sbin/mysqld[0x6f01eb]
/usr/sbin/mysqld(_Z11plugin_initPiPPci+0xb2d)[0x6f2d5d]
/usr/sbin/mysqld[0x59c008]
/usr/sbin/mysqld(_Z11mysqld_mainiPPc+0x425)[0x5a1085]
/lib64/libc.so.6(__libc_start_main+0xfd)[0x7f9a9be07d5d]
/usr/sbin/mysqld[0x592f65]

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0): is an invalid pointer
Connection ID (thread ID): 0
Status: NOT_KILLED

The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.

This is not a supported downgrade as described in:
https://dev.mysql.com/doc/refman/5.7/en/downgrading.html

So I don't expect this to work, but I also don't expect it to crash.

How to repeat:
Start 5.6.27 on a 5.7.9 datadir

Suggested fix:
Detect that mysql.* is from a different major version (too new or too old) and do an automatic upgrade/downgrade or just return a clear error (e.g. "MySQL 5.7 datadir detected, this is a upsupported downgrade, see https://....)
[16 Nov 2015 8:58] Daniël van Eeden
Related:
Bug #72187 	Crash with 5.5 datadir
[16 Nov 2015 9:04] Daniël van Eeden
This happens because mysql.* of 5.7 is not downwards compatible.

When running with --skip-grant-tables this happens:
2015-11-16 08:42:14 38657 [Note] InnoDB: Highest supported file format is Barracuda.
InnoDB: No valid checkpoint found.
InnoDB: If this error appears when you are creating an InnoDB database,
InnoDB: the problem may be that during an earlier attempt you managed
InnoDB: to create the InnoDB data files, but log file creation failed.
InnoDB: If that is the case, please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.6/en/error-creating-innodb.html
2015-11-16 08:42:14 38657 [ERROR] Plugin 'InnoDB' init function returned error.
2015-11-16 08:42:14 38657 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2015-11-16 08:42:14 38657 [ERROR] Unknown/unsupported storage engine: InnoDB
2015-11-16 08:42:14 38657 [ERROR] Aborting

This is because the new logfile format for InnoDB.
[16 Nov 2015 10:23] MySQL Verification Team
Hello Daniël,

Thank you for the report.
Observed this when starting 5.6.29 with 5.7.11 datadir.

Thanks,
Umesh
[16 Nov 2015 10:23] MySQL Verification Team
// 5.6.29

(gdb) bt
#0  0x00007f44c876c771 in pthread_kill () from /lib64/libpthread.so.0
#1  0x00000000006a4f3a in handle_fatal_signal (sig=11) at /export/home/pb2/build/sb_0-17052149-1447421659.07/mysqlcom-pro-5.6.29/sql/signal_handler.cc:230
#2  <signal handler called>
#3  0x00000000005c0c10 in ha_resolve_by_name (thd=0x7ffe0a2da0e0, name=0x7ffe0a2d9a60, is_temp_table=false)
    at /export/home/pb2/build/sb_0-17052149-1447421659.07/mysqlcom-pro-5.6.29/sql/handler.cc:340
#4  0x00000000007c12a3 in open_binary_frm (file=<optimized out>, head=<optimized out>, share=<optimized out>, thd=<optimized out>)
    at /export/home/pb2/build/sb_0-17052149-1447421659.07/mysqlcom-pro-5.6.29/sql/table.cc:1262
#5  open_table_def (thd=0x7ffe0a2da0e0, share=0x18f08b0, db_flags=8192) at /export/home/pb2/build/sb_0-17052149-1447421659.07/mysqlcom-pro-5.6.29/sql/table.cc:746
#6  0x00000000006d4649 in get_table_share (thd=0x7ffe0a2da0e0, table_list=0x7ffe0a2dd410, key=<optimized out>, key_length=13, db_flags=8192, error=0x7ffe0a2d9ec8, hash_value=1324052888)
    at /export/home/pb2/build/sb_0-17052149-1447421659.07/mysqlcom-pro-5.6.29/sql/sql_base.cc:508
#7  0x00000000006d6b1c in get_table_share_with_discover (thd=0x148c860 <LOCK_plugin>, table_list=0x0, key=0x18ed108 "\240", <incomplete sequence \323>, key_length=66, db_flags=0, error=0xffff,
    hash_value=1324052888) at /export/home/pb2/build/sb_0-17052149-1447421659.07/mysqlcom-pro-5.6.29/sql/sql_base.cc:587
#8  0x00000000006de466 in open_table (thd=0x7ffe0a2da0e0, table_list=0x7ffe0a2dd410, ot_ctx=0x7ffe0a2d9f60)
    at /export/home/pb2/build/sb_0-17052149-1447421659.07/mysqlcom-pro-5.6.29/sql/sql_base.cc:3038
#9  0x00000000006e062c in open_and_process_table (ot_ctx=<optimized out>, has_prelocking_list=<optimized out>, prelocking_strategy=<optimized out>, flags=<optimized out>,
    counter=<optimized out>, tables=<optimized out>, lex=0x7ffe0a2dbe88, thd=<optimized out>) at /export/home/pb2/build/sb_0-17052149-1447421659.07/mysqlcom-pro-5.6.29/sql/sql_base.cc:4736
#10 open_tables (thd=0x7ffe0a2da0e0, start=0x7ffe0a2da018, counter=0x7ffe0a2da03c, flags=2048, prelocking_strategy=0x7ffe0a2ddc80)
    at /export/home/pb2/build/sb_0-17052149-1447421659.07/mysqlcom-pro-5.6.29/sql/sql_base.cc:5169
#11 0x00000000006e088e in open_and_lock_tables (thd=0x148c860 <LOCK_plugin>, tables=0x7ffe0a2dd410, derived=false, flags=66, prelocking_strategy=0x0)
    at /export/home/pb2/build/sb_0-17052149-1447421659.07/mysqlcom-pro-5.6.29/sql/sql_base.cc:5813
#12 0x00000000007355a5 in plugin_init (argc=0x1485814 <remaining_argc>, argv=0x1806c70, flags=<optimized out>)
    at /export/home/pb2/build/sb_0-17052149-1447421659.07/mysqlcom-pro-5.6.29/sql/sql_base.h:472
#13 0x00000000005b5e90 in init_server_components () at /export/home/pb2/build/sb_0-17052149-1447421659.07/mysqlcom-pro-5.6.29/sql/mysqld.cc:4850
#14 0x00000000005b6d05 in mysqld_main (argc=8, argv=0x1806c70) at /export/home/pb2/build/sb_0-17052149-1447421659.07/mysqlcom-pro-5.6.29/sql/mysqld.cc:5447
#15 0x00007f44c735eaf5 in __libc_start_main () from /lib64/libc.so.6
#16 0x00000000005aa9b9 in _start ()
(gdb)
[3 Feb 2016 16:22] Paul DuBois
Noted in 5.6.30 changelog.

A MySQL 5.6 server exited during startup if used with a 5.7 data
directory due to the change in 5.7 of the mysql.plugin table from
MyISAM to InnoDB. A safe shutdown now occurs in this circumstance.