twitter-mysql改善点


現在最新のtwitter-mysqlバージョンはmysql 5に基づいている.5.22、以下はいくつかの比較的明らかな改善点をまとめ、大部分はすでに自ら確認した.その他の修復などの比較的副次的な問題(例えばコンパイル問題)はここではしばらくリストしない.詳細は参照できる.https://github.com/twitter/mysql/wiki/Change-History 
修復されたバグ
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,このパラメータの目的はディスクの頻繁なリフレッシュを減らすことであり,特に命の短いSs dディスクに有用である.
ディスクが比較的空いている場合、ブラシのみを使用するたびにinnodb_が制限されます.flush_dirty_pages_age秒の汚れたページ.
2.動的に構成できる--replicate-*パラメータ
サーバを再起動することなく、フィルタリングルールをオンラインで動的に変更できます.
3.新しいオプションmax_を追加statement_timeパラメータ
このパラメータはsessionレベルで、サーバ側で文の実行時間をms単位で制限し、クエリが値を超えると中断されます.
例:
SELECT MAX_STATEMENT_TIME=10 * FROM t1;
10 msを超えるとクエリーが中断されます
口座ごとに時間を制限することもできます
GRANT ... TO 'user'@'host' WITH MAX_STATEMENT_TIME 10
4.新しいinformation_を統合schemaテーブル:
INNODB_BUFFER_PAGE
INNODB_BUFFER_PAGE_LRU
INNODB_BUFFER_POOL_STATS
これらの表には、これらのi_に関する比較的詳細なbuffer pool情報が表示されます.s表はMySQL 5を参照できる.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で_コントロール関数は、次のように実装されます.
最初のパラメータはエンジンのカテゴリを表します
2番目のパラメータはストレージエンジンコマンドを表し、現在prefetch_pages
3番目のパラメータはspace idを表します
4番目のパラメータ(オプションで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 |
+---------------+---------------------------------------------+
このオプションには1つの値しかありません.デフォルトは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日に発表された新しいmysql 5に基づく.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.