今天发现一个系统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-exclThis 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, %xmm0The 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-exclOutput 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.

转载于:https://www.cnblogs.com/sunss/p/5535871.html

InnoDB Spin rounds per wait在32位机器上可能为负相关推荐

  1. 编写函数unsigned int reverse_bit(unsigned int value),实现无符号二进制整数在32位机器上的bit位翻转

    编写函数unsigned int reverse_bit(unsigned int value),实现无符号二进制整数在32位机器上的bit位翻转 如: 在32位机器上25这个值包含下列各位: 000 ...

  2. 在32位机器上实现64位数的除法

    概述 在32位机器上不能直接进行64位数据的除法,比如a或b是64位的数据的时候,要计算a/b,不能直接data = a/b;这样的计算,编译器会报错,缺少相关的指令.这就需要我们单独去实现64位数据 ...

  3. ubuntu i386在32位机器上安装

    1 下载ubuntu16镜像,mirror中选i386 2 用ultraISO下入硬盘 3 真正奇怪的是32位的bootia32.efi无法得到 4 上CSDN下载的花了很多钱,放入U盘的EFI/bo ...

  4. 32位机器 64位 机器

    C/C++ 32位机器和64位机器 差异问题总结 跨平台 移植问题 语言编程需要注意的64位和32机器的区别 #include <stddef.h> OS version:Red Hat ...

  5. 32位机器int变量的最大值和最小值

    对于32位(即4个字节)有符号的int变量来说: 最高位用来表示正负性,1表示为负,0表示为正. 最大值:符号位置为0后,还剩下31位,这31位可以组成的二进制数的个数为2 ^ 31 = 2,147, ...

  6. 32位机器下面各类型的取值范围(sizeof值)

    32位机器下面各类型的取值范围(sizeof值)   32位机器下面的结果: 数据类型 说明 字节数 取值范围 bool 布尔型 1 true,false char 字符型 1 -128-127 un ...

  7. sql2005性能优化(在32位系统上突破2G内存使用量的方法)

    服务器磁盘为(SAS)IBM组成RAID0+1,SQL2K5只识别4G内存,实际只占用2G内存.而使用 AWE的话,应用程序可以直接将操作系统允许的最大物理内存量保留为未分页的内存.使用 AWE 使  ...

  8. 如何查看自己的电脑是32位机器还是64位机器

    有的时候在装软件是会遇到两个版本的软件安装 分别是32位和64位 这就要求我们要知道自己的机器是多少位的 选择对应的程序安装 下面介绍两种查看的方法 方法一 开始->运行-> 输入 win ...

  9. 32位机器和64位机器中int、char等数据类型所占字节长度对比

    在32位机器和64机器中int类型都占用4个字节.编译器可以根据自身硬件来选择合适的大小,但是需要满足约束:short和int型至少为16位,long型至少为32位,并且short型长度不能超过int ...

最新文章

  1. LSD-SLAM解读——帧间追踪(详细推导)
  2. Java实现按名称、日期、大小对文件进行排序
  3. 人工机器:NDC-谷歌机器翻译破世界纪录,仅用Attention模型,无需CNN和RNN
  4. 给用过SAP CRM中间件的老哥老姐们讲讲SAP CPI
  5. TensorFlow的这些骚操作你都知道吗?
  6. java实现k-means算法(用的鸢尾花iris的数据集,从mysq数据库中读取数据)
  7. 这回,B站跨年晚会吊打各卫视
  8. cjson 对象是json数组型结构体_C语言cJSON库的使用,解析json数据格式
  9. shl归纳推理测试题库_SHL(外企笔试常见试题)全攻略
  10. 密码学中数论和有限域基本概念
  11. UE4 虚幻引擎, 蓝图节点应用笔记(一)
  12. linux下载的安装包位置,及下载安装包到本地
  13. 大话信号与系统 --- 奇文共欣赏
  14. echarts图片的打印问题
  15. Code Project精彩系列(2)
  16. 全能型终端神器!好用、免费!
  17. StopWatch秒表的使用
  18. 2014年如何找到SEO流量的突破口
  19. mdb数据库转postgresql数据库
  20. uniapp引入阿里图标

热门文章

  1. Linux云服务器安装nginx
  2. MxNet教程:使用一台机器训练1400万张图片
  3. 相似图像识别检 —基于图像签名(LSH)
  4. vue 用户名重复验证_Vue项目中实现用户登录及token验证
  5. ZooKeeper 数据结构 命令
  6. ASIHTTPRequest 简单使用
  7. HTTP 错误 500.22 - Internal Server Error 检测到在集成的托管管道模式下不适用的 ASP.NET 设置。...
  8. 谁占用了我的Buffer Pool
  9. HP DL380G4服务器前面板指示灯的含义
  10. 米聊PK微信:微信是一朵奇葩