diff options
author | Anurag Shekhar <anurag.shekhar@sun.com> | 2009-03-04 14:48:07 +0530 |
---|---|---|
committer | Anurag Shekhar <anurag.shekhar@sun.com> | 2009-03-04 14:48:07 +0530 |
commit | aa13f72b9083f9a5abe80f4fddd0e2259cea8580 (patch) | |
tree | d25340ee73462531e64ce48b206680b6342c3d1c /storage | |
parent | 16c0631f0b785e82aef63429b5a4e7179b8aa52e (diff) | |
download | mariadb-git-aa13f72b9083f9a5abe80f4fddd0e2259cea8580.tar.gz |
Bug#41305 server crashes when inserting duplicate row into a merge table
This problem comes while inserting a duplicate row in merge table
without key but the child table has a primary key.
While forming the error message handler tries to locate the key field
which is creating this problem but as there is no key on the merge
table there is a segmentation fault.
mysql-test/r/merge.result:
Updated results with new test for this bug.
mysql-test/t/merge.test:
Added new test to test error generated from a key on child table
where merge table doesn't have any key.
storage/myisammrg/ha_myisammrg.cc:
Added a new check to see if the value of error key is higher than
the number of key in merge table and if it is the error key set
to MAX_KEY. The error message generation routine treats MAX_KEY as
unknown key and doesn't tries to access this in key_info.
Diffstat (limited to 'storage')
-rw-r--r-- | storage/myisammrg/ha_myisammrg.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc index d674f6bc150..5bd7c7dd05c 100644 --- a/storage/myisammrg/ha_myisammrg.cc +++ b/storage/myisammrg/ha_myisammrg.cc @@ -872,6 +872,16 @@ int ha_myisammrg::info(uint flag) table->s->crashed= 1; #endif stats.data_file_length= mrg_info.data_file_length; + if (mrg_info.errkey >= table_share->keys) + { + /* + If value of errkey is higher than the number of keys + on the table set errkey to MAX_KEY. This will be + treated as unknown key case and error message generator + won't try to locate key causing segmentation fault. + */ + mrg_info.errkey= MAX_KEY; + } errkey= mrg_info.errkey; table->s->keys_in_use.set_prefix(table->s->keys); stats.mean_rec_length= mrg_info.reclength; |