分类: MySQL
MySQL9.0最新版单库表数量超过10000时会触发crashing的Bug

数据量超过10000+的时候重启服务会触发,报错如下:

2024-07-12T00:08:33.773606Z 0 [System] [MY-015015] [Server] MySQL Server - start.
2024-07-12T00:08:34.118349Z 0 [Warning] [MY-011070] [Server] 'binlog_format' is deprecated and will be removed in a future release.
2024-07-12T00:08:34.118714Z 0 [System] [MY-010116] [Server] D:\ProgramFiles\mysql9\bin\mysqld (mysqld 9.0.0) starting as process 7760
2024-07-12T00:08:34.223215Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2024-07-12T00:08:35.018761Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2024-07-12T00:08:35.341833Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2024-07-12T00:08:35.342195Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2024-07-12T00:08:35.397166Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060
2024-07-12T00:08:35.397342Z 0 [System] [MY-010931] [Server] D:\ProgramFiles\mysql9\bin\mysqld: ready for connections. Version: '9.0.0'  socket: ''  port: 3306  MySQL Community Server - GPL.
2024-07-12T05:32:47.260632Z 0 [System] [MY-013105] [Server] D:\ProgramFiles\mysql9\bin\mysqld: Normal shutdown.
2024-07-12T05:32:49.275393Z 0 [Warning] [MY-010909] [Server] D:\ProgramFiles\mysql9\bin\mysqld: Forcing close of thread 12  user: 'root'.
2024-07-12T05:32:50.878096Z 0 [System] [MY-010910] [Server] D:\ProgramFiles\mysql9\bin\mysqld: Shutdown complete (mysqld 9.0.0)  MySQL Community Server - GPL.
2024-07-12T05:32:50.879005Z 0 [System] [MY-015016] [Server] MySQL Server - end.
2024-07-12T05:32:56.367227Z 0 [System] [MY-015015] [Server] MySQL Server - start.
2024-07-12T05:32:56.593909Z 0 [Warning] [MY-011070] [Server] 'binlog_format' is deprecated and will be removed in a future release.
2024-07-12T05:32:56.594131Z 0 [System] [MY-010116] [Server] D:\ProgramFiles\mysql9\bin\mysqld (mysqld 9.0.0) starting as process 6592
2024-07-12T05:32:56.607211Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2024-07-12T05:33:14.616120Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2024-07-12T05:33:15Z UTC - mysqld got exception 0xc0000005 ;
Most likely, you have hit a bug, but this error can also be caused by malfunctioning hardware.
Thread pointer: 0x0
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...
7ff64e32b6fe    mysqld.exe!Validate_files::check()[ha_innodb.cc:3536]
7ff64e31dde7    mysqld.exe!Detached_thread::operator()<std::function<void __cdecl(std::_Vector_const_iterator<std::_Vector_val<std::_Simple_types<dd::Tablespace const *> > > const &,std::_Vector_const_iterator<std::_Vector_val<std::_Simple_types<dd::Tablespace const *> > > const &,unsigned __int64)>,std::_Vector_const_iterator<std::_Vector_val<std::_Simple_types<dd::Tablespace const *> > >,std::_Vector_const_iterator<std::_Vector_val<std::_Simple_types<dd::Tablespace const *> > >,unsigned __int64>()[os0thread-create.h:193]
7ff64e31f53a    mysqld.exe!std::thread::_Invoke<std::tuple<Detached_thread,std::function<void __cdecl(std::_Vector_const_iterator<std::_Vector_val<std::_Simple_types<dd::Tablespace const *> > > const &,std::_Vector_const_iterator<std::_Vector_val<std::_Simple_types<dd::Tablespace const *> > > const &,unsigned __int64)>,std::_Vector_const_iterator<std::_Vector_val<std::_Simple_types<dd::Tablespace const *> > >,std::_Vector_const_iterator<std::_Vector_val<std::_Simple_types<dd::Tablespace const *> > >,unsigned __int64>,0,1,2,3,4>()[thread:61]
7ffa2fb09333    ucrtbase.dll!_recalloc()
7ffa30fe257d    KERNEL32.DLL!BaseThreadInitThunk()
7ffa3252af28    ntdll.dll!RtlUserThreadStart()
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.

浮现过程:
创建数据库,新建10000张以上的表,重启服务,就会crashing
下面使用python脚本创建:

import pymysql
conn = pymysql.connect(
            host='localhost',
            port=3306,
            user='root',
            password='youpassword',
            )

for i in range(10001):
    cursor = conn.cursor()
    cursor.execute(f'create table test.t20240712_{i}(id int, name varchar(200))')
    data = cursor.fetchall()
    conn.commit()

修改里面的脚本,直接运行即可。
影响版本:

MySQL 8.0.38
MySQL 8.4.1
MySQL 8.4.0
MySQL 9.0.0

不受影响版本:

MySQL 8.0.37
MySQL 5.7.44

其他版本暂未做测试。
VIA: https://www.percona.com/blog/do-not-upgrade-to-any-version-of-mysql-after-8-0-37/


相关博文:

发表新评论