在使用mysql5.7的时候,发现了不少在mysql5.6上不曾见过的日志,级别为note, 最常见的note日志以下三种,下面我们来逐个解释。
第一种,Aborted connection . 如上图,信息如下:
2016-03-17T14:44:24.102542Z 59 [Note] Aborted connection 59 to db: ‘unconnected’ user: ‘mha’ host: ‘197.xx.xx.xx’ (Got an error reading communication packets)
2016-03-17T14:44:31.273897Z 61 [Note] Aborted connection 61 to db: ‘unconnected’ user: ‘mha’ host: ‘197.xx.xx.xx(Got an error reading communication packets)
2016-03-17T14:44:31.273897Z 61 [Note] Aborted connection 61 to db: ‘unconnected’ user: ‘mha’ host: ‘197.xx.xx.xx(Got an error reading communication packets)
2016-03-17T14:44:31.273897Z 61 [Note] Aborted connection 61 to db: ‘unconnected’ user: ‘mha’ host: ‘197.xx.xx.xx(Got timeout reading communication packets)
上面两个是连接中断的错误信息,原因不一样,Got an error reading communication packets 的原因是因为网络等原因导致。 Got timeout reading communication packets 这个错误的原因是会话的idle时间达到了数据库指定的timeout时间。
第二种:SLAVE多线程同步的信息
信息如下:
2016-03-14T15:48:26.432150Z 73 [Note]Multi-threaded slave statistics for channel ”: seconds elapsed = 121; eventsassigned = 100374529; worker queues filled over
overrun level = 0; waited due aWorker queue full = 0; waited due the total size = 0; waited at clock conflicts= 1451875661700 waited (count) when Workers occupied = 3211993 waited whenWorkers occupied = 445032386000
2016-03-14T15:50:28.398745Z 73 [Note]Multi-threaded slave statistics for channel ”: seconds elapsed = 122; eventsassigned = 100500481; worker queues filled over
overrun level = 0; waited due aWorker queue full = 0; waited due the total size = 0; waited at clock conflicts= 1452001865500 waited (count) when Workers occupied = 3211993 waited whenWorkers occupied = 445032386000
我们通过源代码,找到下面一段,该段实现了上述日志的输出。
if ((my_now
– rli->mts_last_online_stat)>=
mts_online_stat_period)
{
sql_print_information(“Multi-threadedslave
statistics%s: “
“seconds
elapsed = %lu; “
“events
assigned = %llu; “
“worker
queues filled over overrun level = %lu;”
“waited
due a Worker queue full = %lu; “
“waited
due the total size = %lu; “
“waited
at clock conflicts = %llu “
“waited(count)
when Workers occupied = %lu “
“waited
when Workers occupied = %llu”,
rli->get_for_channel_str(),
static_cast<unsignedlong>
(my_now – rli->mts_last_online_stat),
rli->mts_events_assigned,
rli->mts_wq_overrun_cnt,
rli->mts_wq_overfill_cnt,
rli->wq_size_waits_cnt,
rli->mts_total_wait_overlap,
rli->mts_wq_no_underrun_cnt,
rli->mts_total_wait_worker_avail);
rli->mts_last_online_stat=my_now;
通过这一句(my_now
– rli->mts_last_online_stat), 以及最后一句rli->mts_last_online_stat=my_now; 可以得知,
seconds elapsed 就是上一次统计跟这一次统计的时间间隔。
而mts_online_stat_period =120秒,硬代码,因此就是几乎每隔120秒,就有上述日志的输出。
通过进一步查看原代码,初步了解上述日志信息的含义,如下:
events assigned:总共有多少个event被分配执行,计的是总数。
worker queues filled over overrun level:多线程同步中,worker 的私有队列长度超长的次数,计的是总数。
waited due a Worker queue full :因为worker的队列超长而产生等待的次数,计的是总数。
waited due the total size :超过最大size的次数,这个由参数slave_pending_jobs_size_max 指定。
waited at clock conflicts :因为逻辑时间产生冲突的等待时间,单位是纳秒。
waited (count) when Workers occupied :因为workder被占用而出现等待的次数。(总计值)。
waited when Workersoccupied :因为workder被占用而出现等待的总时间,总计值,单位是纳秒。
第三种:page_cleaner线程的输出日志
如图,信息如下:
2016-03-24T17:45:28.005117Z 0 [Note] InnoDB:page_cleaner: 1000ms intended loop took 4750ms.The
settings might not be optimal. (flushed=1519 and evicted=0, during the time.)
查找源代码,发现是上面的日志由下面一段代码输出:
if (ret_sleep
== OS_SYNC_TIME_EXCEEDED) {
ulint
curr_time = ut_time_ms();
if (curr_time
>next_loop_time + 3000) {
if (warn_count
== 0) {
ib::info()
<< “page_cleaner: 1000ms”
” intended
loop took “
<<1000 + curr_time
– next_loop_time
<<“ms. The
settings might not”
” be optimal.
(flushed=”
<<n_flushed_last
<<” and evicted=”
<<n_evicted
<<“, during
the time.)”;
if (warn_interval
>300) {
warn_interval= 600;
}else {
warn_interval*= 2;
}
warn_count= warn_interval;
} else {
–warn_count;
}
} else {
/* reset counter */
warn_interval= 1;
warn_count= 0;
}
next_loop_time= curr_time + 1000;
n_flushed_last= n_evicted = 0;
}
通过分析源代码, 输出上述日志的条件是curr_time> next_loop_time + 3000 ,即比原定的循环时间next_loop_time多3000毫秒,而next_loop_time的标准时间是1000毫秒,即1秒钟做一次刷新页的操作。
loop took 4750ms ,即是这次刷新循环的实际经历时间。
后面还有一个(flushed=1519 and evicted=0,during the time.)这样的日志,即对应n_flushed_last与n_evicted 变量,而这两个变量又由n_flushed_list与n_flushed_lru赋值。
./storage/innobase/buf/buf0flu.cc:3322: n_flushed_last +=n_flushed_list;
./storage/innobase/buf/buf0flu.cc:3321: n_evicted += n_flushed_lru;
而n_flushed_list与n_flushed_lru赋值函数为pc_wait_finished,如下,我们来看看该函数的注释。
pc_wait_finished(&n_flushed_lru,&n_flushed_list);
/**
Wait until all flush requests are finished.
@param n_flushed_lru numberof pages flushed from the end of the LRU list.
@param n_flushed_list numberof pages flushed from the end of the
flush_list.
@return trueif all flush_list flushing batch were success. */
static
bool
pc_wait_finished(
ulint* n_flushed_lru,
ulint* n_flushed_list)
{
。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
}
通过源代码的注释,我们获知如下信息:
n_flushed_lru number of pages flushed from the end of the LRU list.
n_flushed_lru 这个值表示从lru 列表尾部刷新的页数,也就是日志中如evicted=0 指标的所表示的值,如果该值不为零,则存在innodb buffer不够的嫌疑。
n_flushed_list 这个是从刷新列表中刷新的页数,也就是脏页数,也就是日志中flushed=1519 的值。
- mysqlbinlog抽取二进制日志中某库某表的日志
1.先使用myqlbinlog命令把整个库的二进制日志抽取出来 mysqlbinlog --database=db_name mysql-bin.xxxxxx > db_name.sql 2.然 ...
- 内存中 OLTP - 常见的工作负荷模式和迁移注意事项(一)
----------------------------我是分割线------------------------------- 本文翻译自微软白皮书<In-Memory OLTP – Comm ...
- c#.NET中日志信息写入Windows日志中解决方案
1. 目的应用系统的开发和维护离不开日志系统,选择一个功能强大的日志系统解决方案是应用系统开发过程中很重要的一部分.在.net环境下的日志系统解决方案有许多种,log4net是其中的佼佼者.在Wind ...
- ES & Filebeat 使用 Pipeline 处理日志中的 @timestamp
使用 Pipeline 处理日志中的 @timestamp Filebeat 收集的日志发送到 ElasticSearch 后,会默认添加一个 @timestamp 字段作为时间戳用于检索,而日志中的 ...
- 安装解压版本的MySQL,安装过程中的常见命令,检查windows系统错误日志的方式来检查MySQL启动错误,关于Fatal error: Can't open and lock privilege
以端口 port = 3306 # 设置mysql的安装目录 basedir=D://Installed//mysql-5.6.26-winx64//mysql-5.6.26-winx64 # ...
- ALERT日志中常见监听相关报错之三:ORA-609 TNS-12537 and TNS-12547 or TNS-12170 TNS-12535错误的排查
1.11G中ALERT日志中有报错ORA-609 TNS-12537 and TNS-12547 or TNS-12170 12170, 'TNS-12535等问题的解决方法: Troublesho ...
- Java 中最常见的 5 个错误
在编程时,开发者经常会遭遇各式各样莫名错误.近日,Sushil Das 在 Geek On Java上列举了 Java 开发中常见的 5 个错误,与君共「免」. 原文链接:Top 5 Common M ...
- Monkey日志中如何找错误
无响应问题可以在日志中搜索 “ANR” ,崩溃问题搜索 “CRASH” ,内存泄露问题搜索"GC"(需进一步分析),异常问题搜索 “Exception” monkey执行时未 ...
- C语言初学者代码中的常见错误与瑕疵(23)
见:C语言初学者代码中的常见错误与瑕疵(23)
随机推荐
- java学习-java.lang一Number类
java.lang包是java语言中被用于编程的基本包.编写的程序基本上都要用到这个包内的常用类. 包含了基本数据类型包装类(Boolean,Number,Character,Void)以及常用类型类 ...
- 根据模板导出excel
@RequestMapping(value = "/export", method = RequestMethod.GET) public void exportApprovals ...
- [笔记] Python 中JSON数据的读写
前言 JSON(JavaScript Object Notation,JavaScript对象表示法)是一种轻量级的数据交换语言 JSON是独立于语言的文本格式, JSON 数据格式与语言无关 JSO ...
- 在Docker平台实现MySQL Replication(复制)
MySQL Replication提供了数据库之间复制数据的功能,通过这个功能可以让一个数据库的数据更改自动同步到另外一个数据库.通常用这个功能来实现数据备份.数据容灾.数据冗余,进一步实现数据的读写 ...
- Java8常用新特性实践
前言: 时下Oracle开速迭代的Java社区以即将推出Java10,但尴尬的是不少小中企业仍使用JDK7甚至JDK6开发. 从上面列出的JDK8特性中我们可以发现Java8的部分特性很明显的是从Sc ...
- vue基于d2-admin的RBAC权限管理解决方案
前两篇关于vue权限路由文章的填坑,说了一堆理论,是时候操作一波了. vue权限路由实现方式总结 vue权限路由实现方式总结二 选择d2-admin是因为element-ui的相关开源项目里,d2-a ...
- webAPP 图片上传
关于webAPP 手机上传 用的vue.js 首先是js代码 调用手机app 的 相册或者自己拍照 upload: function(index) { //上传 this.index = index ...
- C# 学习笔记(二) 时间格式化字符串
1. 以下4种时间格式化符号输出的固定时间格式在各个区域设置中都应是相同的: 标准格式字符串 由 DateTimeFormatInfo.InvariantInfo 属性定义 自定义格式字符串 “O”或 ...
- xmpp实现的即时通讯聊天(一)
参考网址:http://www.jianshu.com/p/b401ad6ba1a7 http://www.jianshu.com/p/4edbae55a07f 一.mysql和openfire环境的 ...
- zookeeper 典型应用
一.发布/订阅 配置文件的集中管理. 问题:当分布式系统变多后,每个系统保存相应的配置文件,会造成同个文件有多份,修改起来非常麻烦. 解决方法:使用zk的发布/订阅功能,配合Watcher机制,在应用 ...