twitter mysql_twitter-mysql改进点
目前最新的twitter-mysql版本基于mysql5.5.22,以下總結(jié)了一些比較明顯的改進(jìn)點(diǎn),大部分已經(jīng)親自證實(shí),其他一些諸如修復(fù)的比較次要的問題(例如編譯問題)這里暫不列出,可以詳細(xì)參閱https://github.com/twitter/mysql/wiki/Change-History
修復(fù)的bug
1.bug#60682
某些場(chǎng)景下,同時(shí)執(zhí)行select/drop?table/rename?table/show?innodb?status時(shí),可能會(huì)導(dǎo)致死鎖
使用buglist上提供的testcase在5.1.48上能重現(xiàn),5518尚未重現(xiàn)。
2.bug#61575
當(dāng)無法初始化本地native?aio時(shí)(io_setup()失敗)會(huì)crash?innodb
3.bug#64556
中斷在innodb層的查詢可能會(huì)導(dǎo)致不相關(guān)的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.增加選項(xiàng)innodb_flush_dirty_pages_age,該參數(shù)的目的是為了減少頻繁的去刷新磁盤,尤其是對(duì)于命短的Ssd盤比較有用。
在磁盤比較空閑的時(shí)候,它會(huì)限制每次只刷前innodb_flush_dirty_pages_age秒的臟頁。
2.可以動(dòng)態(tài)配置--replicate-*參數(shù)
用戶可以在線動(dòng)態(tài)修改過濾規(guī)則而無需重啟服務(wù)器
3.增加新的選項(xiàng)max_statement_time參數(shù)
該參數(shù)為session級(jí)別,其目的是在服務(wù)器端限制一條語句的執(zhí)行時(shí)間,單位為ms,當(dāng)查詢超過該值時(shí),會(huì)被中斷。
例如:
SELECT?MAX_STATEMENT_TIME=10?*?FROM?t1;
超過10ms則中斷查詢
還可以給每個(gè)賬戶限制時(shí)間
GRANT?...?TO?'user'@'host'?WITH?MAX_STATEMENT_TIME?10
4.集成新的information_schema表,如下:
INNODB_BUFFER_PAGE
INNODB_BUFFER_PAGE_LRU
INNODB_BUFFER_POOL_STATS
這些表顯示了比較詳細(xì)的buffer?pool信息,關(guān)于這些i_s表可以參閱MySQL5.6的文檔
5.prefetch_pages命令,允許你手動(dòng)的將相應(yīng)的數(shù)據(jù)或者索引頁加載到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函數(shù)來實(shí)現(xiàn),其中:
第一個(gè)參數(shù)表示引擎的類別
第二個(gè)參數(shù)表示存儲(chǔ)引擎命令,目前為prefetch_pages
第三個(gè)參數(shù)表示space?id
第四個(gè)參數(shù)(后面可選的增加更多pageno)表示頁號(hào)
6.super-only選項(xiàng),將禁止非超級(jí)用戶執(zhí)行任何語句(read_only只能阻止更新語句)
7.新的協(xié)議類型protocol_mode
xxx@test?09:54:45>show?variables?like?'%protocol_mode%';
+---------------+---------------------------------------------+
|?Variable_name?|?Value???????????????????????????????????????|
+---------------+---------------------------------------------+
|?protocol_mode?|?MINIMAL_OBJECT_NAMES_IN_RESULT_SET_METADATA?|
+---------------+---------------------------------------------+
這個(gè)選項(xiàng)只有一個(gè)值,默認(rèn)為NULL,該選項(xiàng)可以簡(jiǎn)化傳遞給客戶端的元數(shù)據(jù),當(dāng)設(shè)置該選項(xiàng)后,傳遞給客戶端的庫名,表名和列名都是空字符串(尚未證實(shí))原文的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增加了新的選項(xiàng):
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
這部分大意是在啟動(dòng)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同學(xué)能夠去分析下么,看看能否將這些特性移植過來?
10.buffer?pool內(nèi)存預(yù)分配
增加選項(xiàng)
xxx@test?10:23:11>show?variables?like?'%innodb_buffer_pool_populate%';
+-----------------------------+-------+
|?Variable_name???????????????|?Value?|
+-----------------------------+-------+
|?innodb_buffer_pool_populate?|?OFF???|
+-----------------------------+-------+
為buffer?pool預(yù)先分配好需要的物理內(nèi)存
11.表.ibd文件預(yù)分配
增加了新的表選項(xiàng)min_pages,可以在create/alter?table時(shí),指定page的大小,從而達(dá)到預(yù)分配.ibd文件的目的,對(duì)于插入很猛的應(yīng)用,可以表空間擴(kuò)展引起的避免抖動(dòng)
例如:
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號(hào)發(fā)布的新的基于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.
總結(jié)
以上是生活随笔為你收集整理的twitter mysql_twitter-mysql改进点的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 日历签到 java_我的Android案
- 下一篇: mysql root密码忘记2018_2