Tomotaka Ogino
tomot****@yo*****
2014年 8月 6日 (水) 21:34:07 JST
荻野と申します。groonga は 1.2.9 の頃から愛用させて頂いております。 groonga HTTP デーモン(groonga-server-http)が起動している状況で、 コマンドラインからテーブルの削除・作成を行うと HTTP インタフェース経由のアクセス時に不思議な動作(カラム名がずれる)を することがあるようですので報告させて頂きます。 ○再現手順 1. 適当なフォルダでデータベースを作成し、groonga HTTP デーモンを起動します。 % mkdir ./foobar/ % /usr/local/bin/groonga -n ./foobar/foobar.db status % /usr/local/bin/groonga -p 10041 -d --protocol http ./foobar/foobar.db 2. コマンドラインの groonga でテーブルとカラムを作成します。 % /usr/local/bin/groonga ./foobar/foobar.db table_create --name FooBar --flags TABLE_HASH_KEY --key_type ShortText % /usr/local/bin/groonga ./foobar/foobar.db column_create --table FooBar --name columnShortText --flags COLUMN_SCALAR --type ShortText % /usr/local/bin/groonga ./foobar/foobar.db column_create --table FooBar --name columnLongText --flags COLUMN_SCALAR --type LongText % /usr/local/bin/groonga ./foobar/foobar.db column_create --table FooBar --name columnUInt32 --flags COLUMN_SCALAR --type UInt32 3. HTTP 経由でカラム一覧を取得します。 % curl 'http://localhost:10041/d/column_list?table=FooBar' 4. コマンドラインの groonga でテーブルをいったん削除し、再作成します。 % /usr/local/bin/groonga ./foobar/foobar.db table_remove FooBar (2. のテーブル・カラム作成コマンドもここで実行します) 5. 再度 HTTP 経由でカラム一覧を取得します。 % curl 'http://localhost:10041/d/column_list?table=FooBar' このとき、3. の出力結果は以下の通りとなりますが、 (見やすくするため整形しています) [ [0,1407325924.40451,0.000756740570068359], [ [["id","UInt32"],["name","ShortText"],["path","ShortText"],["type","ShortText"],["flags","ShortText"],["domain","ShortText"],["range","ShortText"],["source","ShortText"]], [256,"_key","","","COLUMN_SCALAR","FooBar","ShortText",[]], [258,"columnLongText","./foobar/foobar.db.0000102","var","COLUMN_SCALAR|PERSISTENT","FooBar","LongText",[]], [257,"columnShortText","./foobar/foobar.db.0000101","var","COLUMN_SCALAR|PERSISTENT","FooBar","ShortText",[]], [259,"columnUInt32","./foobar/foobar.db.0000103","fix","COLUMN_SCALAR|PERSISTENT","FooBar","UInt32",[]] ] ] 一方 5. の出力結果は以下の通りカラム名(columnLongTextなど)と型(LongTextなど)がずれていて一致しません。 [ [0,1407326040.41752,0.00020146369934082], [ [["id","UInt32"],["name","ShortText"],["path","ShortText"],["type","ShortText"],["flags","ShortText"],["domain","ShortText"],["range","ShortText"],["source","ShortText"]], [256,"_key","","","COLUMN_SCALAR","FooBar","ShortText",[]], [257,"columnLongText","./foobar/foobar.db.0000101","var","COLUMN_SCALAR|PERSISTENT","FooBar","ShortText",[]], [259,"columnShortText","./foobar/foobar.db.0000103","fix","COLUMN_SCALAR|PERSISTENT","FooBar","UInt32",[]], [258,"columnUInt32","./foobar/foobar.db.0000102","var","COLUMN_SCALAR|PERSISTENT","FooBar","LongText",[]] ] ] 上記現象は CentOS 6.5 Final (x64)、groonga-4.0.4 をソースからインストールした状態で確認しました。 なお groonga-httpd では発生しません。 また、発生した場合でも、groonga HTTP デーモンを立ち上げ直せば解消します。 % curl 'http://localhost:10041/d/shutdown' % /usr/local/bin/groonga -p 10041 -d --protocol http ./foobar/foobar.db groonga HTTP デーモンを起動しない状態でテーブル等を作成し、 その後 groonga HTTP デーモンを起動した時も問題ありませんでした。 同様の現象を経験された方はおられますでしょうか。 業務で開発しているシステムで groonga の全文検索のインデックスを作り直す目的で テーブルの削除・再作成を行った所、全文検索ができなくなった問題を調査した中で見つけたのですが、 そもそもその使い方はおかしいやろ、などのご指摘も頂けましたら幸いです。 バグのようなら Redmine に登録させて頂きます。(アカウントの承認お待ちしております) よろしくお願いします。 -- Tomotaka Ogino, Nagaokakyo-city, Kyoto, Japan E-Mail: tomot****@yo*****