[groonga-dev, 04500] Re: Mroonga-7.05(Groonga-7.0.5):[hash][key][put] total key size is over

Back to archive index

Horimoto Yasuhiro horim****@clear*****
2017年 10月 4日 (水) 13:19:12 JST


宮下さん

こんにちは。堀本です。


ご質問の「これがサポートされる方法なのか?」については、「サポート」というのが、「正常に動作する」という意味であれば、
宮下さんが実施した対策で、正常に動作します。

「さらに良い方法はないか?」についてですが、こちらは、Mroongaからテーブルを作成する際に、現状、KEY_LARGEを指定する方法がないので、KEY_LARGEを指定できるようにしてみます。

また、「インデックステーブルは「TABLE_PAT_KEY」で作成されているのに、なぜエラーログには「[hash]」と出力されるのか?」ですが、こちらは、キーサイズが制限を超えたテーブルが「TABLE_HASH_KEY」で作成されているt1テーブルだからだと思います。

このエラーログは、t1テーブルにたくさんのレコードを挿入した結果、t1テーブルのキーサイズが増加していき、4GBを超えてしまったために発生したエラーログです。t1テーブルは「TABLE_HASH_KEY」で作成されているので、ログには「[hash]」と出力されます。


以上です。失礼いたします。

On 2017年10月02日 13:25, Masanori Miyashita wrote:
> いつもお世話になっております。宮下と申します。
> 
> Mroongaにてデータの挿入時およびインデックスをオフラインで作成するときに
> 以下のエラーがgroonga.logに出力されました。
> この事象について、自分なりの対策を講じたのですが
> ・これがサポートされる方法なのか?
> ・さらに良い方法はないか?(Mroonga経由でGroongaにテーブル作成時のflagを渡せないか?)
> について、もしご存知であれば教えていただけますと幸いです。
> また、インデックステーブルは「TABLE_PAT_KEY」で作成されているのに、なぜエラーログには「[hash]」と出力されるのか?
> こちらについても、もしご存じでしたら教えていただけますと幸いです。
> 
> groonga.log:
> |e|af56e700|[hash][key][put] total key size is over: <t1>: max=4294967295 <tel:4294967295>: current=4294966695 <tel:4294966695>: new key size=1179
> 
> 対策:
> 1)mroonga_command('schema')を使用して、対象のテーブル作成コマンドを記録
> 2)mroonga_commandを使ってテーブル削除
> 3)1で記録しておいたtable_createコマンドの内容に「KEY_LARGE」を追加してテーブル作成
> 4)alter table ... disable/enable keysでインデックスを再構築
> 
> 
> 以下は詳細を記載しております。必要に応じてご覧ください。
> よろしくお願いいたします。
> 
> 
> groonga.log詳細:
> 2017-09-26 01:10:12.221752|e|af56e700|[hash][key][put] total key size is over: <t1>: max=4294967295 <tel:4294967295>: current=4294966695 <tel:4294966695>: new key size=1179
> 2017-09-26 01:10:12.366788|e|af56e700|/usr/loca/groonga/lib/libgroonga.so.0(+0x222f81) [0x7fba3c822f81]
> 2017-09-26 01:10:12.366849|e|af56e700|/usr/loca/groonga/lib/libgroonga.so.0(+0x223549) [0x7fba3c823549]
> 2017-09-26 01:10:12.366872|e|af56e700|/usr/loca/groonga/lib/libgroonga.so.0(+0x225a2a) [0x7fba3c825a2a]
> 2017-09-26 01:10:12.366882|e|af56e700|/usr/loca/groonga/lib/libgroonga.so.0(grn_hash_add+0x974) [0x7fba3c826523]
> 2017-09-26 01:10:12.366890|e|af56e700|/usr/loca/groonga/lib/libgroonga.so.0(grn_table_add+0x7f9) [0x7fba3c6cb9d9]
> 2017-09-26 01:10:12.366898|e|af56e700|/usr/local/mysql/lib/plugin/ha_mroonga.so(_ZN10ha_mroonga23wrapper_write_row_indexEPh+0x3a6) [0x7fb9fb5b3e34]
> 2017-09-26 01:10:12.366907|e|af56e700|/usr/local/mysql/lib/plugin/ha_mroonga.so(_ZN10ha_mroonga17wrapper_write_rowEPh+0x25a) [0x7fb9fb5b3a5e]
> 2017-09-26 01:10:12.366915|e|af56e700|/usr/local/mysql/lib/plugin/ha_mroonga.so(_ZN10ha_mroonga9write_rowEPh+0xbd) [0x7fb9fb5b674f]
> 2017-09-26 01:10:12.366923|e|af56e700|/usr/local/mysql/bin/mysqld(_ZN7handler12ha_write_rowEPh+0x15d) [0x64e23d]
> 2017-09-26 01:10:12.366931|e|af56e700|/usr/local/mysql/bin/mysqld(_Z12write_recordP3THDP5TABLEP9COPY_INFOS4_+0xc13) [0x7c3c6d]
> 2017-09-26 01:10:12.366939|e|af56e700|/usr/local/mysql/bin/mysqld(_Z12mysql_insertP3THDP10TABLE_LISTR4ListI4ItemERS3_IS5_ES6_S6_15enum_duplicatesb+0x1006) [0x7c1a74]
> 2017-09-26 01:10:12.366947|e|af56e700|/usr/local/mysql/bin/mysqld(_Z21mysql_execute_commandP3THD+0x2e19) [0x7e48b9]
> 2017-09-26 01:10:12.366955|e|af56e700|/usr/local/mysql/bin/mysqld(_Z11mysql_parseP3THDPcjP12Parser_state+0x428) [0x7ec536]
> 2017-09-26 01:10:12.366963|e|af56e700|/usr/local/mysql/bin/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcj+0xc94) [0x7df6e8]
> 2017-09-26 01:10:12.366971|e|af56e700|/usr/local/mysql/bin/mysqld(_Z10do_commandP3THD+0x340) [0x7de812]
> 2017-09-26 01:10:12.366979|e|af56e700|/usr/local/mysql/bin/mysqld(_Z24do_handle_one_connectionP3THD+0x1be) [0x7a57ed]
> 
> 発生状況:
> 対象のテーブルに対して総ファイルサイズ870MB(420万行)のデータを10万行ずつに分けてbulk insertしたところ
> 740MB~760MBあたり(360万行~370万行)でstdout or stderrに以下が出力された。併せて、groonga.logに上記エラーが出力された。
> ※順不同。実際には同じ内容が連続して出力されていた。
> ---
> Warning (Code 1026): failed to add a new record into groonga: key=<&>
> Warning (Code 1026): failed to add a new record into groonga: key=<'>
> Warning (Code 1026): failed to add a new record into groonga: key=<>
> Warning (Code 1026): failed to add a new record into groonga: key=<L>
> Warning (Code 1026): failed to add a new record into groonga: key=<V>
> Warning (Code 1026): failed to add a new record into groonga: key=<[>
> Warning (Code 1026): failed to add a new record into groonga: key=<]>
> Warning (Code 1026): failed to add a new record into groonga: key=<c>
> Warning (Code 1026): failed to add a new record into groonga: key=<f>
> Warning (Code 1026): failed to add a new record into groonga: key=<m>
> Warning (Code 1026): failed to add a new record into groonga: key=<q>
> Warning (Code 1026): failed to add a new record into groonga: key=<�
>>
> Warning (Code 1026): failed to add a new record into groonga: key=<ヲ>
> Warning (Code 1026): failed to add a new record into groonga: key=<ヲ>
> Warning (Code 1026): failed to add a new record into groonga: key=<ェ>
> Warning (Code 1026): failed to add a new record into groonga: key=<ォ>
> Warning (Code 1026): failed to add a new record into groonga: key=<ョ>
> Warning (Code 1026): failed to add a new record into groonga: key=<ケ>
> Warning (Code 1026): failed to add a new record into groonga: key=<ニ>
> Warning (Code 1026): failed to add a new record into groonga: key=<ノ
>>
> Warning (Code 1026): failed to add a new record into groonga: key=<ヤ>
> Warning (Code 1026): failed to add a new record into groonga: key=<ヨ>
> Warning (Code 1026): failed to add a new record into groonga: key=<ン>
> Warning (Code 1026): failed to add a new record into groonga: key=<゙>
> 
> ---
> 
> 影響:
> 上記エラー移行にインデックス作成の対象とされた行については、インデックスが正常に作成されていない可能性がある。
> 
> システム環境:
> CentOS6.5, MySQL-5.6.17, Groonga-7.0.5, Mroonga-7.05
> 
> テーブル定義(ラッパーモード):
> CREATE TABLE `t1` (
>   `col1` int(11) NOT NULL,
>   `col2` varchar(64) NOT NULL DEFAULT '',
>   `col3` varchar(64) NOT NULL DEFAULT '',
>   `col4` int(11) NOT NULL,
>   `col5` bigint(20) NOT NULL,
>   `col6` varchar(255) NOT NULL DEFAULT '',
>   `col7` bigint(20) NOT NULL,
>   `col8` varchar(255) DEFAULT NULL,
>   `col9` datetime DEFAULT NULL,
>   `col10` datetime DEFAULT NULL,
>   PRIMARY KEY (`col1`,`col2`,`col3`,`col4`,`col5`,`col6`,`col7`),
>   KEY `btr1` (`col1`,`col2`,`col3`,`col8`,`col7`),
>   KEY `btr2` (`col1`,`col2`,`col3`,`col4`,`col8`,`col7`),
>   KEY `btr3` (`col1`,`col2`,`col7`,`col5`),
>   FULLTEXT KEY `ftx4` (`col8`)
> ) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "InnoDB" テスト用テーブル'
> 
> 
> テーブルリスト:
> mroonga_command('table_list --output_pretty yes'): [
>     [
> ---省略---
>     ],
>     [
>       256,
>       "mroonga_operations",
>       "d1.mrn.0000100 <tel:0000100>",
>       "TABLE_NO_KEY|PERSISTENT",
>       null,
>       null,
>       null,
>       null
>     ],
>     [
>       265,
>       "t1",
>       "d1.mrn.0000109 <tel:0000109>",
>       "TABLE_HASH_KEY|KEY_LARGE|PERSISTENT", ←「KEY_LARGE」は自分で追加しました。
>       "ShortText",
>       null,
>       null,
>       null
>     ],
>     [
>       266,
>       "t1#ftx4",
>       "d1.mrn.000010A",
>       "TABLE_PAT_KEY|PERSISTENT",
>       "ShortText",
>       null,
>       "TokenBigram",
>       "NormalizerMySQLGeneralCI"
>     ]
>   ]
> 
> カラムリスト1:
> mroonga_command('column_list t1 --output_pretty yes'): [
>     [
> ---省略---
>     ],
>     [
>       265,
>       "_key",
>       "",
>       "",
>       "COLUMN_SCALAR",
>       "t1",
>       "ShortText",
>       [
>       ]
>     ]
>   ]
> 
> カラムリスト2:
> mroonga_command('column_list t1#ftx4 --output_pretty yes'): [
>     [
> ---略---
>     ],
>     [
>       266,
>       "_key",
>       "",
>       "",
>       "COLUMN_SCALAR",
>       "t1#ftx4",
>       "ShortText",
>       [
>       ]
>     ],
>     [
>       267,
>       "index",
>       "d1.mrn.000010B",
>       "index",
>       "COLUMN_INDEX|WITH_POSITION|PERSISTENT",
>       "t1#ftx4",
>       "t1",
>       [
>       ]
>     ]
>   ]
> 
> insertファイル:
>   内容:insert(bulk)文
>   容量:それぞれ11MB~35MB、計870MB
>   行数:各10万行、計420万行弱
> 
> 主なmrnファイル:※()内はサフィックス
> ・d1.mrn.0000109 <tel:0000109>(.001, .002, .003, 004):計4.8GB
> ・d1.mrn.000010A:12MB
> ・d1.mrn.000010B(.C):490MB
> 
> ibdファイル:
> ・t1.ibd:4GB ※B-Treeインデックスでかなり増加してます。
> 
> フルテキストインデックス作成対象のカラムサイズ:
> ・420万行(全体):420MB
> ・360万行(エラー発生付近):350MB 
> 
> 
> 以上
> 
> 
> 
> _______________________________________________
> groonga-dev mailing list
> groon****@lists*****
> https://lists.osdn.me/mailman/listinfo/groonga-dev
> 




groonga-dev メーリングリストの案内
Back to archive index