今天发现一个系统innodb的spin rounds per wait为负,感觉很奇怪,原来是个bug:

For example (output from PS but we have no patches here),

----------
SEMAPHORES
----------
OS WAIT ARRAY INFO: reservation count 19811539060
OS WAIT ARRAY INFO: signal count 8333711487
Mutex spin waits 192857078576, rounds 290389036704, OS waits 1568180069
RW-shared spins 19747848205, rounds 565755834160, OS waits 14799492482
RW-excl spins 7774140570, rounds 144578121130, OS waits 3188338144
Spin rounds per wait: -697.30 mutex, -327.60 RW-shared, -177.22 RW-excl This is caused by (double) mutex_spin_round_count /
(mutex_spin_wait_count ? mutex_spin_wait_count : 1), conditional operator part: mutex_spin_wait_count is not an integral type var but a C++ object with type conversion operator to ib_int64_t. 1 is a constant of type (signed) int. Now C++ language rules somehow decide (credit to my colleague Igor Solodovnikov) that the type of the result of conditional operator is int too. This can also be confirmed by disassembling sync_print_wait_info: ...
leaq __ZL21mutex_spin_wait_count(%rip), %r15 # mutex_spin_wait_count.this to R15
...
addq 264(%rcx,%r15), %rdx # counter sum to RDX (only the final add shown, RCX = 0)
...
cvtsi2sdl %edx, %xmm1 # EDX not RDX! opcode is also for "doubleword integer"
...
divsd %xmm1, %xmm0 The bug was introduced together with ib_counter_t introduction. Before, the counter variables being plain integers were working OK (thus 5.5 is not affected) How to repeat:
Code analysis, running server long enough, then looking at the status. Suggested fix:
Probably the easiest fix is s/1/1ULL/g in the conditional operators. But at the same time observe that each counter object mention causes a fresh summation for the counter. Thus better to introduce local vars and to sum each counter only once. Also get rid of redundant typecasts in the first printf, and resolve the ib_int64_t / ib_uint64_t mismatch.
[18 Dec 2015 14:09] Laurynas Biveinis
Bug 79703 fix for 5.6 (*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it. Contribution: bug79703.patch (application/octet-stream, text), 3.17 KiB.
[18 Dec 2015 14:11] Laurynas Biveinis
With proposed patch integer to double conversion uses cvtsi2sdq %rax, %xmm2, which looks correct.
[29 Feb 20:52] Staffan Flink
We've also hit this bug but it seems that the correct numbers for 'Spin rounds per wait' can be retrieved from I_S.INNODB_METRICS. snippet output from 'SHOW ENGINE INNODB STATUS\G':
*************************** 1. row ***************************
Type: InnoDB
Name:
Status:
=====================================
2016-02-29 17:04:50 7f1613cb2700 INNODB MONITOR OUTPUT
=====================================
Per second averages calculated from the last 59 seconds
-----------------
BACKGROUND THREAD
-----------------
srv_master_thread loops: 27828639 srv_active, 0 srv_shutdown, 552 srv_idle
srv_master_thread log flush and writes: 27829190
----------
SEMAPHORES
----------
OS WAIT ARRAY INFO: reservation count 562748487
OS WAIT ARRAY INFO: signal count 4440218264
Mutex spin waits 4031631980, rounds 19046728943, OS waits 221855330
RW-shared spins 1337835479, rounds 10346069330, OS waits 159065324
RW-excl spins 436493896, rounds 12607401587, OS waits 149384138
Spin rounds per wait: -72.33 mutex, 7.73 RW-shared, 28.88 RW-excl Output from I_S.INNODB_METRICS:
mysql> use information_schema;
Database changed
mysql> select name,count,max_count,avg_count from INNODB_METRICS where name like '%spin%';
+-----------------------------+-------------+-------------+--------------------+
| name | count | max_count | avg_count |
+-----------------------------+-------------+-------------+--------------------+
| innodb_rwlock_s_spin_waits | 1338920718 | 1338920718 | 48.02786821549153 |
| innodb_rwlock_x_spin_waits | 436953500 | 436953500 | 15.673777268638679 |
| innodb_rwlock_s_spin_rounds | 10353523860 | 10353523860 | 371.3869483301454 |
| innodb_rwlock_x_spin_rounds | 12620856222 | 12620856222 | 452.7174844992445 |
+-----------------------------+-------------+-------------+--------------------+
4 rows in set (0.00 sec) This would suggests that it's 'SHOW ENGINE INNODB STATUS' that interprets the numbers incorrectly. For information, we're running 5.6.23.

InnoDB Spin rounds per wait在>32位机器上可能为负的更多相关文章

  1. 虚函数列表: 取出方法 // 虚函数工作原理和(虚)继承类的内存占用大小计算 32位机器上 sizeof(void *) // 4byte

    #include <iostream> using namespace std; class A { public: A(){} virtual void geta(){ cout < ...

  2. 【转】一个从32位机器移植到64位机器时的c问题

    原文网址:http://www.jiancool.com/article/96402954887/ 最近工作中遇到了一个讨厌的问题,在32位机器上运行的好好的,但是在64位机器上,出现了诡异的 Seg ...

  3. android studio 64位手机+Fresco引起的在arm64位机器上找不到对应的so库

    我们的程序在32位机器上没有问题,有一天公司采购了一台魅族MX5 MTK的64位处理器上我们的应用报错了 "nativeLibraryDirectories=[/data/app/com.l ...

  4. 笔记:C语言数据类型在32位与64位机器上的字节数

    读<深入理解计算机系统> 第二章 信息的表示与处理 32位与64位的典型值,单位字节 声明 32位机器 64位机器 char 1 1 short int int 4 4 long int ...

  5. 32位Windows7上8G内存使用感受+xp 32位下使用8G内存 (转)

    32位Windows7上8G内存使用感受+xp 32位下使用8G内存 博客分类: Windows XPWindowsIE企业应用软件测试  我推荐做开发的朋友:赶快加入8G的行列吧....呵呵..超爽 ...

  6. Windows 8 64位系统 在VS2010 32位软件上 搭建 PCL点云库 开发环境

    Windows 8 64位系统 在VS2010 32位软件上 搭建 PCL点云库 开发环境 下载PCL For windows 软件包 到这个网站下载PCL-All-In-One Installer: ...

  7. 如何在linux 32位机器编译64位程序

    编译64位程序,不一定要编译机器是64位的,但是32位机器默认安装的gcc编译环境还是不能用来编译64位程序. 编译64位程序,需要加上-m64编译器参数,默认安装的gcc已经支持该参数,但是缺少64 ...

  8. Oracle 在64位机器上使用plSQL连接Oracle的问题(SQL*Net not properly installed)

    问题: 在64位机器上了64位的oracle客户端. 然后装上PL/SQL Developer,但是连接oracle老报这个错: Initialization error      SQL*Net n ...

  9. Windows 7,64位机器上安装DB2 7.2+FP7

    1.要想在Windows 7,64位机器上安装DB2 7.2+FP7,注意:1)拷贝所有安装文件到本地2)设置setup.exe文件兼容windows 20003)使得users用户勾选“完全控制”权 ...

随机推荐

  1. 通过jquery获取ul中第一个li的属性

    当加载列表时,默认希望选中第一条.top_menu 为ul的ID 通过 $("#top_menu li:first") 就可以获取到 ul下第一个li标签.然后就可以利用 例如 修 ...

  2. 远程访问mysql

    转载:http://www.codesky.net/article/201108/106005.html 数据库不允许从远程访问怎么办?本文提供了三种解决方法: 1.改表法.可能是你的帐号不允许从远程 ...

  3. mysql破解root用户密码总结

    方法一: 1. /etc/my.cnf 在[mysqld]段中加入 skip-grant-table2. 重启mysql3. 直接mysql登录4. 通过修改权限表方式修改mysql密码(update ...

  4. Maven学习 (四) 使用Nexus搭建Maven私服

    为什么要搭建nexus私服,原因很简单,有些公司都不提供外网给项目组人员,因此就不能使用maven访问远程的仓库地址,所以很有必要在局域网里找一台有外网权限的机器,搭建nexus私服,然后开发人员连到 ...

  5. SQL Server 触发器(转)

    触发器是一种特殊类型的存储过程,它不同于之前的我们介绍的存储过程.触发器主要是通过事件进行触发被自动调用执行的.而存储过程可以通过存储过程的名称被调用. Ø 什么是触发器 触发器对表进行插入.更新.删 ...

  6. js判断字符是否包含字母汉字

    <script type="text/javascript"> function check(str) { if (escape(str).indexOf(" ...

  7. Ruby--strftime

    -- [17 Oct 2016 05:37:18AM]:%e %b %Y %H:%M:%S%p -- [Oct 17, 2016]:%b %d, %Y -- [10-17-16 05:37]:%m-% ...

  8. Thinking in Java——笔记(9)

    Polymorphism Abstract classes and methods If you have an abstract class, objects of that specific cl ...

  9. 使用TarOutputStream出现 request to write '1024' bytes exceeds size in header错误的解决方法

    因为测试流程中,所测客户端会根据服务器A返回的response决定发送给服务器B的请求里各参数的值,所以现在需要模拟服务器的响应.而这个项目服务器A的响应式返回一个流,一个GZIP压缩格式流,压缩的是 ...

  10. Vim ide for shell development

    Source : This article is part of the ongoing Vi / Vim Tips and Tricks Series. As a Linux sysadmin or ...