diff options
author | unknown <svoj@mysql.com/april.(none)> | 2006-10-06 15:17:42 +0500 |
---|---|---|
committer | unknown <svoj@mysql.com/april.(none)> | 2006-10-06 15:17:42 +0500 |
commit | 47a70282f91fed6dfae77d5d0e5ce3424cfb6c1d (patch) | |
tree | 1d07a23c9ac38257e56b6a6f7c66b94aadd50e68 /sql/ha_myisammrg.cc | |
parent | 9076d70e5b6a73b9280b198382764849904c7f6f (diff) | |
download | mariadb-git-47a70282f91fed6dfae77d5d0e5ce3424cfb6c1d.tar.gz |
BUG#22937 - Valgrind failure in 'merge' test (ha_myisammrg.cc:329)
This is addition to fix for bug21617. Valgrind reports an error when
opening merge table that has underlying tables with less indexes than
in a merge table itself.
Copy at most min(file->keys, table->key_parts) elements from rec_per_key array.
This fixes problems when merge table and subtables have different number of keys.
sql/ha_myisammrg.cc:
Copy at most min(file->keys, table->key_parts) elements from rec_per_key array.
This fixes problems when merge table and subtables have different number of keys.
Diffstat (limited to 'sql/ha_myisammrg.cc')
-rw-r--r-- | sql/ha_myisammrg.cc | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc index edb3521470f..3408f7090f2 100644 --- a/sql/ha_myisammrg.cc +++ b/sql/ha_myisammrg.cc @@ -249,9 +249,22 @@ void ha_myisammrg::info(uint flag) if (flag & HA_STATUS_CONST) { if (table->key_parts && info.rec_per_key) + { +#ifdef HAVE_purify + /* + valgrind may be unhappy about it, because optimizer may access values + between file->keys and table->key_parts, that will be uninitialized. + It's safe though, because even if opimizer will decide to use a key + with such a number, it'll be an error later anyway. + */ + bzero((char*) table->key_info[0].rec_per_key, + sizeof(table->key_info[0].rec_per_key) * table->key_parts); +#endif memcpy((char*) table->key_info[0].rec_per_key, (char*) info.rec_per_key, - sizeof(table->key_info[0].rec_per_key)*table->key_parts); + sizeof(table->key_info[0].rec_per_key) * + min(file->keys, table->key_parts)); + } } } |