查询多个条件时mysql崩溃

时间:2017-09-02 15:31:05

标签: mysql windows msvcrt

当我查询两个条件时,mysql崩溃,两列有索引。 可以查询每个条件。

mysql版本:mysql-5.7.19-winx64

操作系统:Windows 7旗舰版

有人可以为这个版本提供一些建议吗?

PS:有可能用my.ini解决问题吗?

表:

mysql> create table firsttable(
->   id varchar(64),
->   name varchar(64),
->   flag char(1),
->   primary key (id),
->   key key_name (name),
->   key key_flag (flag)
->  );

插入数据:

mysql> insert into firsttable values(uuid(), 'test', '0');
Query OK, 1 row affected (0.10 sec)
mysql> insert into firsttable values(uuid(), 'test1', '0');
Query OK, 1 row affected (0.10 sec)

查询:

mysql> select * from firsttable where name ='test';
+--------------------------------------+------+------+
| id                                   | name | flag |
+--------------------------------------+------+------+
| d72bfd53-8fd6-11e7-baee-54ee7597a644 | test | 0    |
+--------------------------------------+------+------+
1 row in set (0.00 sec)

mysql> select * from firsttable where name ='test' and flag='0';
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql>

错误日志:



2017-09-03T05:07:46.275435Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-09-03T05:07:46.275435Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2017-09-03T05:07:46.275435Z 0 [Note] MySQL (mysqld 5.7.19) starting as process 8964 ...
2017-09-03T05:07:46.283435Z 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2017-09-03T05:07:46.284435Z 0 [Note] InnoDB: Uses event mutexes
2017-09-03T05:07:46.285436Z 0 [Note] InnoDB: _mm_lfence() and _mm_sfence() are used for memory barrier
2017-09-03T05:07:46.285436Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-09-03T05:07:46.286436Z 0 [Note] InnoDB: Number of pools: 1
2017-09-03T05:07:46.287436Z 0 [Note] InnoDB: Not using CPU crc32 instructions
2017-09-03T05:07:46.290436Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2017-09-03T05:07:46.298436Z 0 [Note] InnoDB: Completed initialization of buffer pool
2017-09-03T05:07:46.448445Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2017-09-03T05:07:46.472446Z 0 [Note] InnoDB: Log scan progressed past the checkpoint lsn 2568065
2017-09-03T05:07:46.473446Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 2568074
2017-09-03T05:07:46.475446Z 0 [Note] InnoDB: Database was not shutdown normally!
2017-09-03T05:07:46.476446Z 0 [Note] InnoDB: Starting crash recovery.
2017-09-03T05:07:46.758463Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2017-09-03T05:07:46.760463Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2017-09-03T05:07:46.761463Z 0 [Note] InnoDB: Setting file '.\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2017-09-03T05:07:46.939473Z 0 [Note] InnoDB: File '.\ibtmp1' size is now 12 MB.
2017-09-03T05:07:46.946473Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2017-09-03T05:07:46.950474Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2017-09-03T05:07:46.954474Z 0 [Note] InnoDB: Waiting for purge to start
2017-09-03T05:07:47.012477Z 0 [Note] InnoDB: 5.7.19 started; log sequence number 2568074
2017-09-03T05:07:47.014477Z 0 [Note] InnoDB: Loading buffer pool(s) from D:\Program Files\mysql-5.7.19-winx64\data\ib_buffer_pool
2017-09-03T05:07:47.014477Z 0 [Note] Plugin 'FEDERATED' is disabled.
2017-09-03T05:07:47.049479Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2017-09-03T05:07:47.052479Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2017-09-03T05:07:47.057480Z 0 [Note] IPv6 is available.
2017-09-03T05:07:47.058480Z 0 [Note]   - '::' resolves to '::';
2017-09-03T05:07:47.059480Z 0 [Note] Server socket created on IP: '::'.
2017-09-03T05:07:47.322495Z 0 [Note] Event Scheduler: Loaded 0 events
2017-09-03T05:07:47.323495Z 0 [Note] MySQL: ready for connections.
Version: '5.7.19'  socket: ''  port: 3306  MySQL Community Server (GPL)
2017-09-03T05:07:47.325495Z 0 [Note] Executing 'SELECT * FROM INFORMATION_SCHEMA.TABLES;' to get a list of tables using the deprecated partition engine. You may use the startup option '--disable-partition-engine-check' to skip this check. 
2017-09-03T05:07:47.327495Z 0 [Note] Beginning of list of non-natively partitioned tables
2017-09-03T05:07:47.356497Z 0 [Note] End of list of non-natively partitioned tables
2017-09-03T05:07:47.365497Z 0 [Note] InnoDB: Buffer pool(s) load completed at 170903 13:07:47
05:08:53 UTC - mysqld got exception 0xc000001d ;
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.
Attempting to collect some information that could help diagnose the problem.
As this is a crash and something is definitely wrong, the information
collection process might fail.

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

Thread pointer: 0x135e5400
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...
7fef78e5c01    MSVCR120.dll!pow()
13f5e5f7a    mysqld.exe!get_sweep_read_cost()[handler.cc:7199]
13fba7b37    mysqld.exe!ror_intersect_add()[opt_range.cc:5461]
13fb9da89    mysqld.exe!get_best_ror_intersect()[opt_range.cc:5642]
13fba9e25    mysqld.exe!test_quick_select()[opt_range.cc:3108]
13f756a3e    mysqld.exe!get_quick_record_count()[sql_optimizer.cc:5948]
13f75549d    mysqld.exe!JOIN::estimate_rowcount()[sql_optimizer.cc:5694]
13f758209    mysqld.exe!JOIN::make_join_plan()[sql_optimizer.cc:5051]
13f759d7b    mysqld.exe!JOIN::optimize()[sql_optimizer.cc:368]
13f7a2149    mysqld.exe!st_select_lex::optimize()[sql_select.cc:1009]
13f7a016d    mysqld.exe!handle_query()[sql_select.cc:164]
13f613f17    mysqld.exe!execute_sqlcom_select()[sql_parse.cc:5158]
13f615e46    mysqld.exe!mysql_execute_command()[sql_parse.cc:2795]
13f6198a3    mysqld.exe!mysql_parse()[sql_parse.cc:5580]
13f612953    mysqld.exe!dispatch_command()[sql_parse.cc:1464]
13f61398a    mysqld.exe!do_command()[sql_parse.cc:1001]
13f5ba4dc    mysqld.exe!handle_connection()[connection_handler_per_thread.cc:300]
1400143a2    mysqld.exe!pfs_spawn_thread()[pfs.cc:2191]
13fd2743c    mysqld.exe!win_thread_start()[my_thread.c:38]
7fef7874f7f    MSVCR120.dll!_beginthreadex()
7fef7875126    MSVCR120.dll!_endthreadex()
7729f56d    kernel32.dll!BaseThreadInitThunk()
774d3281    ntdll.dll!RtlUserThreadStart()

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (135700a0): select * from firsttable where name ='test' and flag='0'
Connection ID (thread ID): 3
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.




3 个答案:

答案 0 :(得分:1)

我尝试重现错误,我没有收到错误,让我把它放下:

mysql> create table firsttable
    -> (
    ->  id varchar(64),
    ->  name varchar(64),
    ->  flag char(1),
    ->  primary key(id),
    ->  key key_name (name),
    ->  key key_flag (flag)
    -> );
Query OK, 0 rows affected (1.12 sec)

mysql> insert into firsttable values(uuid(), 'test', '0');
Query OK, 1 row affected (0.20 sec)

mysql> insert into firsttable values(uuid(), 'test1', '0');
Query OK, 1 row affected (0.08 sec)

mysql> select * from firsttable where name ='test';
+--------------------------------------+------+------+
| id                                   | name | flag |
+--------------------------------------+------+------+
| 7c89e986-9000-11e7-a1f8-507b9dc06264 | test | 0    |
+--------------------------------------+------+------+
1 row in set (0.09 sec)

mysql> select * from firsttable where name ='test' and flag='0';
+--------------------------------------+------+------+
| id                                   | name | flag |
+--------------------------------------+------+------+
| 7c89e986-9000-11e7-a1f8-507b9dc06264 | test | 0    |
+--------------------------------------+------+------+
1 row in set (0.09 sec)

mysql>

我可以断定,MySQL crash不是由于这个SQL语句。从错误日志看,MSVCR120.dll存在一些问题。如需进一步分析,请分享完整的错误日志。通常会在KILL signal之前捕获损坏的语句。我希望这对你有所帮助。谢谢!

答案 1 :(得分:1)

尝试重新安装x64的VC可再发行组件。 Download vcredist_x64.exe

答案 2 :(得分:0)

Windows 中存在错误

mysql 使用 pow

double busy_blocks=
  n_blocks * (1.0 - pow(1.0 - 1.0/n_blocks, rows2double(nrows)));
if (busy_blocks < 1.0)
<块引用>

https://github.com/mysql/mysql-server/blob/mysql-5.7.19/sql/handler.cc#L7199

在崩溃日志中

7fef78e5c01    MSVCR120.dll!pow()
13f5e5f7a    mysqld.exe!get_sweep_read_cost()[handler.cc:7199]
13fba7b37    mysqld.exe!ror_intersect_add()[opt_range.cc:5461

当mysql使用pow()时,它崩溃了。