twitter mysql_twitter-mysql改进点

目前最新的twitter-mysql版本基于mysql5.5.22,以下总结了一些比较明显的改进点,大部分已经亲自证实,其他一些诸如修复的比较次要的问题(例如编译问题)这里暂不列出,可以详细参阅https://github.com/twitter/mysql/wiki/Change-History

修复的bug

1.bug#60682

某些场景下,同时执行select/drop table/rename table/show innodb status时,可能会导致死锁

使用buglist上提供的testcase在5.1.48上能重现,5518尚未重现。

2.bug#61575

当无法初始化本地native aio时(io_setup()失败)会crash innodb

3.bug#64556

中断在innodb层的查询可能会导致不相关的warning

4.Bug#65030:

5.Bug#65061

6. Potential security issue with Oracle MySQL

If, for whatever reason, the memcmp() call in check_scramble() returns a value with the 8 rightmost bits set to zero (e.g. 256), an invalid password could be accepted during authentication.

新特性

1.增加选项innodb_flush_dirty_pages_age,该参数的目的是为了减少频繁的去刷新磁盘,尤其是对于命短的Ssd盘比较有用。

在磁盘比较空闲的时候,它会限制每次只刷前innodb_flush_dirty_pages_age秒的脏页。

2.可以动态配置--replicate-*参数

用户可以在线动态修改过滤规则而无需重启服务器

3.增加新的选项max_statement_time参数

该参数为session级别,其目的是在服务器端限制一条语句的执行时间,单位为ms,当查询超过该值时,会被中断。

例如:

SELECT MAX_STATEMENT_TIME=10 * FROM t1;

超过10ms则中断查询

还可以给每个账户限制时间

GRANT ... TO 'user'@'host' WITH MAX_STATEMENT_TIME 10

4.集成新的information_schema表,如下:

INNODB_BUFFER_PAGE

INNODB_BUFFER_PAGE_LRU

INNODB_BUFFER_POOL_STATS

这些表显示了比较详细的buffer pool信息,关于这些i_s表可以参阅MySQL5.6的文档

5.prefetch_pages命令,允许你手动的将相应的数据或者索引页加载到buffer pool中,例如

root@test 09:44:18>select engine_control(innodb, prefetch_pages, 2,1) as pages;

+-------+

| pages |

+-------+

|     1 |

+-------+

1 row in set (0.00 sec)

通过engine_control函数来实现,其中:

第一个参数表示引擎的类别

第二个参数表示存储引擎命令,目前为prefetch_pages

第三个参数表示space id

第四个参数(后面可选的增加更多pageno)表示页号

6.super-only选项,将禁止非超级用户执行任何语句(read_only只能阻止更新语句)

7.新的协议类型protocol_mode

xxx@test 09:54:45>show variables like '%protocol_mode%';

+---------------+---------------------------------------------+

| Variable_name | Value                                       |

+---------------+---------------------------------------------+

| protocol_mode | MINIMAL_OBJECT_NAMES_IN_RESULT_SET_METADATA |

+---------------+---------------------------------------------+

这个选项只有一个值,默认为NULL,该选项可以简化传递给客户端的元数据,当设置该选项后,传递给客户端的库名,表名和列名都是空字符串(尚未证实)原文的changelog解释如下:

This change introduces a new protocol mode that instructs MySQL to empty certain object names that are part of the result set metadata. Only the absolutely minimal (or essential) set of names is preserved. If the minimal option is set, the database, table (both original and aliased) and column names in the result set metadata will be empty strings. Only the column alias name is preserved.

8.增加了一些新的status变量

Innodb_files_open

Innodb_files_opened

Innodb_files_closed

Innodb_tablespace_files_open

Innodb_tablespace_files_opened

Innodb_tablespace_files_closed

9.为mysqld_safe增加了新的选项:

Format

Option File

Description

--flush-caches

flush-caches

Flush and purge buffers/caches (vm.drop_caches=3)

--numa-interleave

numa-interleave

Run mysqld with its memory interleaved on all CPUs

这部分大意是在启动Mysqld前sync and drop cache??

Added mysqld_safe options to flush (sync and drop) caches before starting mysqld and to set the NUMA memory allocation policy to interleave

有DBA同学能够去分析下么,看看能否将这些特性移植过来?

10.buffer pool内存预分配

增加选项

xxx@test 10:23:11>show variables like '%innodb_buffer_pool_populate%';

+-----------------------------+-------+

| Variable_name               | Value |

+-----------------------------+-------+

| innodb_buffer_pool_populate | OFF   |

+-----------------------------+-------+

为buffer pool预先分配好需要的物理内存

11.表.ibd文件预分配

增加了新的表选项min_pages,可以在create/alter table时,指定page的大小,从而达到预分配.ibd文件的目的,对于插入很猛的应用,可以表空间扩展引起的避免抖动

例如:

root@test 10:38:44>Create table t1 (a int ,b int ) min_pages = 100;

Query OK, 0 rows affected (0.12 sec)

$ls -lh t1.ibd

-rw-rw---- 1 root root 7.0M Apr 18 10:38 t1.ibd

24号发布的新的基于mysql5.5.22的版本,还没来得及看,先贴过来吧 :)

MYSQL-62: Replication info not available from crash recovery?

Restored code that stores the master binary log position of a slave in InnoDB's data file. Like in earlier MySQL versions, if a slave crashes, the name and position of the slave in relation to the master binary log file is printed after crash recovery.

Backport innodb_flush_neighbors from MySQL 5.6

Backported from MySQL 5.6 the innodb_flush_neighbors option that controls whether flushing a page from the InnoDB buffer pool also flushes other dirty pages in the same extent.

Add ability to disable anticipatory flushing

Introduced the innodb_anticipatory_flushing option that controls whether the master thread will flush dirty pages from the buffer pool if there is I/O bandwidth available for background tasks.

Add InnoDB flush-related status variables

Introduced status variables that provide counters for the various flushing-related tasks performed by InnoDB. For example, these counters provide information about the number of pages scanned and flushed from the flush and LRU lists. Also, there are counters for the number of pages flushed by the background thread.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值