murata satoshi
murat****@gmail*****
2016年 7月 18日 (月) 01:22:38 JST
お世話になっております。村田と申します。
Mroongaストレージモードにて、メモリリークと思われる現象がありましたので報告させて頂きます。
(私の早とちりでしたら大変申し訳ありません)
■ 環境
1. Mysql 5.7.11、groonga 6.0.1、mroonga 6.01
2. Mysql 5.7.13、groonga 6.0.5、mroonga 6.06
OSはどちらも Amazon Linux AMI release 2016.03
■ 現象
match...againstを含むSQL、もしくは mroonga_command('select...')でalloc_countが増え続ける。
同じSQL(mroonga_command)を繰り返してもその都度増える。
match...againstを含まない通常のSQLで発行した場合はalloc_countは増えません。
mroonga_commandでは全文検索の有無に関わらず増えます。
mysqldのメモリ使用量も増え続け、最終的にはOOMでmysqldが落ちました。
(これは2.の環境で確認しています。)
■ 確認用テストテーブルとデータ
CREATE TABLE `items` (
`item_id` int(10) unsigned NOT NULL,
`category_id` smallint(5) unsigned NOT NULL DEFAULT '0',
`keyword` text,
PRIMARY KEY (`item_id`),
KEY `idx_category_id` (`category_id`),
FULLTEXT KEY `fti_keyword` (`keyword`) COMMENT 'parser "TokenBigramSplitSymbolAlphaDigit", normalizer "NormalizerAuto"'
) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4
;
INSERT INTO `items` (`item_id`, `category_id`, `keyword`)
VALUES (1, 1, 'テストその01'),
(2, 1, 'テストその02'),
(3, 1, 'テストその03'),
(4, 2, 'テストその04'),
(5, 2, 'テストその05'),
(6, 2, 'テストその06'),
(7, 2, 'テストその07'),
(8, 3, 'テストその08'),
(9, 3, 'テストその09'),
(10,3, 'テストその10')
;
■ 確認用SQLと結果
A. match...againstなしの通常SQL
select * from items order by item_id desc limit 3;
select * from items where category_id = 2 order by item_id desc limit 3;
→ alloc_countは増えない
B. match...againtありの通常SQL
select * from items where match(keyword) against('+04' IN BOOLEAN MODE) order by item_id desc limit 2;
→ alloc_countが増える(実行する度に増える)
C. mroonga_comman('select...')
select mroonga_command('select items --output_columns _id --sortby -item_id --limit 2 --cache no');
→ alloc_countは増えない(初回だけ増える?)
select mroonga_command('select items --output_columns _id --filter category_id==1 --sortby -item_id --limit 2 --cache no');
→ alloc_countが増える(実行する度に増える)
select mroonga_command('select items --output_columns _id --match_columns keyword --query テスト --sortby -item_id --limit 2 --cache no');
→ alloc_countが増える(実行する度に増える)
*環境1.2.で増えるalloc_countの量が異なるように見えます(2.の方が少ないようです)
私の勘違いであったら申し訳ありませんが、確認のためにも報告させていただきます。
何か思い当たる設定の不備等あればご指摘お願いします。
以上、宜しくお願い致します。
------------
murat****@gmail*****