#At file:///home/svoj/devel/bzr-mysql/mysql-5.1-bugteam-push/ based on revid:martin.hansson@stripped
3158 Sergey Vojtovich 2009-10-09 [merge]
Merge fix for BUG47073.
modified:
mysql-test/r/myisam.result
mysql-test/t/myisam.test
storage/myisam/ha_myisam.cc
storage/myisam/mi_check.c
storage/myisam/sort.c
=== modified file 'mysql-test/r/myisam.result'
--- a/mysql-test/r/myisam.result 2009-09-21 09:58:15 +0000
+++ b/mysql-test/r/myisam.result 2009-10-09 16:16:29 +0000
@@ -2271,4 +2271,32 @@ checksum table t3;
Table Checksum
test.t3 326284887
drop table t1,t2,t3;
+CREATE TABLE t1(a INT, b CHAR(10), KEY(a), KEY(b));
+INSERT INTO t1 VALUES(1,'0'),(2,'0'),(3,'0'),(4,'0'),(5,'0'),
+(6,'0'),(7,'0');
+INSERT INTO t1 SELECT a+10,b FROM t1;
+INSERT INTO t1 SELECT a+20,b FROM t1;
+INSERT INTO t1 SELECT a+40,b FROM t1;
+INSERT INTO t1 SELECT a+80,b FROM t1;
+INSERT INTO t1 SELECT a+160,b FROM t1;
+INSERT INTO t1 SELECT a+320,b FROM t1;
+INSERT INTO t1 SELECT a+640,b FROM t1;
+INSERT INTO t1 SELECT a+1280,b FROM t1;
+INSERT INTO t1 SELECT a+2560,b FROM t1;
+INSERT INTO t1 SELECT a+5120,b FROM t1;
+SET myisam_sort_buffer_size=4;
+REPAIR TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 repair error myisam_sort_buffer_size is too small
+test.t1 repair warning Number of rows changed from 0 to 7168
+test.t1 repair status OK
+SET myisam_repair_threads=2;
+REPAIR TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 repair error myisam_sort_buffer_size is too small
+test.t1 repair warning Number of rows changed from # to 7168
+test.t1 repair status OK
+SET myisam_repair_threads=@@global.myisam_repair_threads;
+SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
+DROP TABLE t1;
End of 5.1 tests
=== modified file 'mysql-test/t/myisam.test'
--- a/mysql-test/t/myisam.test 2009-09-21 09:58:15 +0000
+++ b/mysql-test/t/myisam.test 2009-10-09 16:16:29 +0000
@@ -1518,5 +1518,33 @@ CREATE TABLE t3 select * from t1;
checksum table t3;
drop table t1,t2,t3;
+
+#
+# BUG#47073 - valgrind errs, corruption,failed repair of partition,
+# low myisam_sort_buffer_size
+#
+CREATE TABLE t1(a INT, b CHAR(10), KEY(a), KEY(b));
+INSERT INTO t1 VALUES(1,'0'),(2,'0'),(3,'0'),(4,'0'),(5,'0'),
+ (6,'0'),(7,'0');
+INSERT INTO t1 SELECT a+10,b FROM t1;
+INSERT INTO t1 SELECT a+20,b FROM t1;
+INSERT INTO t1 SELECT a+40,b FROM t1;
+INSERT INTO t1 SELECT a+80,b FROM t1;
+INSERT INTO t1 SELECT a+160,b FROM t1;
+INSERT INTO t1 SELECT a+320,b FROM t1;
+INSERT INTO t1 SELECT a+640,b FROM t1;
+INSERT INTO t1 SELECT a+1280,b FROM t1;
+INSERT INTO t1 SELECT a+2560,b FROM t1;
+INSERT INTO t1 SELECT a+5120,b FROM t1;
+SET myisam_sort_buffer_size=4;
+REPAIR TABLE t1;
+SET myisam_repair_threads=2;
+# May report different values depending on threads activity.
+--replace_regex /changed from [0-9]+/changed from #/
+REPAIR TABLE t1;
+SET myisam_repair_threads=@@global.myisam_repair_threads;
+SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
+DROP TABLE t1;
+
--echo End of 5.1 tests
=== modified file 'storage/myisam/ha_myisam.cc'
--- a/storage/myisam/ha_myisam.cc 2009-09-09 15:13:13 +0000
+++ b/storage/myisam/ha_myisam.cc 2009-10-09 16:16:29 +0000
@@ -1087,22 +1087,6 @@ int ha_myisam::repair(THD *thd, MI_CHECK
ha_rows rows= file->state->records;
DBUG_ENTER("ha_myisam::repair");
- /*
- Normally this method is entered with a properly opened table. If the
- repair fails, it can be repeated with more elaborate options. Under
- special circumstances it can happen that a repair fails so that it
- closed the data file and cannot re-open it. In this case file->dfile
- is set to -1. We must not try another repair without an open data
- file. (Bug #25289)
- */
- if (file->dfile == -1)
- {
- sql_print_information("Retrying repair of: '%s' failed. "
- "Please try REPAIR EXTENDED or myisamchk",
- table->s->path.str);
- DBUG_RETURN(HA_ADMIN_FAILED);
- }
-
param.db_name= table->s->db.str;
param.table_name= table->alias;
param.tmpfile_createflag = O_RDWR | O_TRUNC;
=== modified file 'storage/myisam/mi_check.c'
--- a/storage/myisam/mi_check.c 2009-09-28 13:55:01 +0000
+++ b/storage/myisam/mi_check.c 2009-10-09 16:16:29 +0000
@@ -2561,8 +2561,9 @@ err:
VOID(my_close(new_file,MYF(0)));
VOID(my_raid_delete(param->temp_filename,share->base.raid_chunks,
MYF(MY_WME)));
- if (info->dfile == new_file)
- info->dfile= -1;
+ if (info->dfile == new_file) /* Retry with key cache */
+ if (unlikely(mi_open_datafile(info, share, name, -1)))
+ param->retry_repair= 0; /* Safety */
}
mi_mark_crashed_on_repair(info);
}
@@ -3095,8 +3096,9 @@ err:
VOID(my_close(new_file,MYF(0)));
VOID(my_raid_delete(param->temp_filename,share->base.raid_chunks,
MYF(MY_WME)));
- if (info->dfile == new_file)
- info->dfile= -1;
+ if (info->dfile == new_file) /* Retry with key cache */
+ if (unlikely(mi_open_datafile(info, share, name, -1)))
+ param->retry_repair= 0; /* Safety */
}
mi_mark_crashed_on_repair(info);
}
=== modified file 'storage/myisam/sort.c'
--- a/storage/myisam/sort.c 2009-08-28 16:21:54 +0000
+++ b/storage/myisam/sort.c 2009-10-09 16:16:29 +0000
@@ -788,7 +788,11 @@ static int NEAR_F merge_many_buff(MI_SOR
cleanup:
close_cached_file(to_file); /* This holds old result */
if (to_file == t_file)
+ {
*t_file=t_file2; /* Copy result file */
+ t_file->current_pos= &t_file->write_pos;
+ t_file->current_end= &t_file->write_end;
+ }
DBUG_RETURN(*maxbuffer >= MERGEBUFF2); /* Return 1 if interrupted */
} /* merge_many_buff */
Attachment: [text/bzr-bundle] bzr/svoj@sun.com-20091009162121-gn1s5mxqt1zgx9ql.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1-bugteam branch (svoj:3158) | Sergey Vojtovich | 9 Oct |