[groonga-dev,00890] Re: mroonga 2.02クラッシュ

Back to archive index

Kouhei Sutou kou****@clear*****
2012年 5月 21日 (月) 10:06:56 JST


須藤です。

In <20120****@gmo-m*****>
  "[groonga-dev,00889] Re: mroonga 2.02クラッシュ" on Fri, 18 May 2012 17:53:23 +0900,
  河野 隆志 <takas****@gmo-m*****> wrote:

> REPLACEやUPDATE文は現在修正中ですが、並行して色々試してたら
> 別の問題が出てきました。

おぉ。。。

> 例のテーブルに通常のマルチカラムインデックスを作成しようとしたところ、
> 下記エラーがでて作成できませんでした。
> mroogna> ALTER TABLE table_name ADD KEY `index_name` (`rdate`,`gs_id`,`flag5`);
> ERROR 1169 (23000): Can't write, because of unique constraint, to table 'table_name'
> 
> 定義は変えずに空のテーブルで試すとOKで、StorageEngineをInnoDBに
> したテーブルで試してもOKで、StorageEngineがmroongaで、
> 既にデータが入っている場合はNGという感じです。

前に教えていただいた情報を元に以下のように試してみたのですが、
こちらでは再現しませんでした。。。
もしかして、この「すでにデータが入っている場合」というのは、
「何かしらデータが入っている場合」ということではなく、「すで
に壊れている状態」ということでしょうか?(であれば、私の再現
手順は間違っています。)

  mysql> CREATE TABLE `table_name` (
      ->   `id` bigint(20) NOT NULL AUTO_INCREMENT,
      ->   `gs_id` tinyint(4) NOT NULL,
      ->   `s_id` int(11) NOT NULL,
      ->   `type` varchar(16) NOT NULL,
      ->   `width` int(11) NOT NULL,
      ->   `height` int(11) NOT NULL,
      ->   `size` int(11) NOT NULL,
      ->   `hash` varchar(64) NOT NULL,
      ->   `title` varchar(255) NOT NULL,
      ->   `fname` varchar(81) NOT NULL,
      ->   `eaddr` varchar(255) DEFAULT NULL,
      ->   `rdate` datetime NOT NULL,
      ->   `udate` datetime NOT NULL,
      ->   `flag1` tinyint(4) DEFAULT '0',
      ->   `flag2` tinyint(4) DEFAULT '0',
      ->   `flag3` tinyint(4) DEFAULT '0',
      ->   `flag4` tinyint(4) DEFAULT '0',
      ->   `flag5` tinyint(4) DEFAULT '0',
      ->   `flag6` tinyint(4) DEFAULT '0',
      ->   `flag7` tinyint(4) DEFAULT '0',
      ->   `flag8` tinyint(4) DEFAULT '0',
      ->   `flag9` tinyint(4) DEFAULT '0',
      ->   `flag10` tinyint(4) DEFAULT '0',
      ->   `score1` int(11) DEFAULT '0',
      ->   `score2` int(11) DEFAULT '0',
      ->   `score3` int(11) DEFAULT '0',
      ->   `score4` int(11) DEFAULT '0',
      ->   `score5` int(11) DEFAULT '0',
      ->   `score6` int(11) DEFAULT '0',
      ->   `score7` int(11) DEFAULT '0',
      ->   `score8` int(11) DEFAULT '0',
      ->   `score9` int(11) DEFAULT '0',
      ->   `score10` int(11) DEFAULT '0',
      ->   `tags` varchar(255) DEFAULT NULL,
      ->   `text` text,
      ->   `server` tinyint(4) NOT NULL,
      ->   `dir` tinyint(4) NOT NULL,
      ->   `uid` varchar(255) NOT NULL,
      ->   PRIMARY KEY (`id`),
      ->   KEY `index1` (`fname`),
      ->   KEY `index2` (`rdate`,`gs_id`,`flag5`),
      ->   KEY `index3` (`s_id`,`gs_id`,`rdate`),
      ->   FULLTEXT KEY `fu_index1` (`title`,`tags`,`text`)
      -> ) ENGINE=mroonga DEFAULT CHARSET=utf8;
  Query OK, 0 rows affected (1.87 sec)

  mysql> REPLACE INTO
      ->  table_name (
      ->   id,
      ->   gs_id,
      ->   s_id,
      ->   type,
      ->   width,
      ->   height,
      ->   size,
      ->   hash,
      ->   title,
      ->   fname,
      ->   eaddr,
      ->   rdate,
      ->   udate,
      ->   flag2,
      ->   flag5,
      ->   score5,
      ->   tags,
      ->   dir,
      ->   uid,
      ->   server)
      -> VALUES (
      ->   '12345678',
      ->   '1',
      ->   '123456',
      ->   'jpeg',
      ->   '120',
      ->   '120',
      ->   '12345',
      ->   'hashhashhashhashhashhashhashhashhashhashhashhashhas',
      ->   '河野隆志',
      ->   'ja',
      ->   'takas****@gmo-m*****',
      ->   '2012-05-05 13:25:46',
      ->   NOW(),
      ->   '1',
      ->   '0',
      ->   '1',
      ->   '',
      ->   '0',
      ->   'kawano2012',
      ->   0);
  Query OK, 1 row affected (0.01 sec)

  mysql> SELECT COUNT(*) FROM table_name;
  +----------+
  | COUNT(*) |
  +----------+
  |        1 |
  +----------+
  1 row in set (0.00 sec)

  mysql> ALTER TABLE table_name ADD KEY `index_name` (`rdate`,`gs_id`,`flag5`);
  Query OK, 0 rows affected (0.20 sec)
  Records: 0  Duplicates: 0  Warnings: 0

> 文面からみてユニーク制約関連ぽいのでUNIQUE KEYでマルチカラムインデックス
> をALTER TABLEで張ろうとしたところ、エラーが出ないのですが、例のクラッシュ
> が100%発生します。

とすると、これが再現できれば解決に繋がりそうです!

> 既にデータがあるテーブルにマルチカラムインデックスが張れないのはバグ?
> なんでしょうか?

いえ、張れるはずです。
こちらの再現手順と何が違うのかしら。。。


-- 
須藤 功平 <kou****@clear*****>
株式会社クリアコード <http://www.clear-code.com/> (03-6231-7270)

groongaサポート:
  http://groonga.org/ja/support/
プログラミングが好きなソフトウェア開発者を募集中:
  http://www.clear-code.com/recruitment/




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