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.
總結
以上是生活随笔為你收集整理的twitter mysql_twitter-mysql改进点的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 日历签到 java_我的Android案
- 下一篇: 贷款年利率5%怎么算利息?