Bug #95235 ABRT:Can't generate a unique log-filename binlog.(1-999), while rotating the bin
Submitted: 3 May 2019 5:41 Modified: 3 May 2019 11:35
Reporter: Daniel Black Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Replication Severity:S2 (Serious)
Version:8.0.16 OS:Fedora (fc30)
Assigned to: CPU Architecture:x86

[3 May 2019 5:41] Daniel Black
Description:
Abort is triggered in the MTR suite on the binlog.binlog_restart_server_with_exhausted_index_value

$ g++ --version
g++ (GCC) 9.0.1 20190312 (Red Hat 9.0.1-0.10)

gcc (GCC) 9.0.1 20190312 (Red Hat 9.0.1-0.10)

I suspect this is one of the many gcc-8+ bugs that shows up with function  (strncmp? in find_uniq_filename) having attributes having notnull on arguments, resulting in unintended optimizations.

Second Bug: the MTR test is passed even though mysqld aborted.

How to repeat:
mysql-test/mtr --mem binlog.binlog_restart_server_with_exhausted_index_value --gdb

(on second started mysqld)

2019-05-03T05:25:49.764106Z 4 [Note] [MY-010051] [Server] Event Scheduler: scheduler thread started with id 4
[New Thread 0x7fffccff9700 (LWP 30142)]
2019-05-03T05:25:49.765092Z 0 [System] [MY-010931] [Server] /home/dan/repos/build-mysql-8.0/runtime_output_directory/mysqld: ready for connections. Version: '8.0.16'  socket: '/home/dan/repos/build-mysql-8.0/mysql-test/var/tmp/mysqld.1.sock'  port: 13000  Source distribution.
[New Thread 0x7fffec072700 (LWP 30143)]
2019-05-03T05:25:49.966012Z 0 [Note] [MY-011240] [Server] Plugin mysqlx reported: 'Using SSL configuration from MySQL Server'
2019-05-03T05:25:49.968558Z 0 [Note] [MY-011243] [Server] Plugin mysqlx reported: 'Using OpenSSL for TLS connections'
2019-05-03T05:25:49.968716Z 0 [Note] [MY-011332] [Server] Plugin mysqlx reported: 'IPv6 is available'
2019-05-03T05:25:49.969167Z 0 [Note] [MY-011323] [Server] Plugin mysqlx reported: 'X Plugin ready for connections. bind-address: '::' port: 13010'
2019-05-03T05:25:49.969251Z 0 [Note] [MY-011323] [Server] Plugin mysqlx reported: 'X Plugin ready for connections. socket: '/home/dan/repos/build-mysql-8.0/mysql-test/var/tmp/mysqlx.1.sock''
2019-05-03T05:25:49.969328Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/home/dan/repos/build-mysql-8.0/mysql-test/var/tmp/mysqlx.1.sock' bind-address: '::' port: 13010
[New Thread 0x7fffd4529700 (LWP 30144)]
2019-05-03T05:25:50.086508Z 7 [ERROR] [MY-010813] [Server] Log filename extension number exhausted: 2147483647. Please fix this by archiving old logs and updating the index files.
2019-05-03T05:25:50.086591Z 7 [ERROR] [MY-010905] [Server] Can't generate a unique log-filename binlog.(1-999).
2019-05-03T05:25:50.086637Z 7 [ERROR] [MY-011072] [Server] Binary logging not possible. Message: Can't generate a unique log-filename binlog.(1-999), while rotating the binlog. Aborting the server.

Thread 42 "mysqld" received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffec072700 (LWP 30143)]
0x00007ffff76b4eb5 in raise () from /lib64/libc.so.6
(gdb) bt
#0  0x00007ffff76b4eb5 in raise () from /lib64/libc.so.6
#1  0x00007ffff769f895 in abort () from /lib64/libc.so.6
#2  0x0000000000c4f121 in exec_binlog_error_action_abort (err_string=0x7fffec06f5c0 "Can't generate a unique log-filename binlog.(1-999), while rotating the binlog. Aborting the server")
    at /home/dan/repos/mysql-server/sql/binlog.cc:2169
#3  0x0000000001b73eb0 in MYSQL_BIN_LOG::new_file_impl (this=0x39818a0 <mysql_bin_log>, need_lock_log=<optimized out>, extra_description_event=<optimized out>) at /home/dan/repos/mysql-server/sql/binlog.cc:6556
#4  0x0000000001b74a55 in MYSQL_BIN_LOG::rotate (force_rotate=<optimized out>, check_purge=0x7fffec06fa5f, this=<optimized out>) at /home/dan/repos/mysql-server/sql/binlog.cc:6992
#5  MYSQL_BIN_LOG::rotate (this=<optimized out>, force_rotate=<optimized out>, check_purge=0x7fffec06fa5f) at /home/dan/repos/mysql-server/sql/binlog.cc:6980
#6  0x0000000001b80e67 in MYSQL_BIN_LOG::rotate_and_purge (this=0x39818a0 <mysql_bin_log>, thd=thd@entry=0x7fff94000ed0, force_rotate=force_rotate@entry=true) at /home/dan/repos/mysql-server/sql/binlog.cc:7065
#7  0x0000000000e18b9f in handle_reload_request (thd=thd@entry=0x7fff94000ed0, options=1024, tables=tables@entry=0x0, write_to_binlog=write_to_binlog@entry=0x7fffec070180)
    at /home/dan/repos/mysql-server/sql/sql_reload.cc:170
#8  0x0000000000de3dda in mysql_execute_command (thd=0x7fff94000ed0, first_level=<optimized out>) at /home/dan/repos/mysql-server/sql/sql_parse.cc:3894
#9  0x0000000000de826b in mysql_parse (thd=thd@entry=0x7fff94000ed0, parser_state=parser_state@entry=0x7fffec0715d0) at /home/dan/repos/mysql-server/sql/sql_parse.cc:5194
#10 0x0000000000deb2c3 in dispatch_command (thd=0x7fff94000ed0, com_data=<optimized out>, command=COM_QUERY) at /home/dan/repos/mysql-server/sql/sql_parse.cc:1746
#11 0x0000000000debdac in do_command (thd=thd@entry=0x7fff94000ed0) at /home/dan/repos/mysql-server/sql/sql_parse.cc:1264
#12 0x0000000000ef6468 in handle_connection (arg=arg@entry=0x4031880) at /home/dan/repos/mysql-server/sql/conn_handler/connection_handler_per_thread.cc:302
#13 0x0000000002362dbe in pfs_spawn_thread (arg=0x3cf3780) at /home/dan/repos/mysql-server/storage/perfschema/pfs.cc:2836
#14 0x00007ffff7f785a2 in start_thread () from /lib64/libpthread.so.0
#15 0x00007ffff7778023 in clone () from /lib64/libc.so.6

...

[ 33%] binlog.binlog_restart_server_with_exhausted_index_value 'mix'  [ skipped ]  Doesn't support --binlog-format = 'mixed'
[ 66%] binlog.binlog_restart_server_with_exhausted_index_value 'row'  [ pass ]  10943
[100%] binlog.binlog_restart_server_with_exhausted_index_value 'stmt'  [ skipped ]  Doesn't support --binlog-format = 'statement'
[3 May 2019 11:35] MySQL Verification Team
Thanks for your report, verified as described.

Thanks
Bogdan