svnno****@sourc*****
svnno****@sourc*****
2007年 12月 12日 (水) 11:30:23 JST
Revision: 55 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=tritonn&view=rev&rev=55 Author: mir Date: 2007-12-12 11:30:23 +0900 (Wed, 12 Dec 2007) Log Message: ----------- bugfix: SHOW CREATE TABLE and mysqldump don't return senna_flags and initial_n_segments information. Modified Paths: -------------- mysql-5.0.51-tritonn-1.0.8/mysql-test/suite/senna/r/senna_create.result mysql-5.0.51-tritonn-1.0.8/mysql-test/suite/senna/t/senna_create.test mysql-5.0.51-tritonn-1.0.8/sql/ha_myisam.cc mysql-5.0.51-tritonn-1.0.8/sql/sql_show.cc mysql-5.0.51-tritonn-1.0.8/sql/structs.h Modified: mysql-5.0.51-tritonn-1.0.8/mysql-test/suite/senna/r/senna_create.result =================================================================== --- mysql-5.0.51-tritonn-1.0.8/mysql-test/suite/senna/r/senna_create.result 2007-12-11 04:47:24 UTC (rev 54) +++ mysql-5.0.51-tritonn-1.0.8/mysql-test/suite/senna/r/senna_create.result 2007-12-12 02:30:23 UTC (rev 55) @@ -213,3 +213,31 @@ Table Key_name Column_name Encoding Index_type Sectionalize Normalize Split_alpha Split_digit Split_symbol Initial_n_segments Senna_keys_size Senna_keys_file_size Senna_lexicon_size Senna_lexicon_file_size Senna_inv_seg_size Senna_inv_chunk_size t1 ft c1 utf8 DELIMITED OFF ON OFF OFF OFF 512 0 4268032 0 4268032 167936 135168 DROP TABLE t1; +CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT, c3 INT, c4 TEXT, c5 TEXT) DEFAULT CHARSET utf8; +CREATE INDEX c2 ON t1(c2); +CREATE FULLTEXT INDEX ft1 ON t1(c4); +CREATE FULLTEXT INDEX ft2 USING NGRAM, SECTIONALIZE, 64 ON t1(c5); +CREATE FULLTEXT INDEX ft3 USING DELIMITED, NO NORMALIZE, 128 ON t1(c5); +CREATE FULLTEXT INDEX ft4 USING SPLIT_ALPHA, SPLIT_DIGIT, SPLIT_SYMBOL, 48 ON t1(c5); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL, + `c2` int(11) default NULL, + `c3` int(11) default NULL, + `c4` text, + `c5` text, + PRIMARY KEY (`c1`), + KEY `c2` (`c2`), + FULLTEXT KEY `ft1` USING NGRAM, NORMALIZE, 512 (`c4`), + FULLTEXT KEY `ft2` USING NGRAM, NORMALIZE, SECTIONALIZE, 64 (`c5`), + FULLTEXT KEY `ft3` USING DELIMITED, NO NORMALIZE, 128 (`c5`), + FULLTEXT KEY `ft4` USING NGRAM, NORMALIZE, SPLIT_ALPHA, SPLIT_DIGIT, SPLIT_SYMBOL, 48 (`c5`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 +SHOW SENNA STATUS; +Table Key_name Column_name Encoding Index_type Sectionalize Normalize Split_alpha Split_digit Split_symbol Initial_n_segments Senna_keys_size Senna_keys_file_size Senna_lexicon_size Senna_lexicon_file_size Senna_inv_seg_size Senna_inv_chunk_size +t1 ft1 c4 utf8 NGRAM OFF ON OFF OFF OFF 512 0 4268032 0 4268032 167936 135168 +t1 ft2 c5 utf8 NGRAM ON ON OFF OFF OFF 64 0 4268032 0 4268032 139264 20480 +t1 ft3 c5 utf8 DELIMITED OFF OFF OFF OFF OFF 128 0 4268032 0 4268032 143360 36864 +t1 ft4 c5 utf8 NGRAM OFF ON ON ON ON 48 0 4268032 0 4268032 135168 16384 +DROP TABLE t1; Modified: mysql-5.0.51-tritonn-1.0.8/mysql-test/suite/senna/t/senna_create.test =================================================================== --- mysql-5.0.51-tritonn-1.0.8/mysql-test/suite/senna/t/senna_create.test 2007-12-11 04:47:24 UTC (rev 54) +++ mysql-5.0.51-tritonn-1.0.8/mysql-test/suite/senna/t/senna_create.test 2007-12-12 02:30:23 UTC (rev 55) @@ -218,3 +218,16 @@ CREATE TABLE t1 (c1 TEXT, FULLTEXT INDEX ft USING DELIMITED (c1)) DEFAULT CHARSET utf8; SHOW SENNA STATUS; DROP TABLE t1; + +# bugfix: show create table doesn't return senna_flags and ins +CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT, c3 INT, c4 TEXT, c5 TEXT) DEFAULT CHARSET utf8; +CREATE INDEX c2 ON t1(c2); +CREATE FULLTEXT INDEX ft1 ON t1(c4); +CREATE FULLTEXT INDEX ft2 USING NGRAM, SECTIONALIZE, 64 ON t1(c5); +CREATE FULLTEXT INDEX ft3 USING DELIMITED, NO NORMALIZE, 128 ON t1(c5); +CREATE FULLTEXT INDEX ft4 USING SPLIT_ALPHA, SPLIT_DIGIT, SPLIT_SYMBOL, 48 ON t1(c5); +SHOW CREATE TABLE t1; +SHOW SENNA STATUS; +DROP TABLE t1; + + Modified: mysql-5.0.51-tritonn-1.0.8/sql/ha_myisam.cc =================================================================== --- mysql-5.0.51-tritonn-1.0.8/sql/ha_myisam.cc 2007-12-11 04:47:24 UTC (rev 54) +++ mysql-5.0.51-tritonn-1.0.8/sql/ha_myisam.cc 2007-12-12 02:30:23 UTC (rev 55) @@ -1723,6 +1723,7 @@ MI_KEYDEF *mi_keydef = &file->s->keyinfo[i]; sen_index *senna = mi_keydef->senna; if (senna) { + key->is_senna = true; key->senna_flags = mi_keydef->senna_flags; key->senna_initial_n_segments = mi_keydef->senna_initial_n_segments; key->senna_keys_size = mi_keydef->senna_keys_size; @@ -1733,7 +1734,8 @@ key->senna_inv_chunk_size = mi_keydef->senna_inv_chunk_size; key->senna_encoding = senna_enc_mysql(mi_keydef->senna_encoding); - } + } else + key->senna_flags = false; } } #endif /* ENABLE_SENNA */ @@ -1833,7 +1835,12 @@ void ha_myisam::update_create_info(HA_CREATE_INFO *create_info) { +#ifdef ENABLE_SENNA + ha_myisam::info(HA_STATUS_AUTO | HA_STATUS_CONST | + HA_STATUS_VARIABLE | HA_STATUS_SENNA); +#else ha_myisam::info(HA_STATUS_AUTO | HA_STATUS_CONST); +#endif if (!(create_info->used_fields & HA_CREATE_USED_AUTO)) { create_info->auto_increment_value=auto_increment_value; Modified: mysql-5.0.51-tritonn-1.0.8/sql/sql_show.cc =================================================================== --- mysql-5.0.51-tritonn-1.0.8/sql/sql_show.cc 2007-12-11 04:47:24 UTC (rev 54) +++ mysql-5.0.51-tritonn-1.0.8/sql/sql_show.cc 2007-12-12 02:30:23 UTC (rev 55) @@ -29,6 +29,7 @@ #endif #ifdef ENABLE_SENNA +#define SECTIONALIZE 0x00080000 #ifdef HAVE_ISAM #include "ha_myisam.h" // For isam #endif @@ -1005,6 +1006,45 @@ !(key_info->flags & HA_SPATIAL)) packet->append(STRING_WITH_LEN(" USING RTREE")); +#ifdef ENABLE_SENNA + { + char ins[32]; + char *insp; + int inslen; + if (key_info->is_senna) + { + if (key_info->senna_flags & SEN_INDEX_NGRAM) + packet->append(STRING_WITH_LEN(" USING NGRAM")); + else if (key_info->senna_flags & SEN_INDEX_DELIMITED) + packet->append(STRING_WITH_LEN(" USING DELIMITED")); + else + packet->append(STRING_WITH_LEN(" USING MECAB")); + + if (key_info->senna_flags & SEN_INDEX_NORMALIZE) + packet->append(STRING_WITH_LEN(", NORMALIZE")); + else + packet->append(STRING_WITH_LEN(", NO NORMALIZE")); + + if (key_info->senna_flags & SECTIONALIZE) + packet->append(STRING_WITH_LEN(", SECTIONALIZE")); + + if (key_info->senna_flags & SEN_INDEX_SPLIT_ALPHA) + packet->append(STRING_WITH_LEN(", SPLIT_ALPHA")); + if (key_info->senna_flags & SEN_INDEX_SPLIT_DIGIT) + packet->append(STRING_WITH_LEN(", SPLIT_DIGIT")); + if (key_info->senna_flags & SEN_INDEX_SPLIT_SYMBOL) + packet->append(STRING_WITH_LEN(", SPLIT_SYMBOL")); + + /* TODO: initial_n_segments support */ + my_snprintf(ins, sizeof(ins), ", %d",key_info->senna_initial_n_segments); + inslen = strlen(ins); + insp = sql_alloc(inslen); + memcpy(insp, ins, inslen); + packet->append(insp, inslen); + } + } +#endif + // No need to send USING FULLTEXT, it is sent as FULLTEXT KEY } packet->append(STRING_WITH_LEN(" (")); @@ -4452,7 +4492,6 @@ #endif #ifdef ENABLE_SENNA -#define SECTIONALIZE 0x00080000 bool senna_show_status(THD *thd, LEX *lex) { List<char> files; Modified: mysql-5.0.51-tritonn-1.0.8/sql/structs.h =================================================================== --- mysql-5.0.51-tritonn-1.0.8/sql/structs.h 2007-12-11 04:47:24 UTC (rev 54) +++ mysql-5.0.51-tritonn-1.0.8/sql/structs.h 2007-12-12 02:30:23 UTC (rev 55) @@ -105,6 +105,7 @@ } handler; struct st_table *table; #ifdef ENABLE_SENNA + bool is_senna; /* this is set to true by ha_myisam::info */ int senna_flags; int senna_initial_n_segments; uint senna_keys_size;