summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorMattias Jonsson <mattias.jonsson@sun.com>2009-08-21 17:38:29 +0200
committerMattias Jonsson <mattias.jonsson@sun.com>2009-08-21 17:38:29 +0200
commita4e832d69d0ff3301c9ba631bbbaa091c7d18187 (patch)
treee442e8440551a156fee2ed3c9a84e26953cdccf8 /storage
parent2dc7c5c8e758e492b8b56325a14b462e863723ac (diff)
downloadmariadb-git-a4e832d69d0ff3301c9ba631bbbaa091c7d18187.tar.gz
Bug#46639: 1030 (HY000): Got error 124 from storage engine on
INSERT ... SELECT ... Problem was that when bulk insert is used on an empty table/partition, it disables the indexes for better performance, but in this specific case it also tries to read from that partition using an index, which is not possible since it has been disabled. Solution was to allow index reads on disabled indexes if there are no records. Also reverted the patch for bug#38005, since that was a workaround in the partitioning engine instead of a fix in myisam. mysql-test/r/partition.result: Bug#46639: 1030 (HY000): Got error 124 from storage engine on INSERT ... SELECT ... updated result file mysql-test/t/partition.test: Bug#46639: 1030 (HY000): Got error 124 from storage engine on INSERT ... SELECT ... Added testcase sql/ha_partition.cc: Bug#46639: 1030 (HY000): Got error 124 from storage engine on INSERT ... SELECT ... reverted the patch for bug#38005, since that was a workaround around this problem, not needed after fixing it in myisam. storage/myisam/mi_search.c: Bug#46639: 1030 (HY000): Got error 124 from storage engine on INSERT ... SELECT ... Return HA_ERR_END_OF_FILE instead of HA_ERR_WRONG_INDEX when there are no rows.
Diffstat (limited to 'storage')
-rw-r--r--storage/myisam/mi_search.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/storage/myisam/mi_search.c b/storage/myisam/mi_search.c
index 1dd6c6b5f0d..766e54bde30 100644
--- a/storage/myisam/mi_search.c
+++ b/storage/myisam/mi_search.c
@@ -28,9 +28,15 @@ int _mi_check_index(MI_INFO *info, int inx)
{
if (inx == -1) /* Use last index */
inx=info->lastinx;
- if (inx < 0 || ! mi_is_key_active(info->s->state.key_map, inx))
+ if (inx < 0)
{
- my_errno=HA_ERR_WRONG_INDEX;
+ my_errno= HA_ERR_WRONG_INDEX;
+ return -1;
+ }
+ if (!mi_is_key_active(info->s->state.key_map, inx))
+ {
+ my_errno= info->s->state.state.records ? HA_ERR_WRONG_INDEX :
+ HA_ERR_END_OF_FILE;
return -1;
}
if (info->lastinx != inx) /* Index changed */