diff options
author | unknown <serg@serg.mysql.com> | 2002-11-13 22:56:05 +0100 |
---|---|---|
committer | unknown <serg@serg.mysql.com> | 2002-11-13 22:56:05 +0100 |
commit | 3a58dc5a4ecb0cf0f3ed29c9250ba7adec784fae (patch) | |
tree | 94670df30f5f9e20f8b31002c568681aabaf3179 | |
parent | f8680cf00c56a249b51fcc2883b541adab388215 (diff) | |
parent | ffb4dee5a5297cdd7fa27aa87a8f505fbb88515b (diff) | |
download | mariadb-git-3a58dc5a4ecb0cf0f3ed29c9250ba7adec784fae.tar.gz |
Merge work:/home/bk/mysql into serg.mysql.com:/usr/home/serg/Abk/mysql
-rw-r--r-- | mysql-test/r/myisam.result | 4 | ||||
-rw-r--r-- | mysql-test/t/myisam.test | 40 | ||||
-rw-r--r-- | sql/ha_myisam.cc | 12 |
3 files changed, 54 insertions, 2 deletions
diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index f57b99cf9fd..31478f14c93 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -38,3 +38,7 @@ table type possible_keys key key_len ref rows Extra t1 ALL NULL NULL NULL NULL 4 Table Op Msg_type Msg_text test.t1 optimize status OK +Table Op Msg_type Msg_text +test.t1 optimize status OK +Table Op Msg_type Msg_text +test.t1 check status OK diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index 07fee2cf64f..92f22d35b81 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -76,6 +76,46 @@ OPTIMIZE TABLE t1; DROP TABLE t1; # +# Test of optimize, when only mi_sort_index (but not mi_repair*) is done +# in ha_myisam::repair, and index size is changed (decreased). +# + +drop table if exists t1; +create table t1 ( t1 char(255), key(t1(250))); +insert t1 values ('137513751375137513751375137513751375137569516951695169516951695169516951695169'); +insert t1 values ('178417841784178417841784178417841784178403420342034203420342034203420342034203'); +insert t1 values ('213872387238723872387238723872387238723867376737673767376737673767376737673767'); +insert t1 values ('242624262426242624262426242624262426242607890789078907890789078907890789078907'); +insert t1 values ('256025602560256025602560256025602560256011701170117011701170117011701170117011'); +insert t1 values ('276027602760276027602760276027602760276001610161016101610161016101610161016101'); +insert t1 values ('281528152815281528152815281528152815281564956495649564956495649564956495649564'); +insert t1 values ('292129212921292129212921292129212921292102100210021002100210021002100210021002'); +insert t1 values ('380638063806380638063806380638063806380634483448344834483448344834483448344834'); +insert t1 values ('411641164116411641164116411641164116411616301630163016301630163016301630163016'); +insert t1 values ('420842084208420842084208420842084208420899889988998899889988998899889988998899'); +insert t1 values ('438443844384438443844384438443844384438482448244824482448244824482448244824482'); +insert t1 values ('443244324432443244324432443244324432443239613961396139613961396139613961396139'); +insert t1 values ('485448544854485448544854485448544854485477847784778477847784778477847784778477'); +insert t1 values ('494549454945494549454945494549454945494555275527552755275527552755275527552755'); +insert t1 values ('538647864786478647864786478647864786478688918891889188918891889188918891889188'); +insert t1 values ('565556555655565556555655565556555655565554845484548454845484548454845484548454'); +insert t1 values ('607860786078607860786078607860786078607856665666566656665666566656665666566656'); +insert t1 values ('640164016401640164016401640164016401640141274127412741274127412741274127412741'); +insert t1 values ('719471947194719471947194719471947194719478717871787178717871787178717871787178'); +insert t1 values ('742574257425742574257425742574257425742549604960496049604960496049604960496049'); +insert t1 values ('887088708870887088708870887088708870887035963596359635963596359635963596359635'); +insert t1 values ('917791779177917791779177917791779177917773857385738573857385738573857385738573'); +insert t1 values ('933293329332933293329332933293329332933278987898789878987898789878987898789878'); +insert t1 values ('963896389638963896389638963896389638963877807780778077807780778077807780778077'); +delete from t1 where t1>'2'; +insert t1 values ('70'), ('84'), ('60'), ('20'), ('76'), ('89'), ('49'), ('50'), +('88'), ('61'), ('42'), ('98'), ('39'), ('30'), ('25'), ('66'), ('61'), ('48'), +('80'), ('84'), ('98'), ('19'), ('91'), ('42'), ('47'); +optimize table t1; +check table t1; +drop table t1; + +# # test of myisam with huge number of packed fields # diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index c14ca7d034e..f96781f83b4 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -561,7 +561,6 @@ int ha_myisam::repair(THD *thd, MI_CHECK ¶m, bool optimize) } if (!optimize || - memcmp(file->state, & share->state.state, sizeof(MI_STATUS_INFO)) || ((file->state->del || share->state.split != file->state->records) && (!param.opt_rep_quick || !(share->state.changed & STATE_NOT_OPTIMIZED_KEYS)))) @@ -618,7 +617,16 @@ int ha_myisam::repair(THD *thd, MI_CHECK ¶m, bool optimize) STATE_CRASHED_ON_REPAIR); file->update|=HA_STATE_CHANGED | HA_STATE_ROW_CHANGED; } - file->save_state=file->s->state.state; + /* Here we need to make file->save_state and file->s->state.state + equal. Unfortunately, sometime table comes locked here (so + file->save_state represents actual table state), and sometime + unlocked (and actual is file->s->state.state instead). This all + is very confusing, and should be streamlined (TODO). + */ + if (file->state == & file->save_state) + file->s->state.state=file->save_state; + else + file->save_state=file->s->state.state; if (file->s->base.auto_key) update_auto_increment_key(¶m, file, 1); if (optimize_done) |