BUG#23196 - MySQL server does not exit / shutdown when

            storage engine returns errno 12

If there is not enough memory to store or update blob record
(while allocating record buffer), myisam marks table as crashed.

With this fix myisam attempts to roll an index back and return
an error, not marking a table as crashed.

Affects myisam tables with blobs only. No test case for this fix.
parent 24c7b22b
...@@ -81,7 +81,7 @@ int _mi_write_blob_record(MI_INFO *info, const byte *record) ...@@ -81,7 +81,7 @@ int _mi_write_blob_record(MI_INFO *info, const byte *record)
#endif #endif
if (!(rec_buff=(byte*) my_alloca(reclength))) if (!(rec_buff=(byte*) my_alloca(reclength)))
{ {
my_errno=ENOMEM; my_errno= HA_ERR_OUT_OF_MEM; /* purecov: inspected */
return(-1); return(-1);
} }
reclength2= _mi_rec_pack(info,rec_buff+ALIGN_SIZE(MI_MAX_DYN_BLOCK_HEADER), reclength2= _mi_rec_pack(info,rec_buff+ALIGN_SIZE(MI_MAX_DYN_BLOCK_HEADER),
...@@ -115,7 +115,7 @@ int _mi_update_blob_record(MI_INFO *info, my_off_t pos, const byte *record) ...@@ -115,7 +115,7 @@ int _mi_update_blob_record(MI_INFO *info, my_off_t pos, const byte *record)
#endif #endif
if (!(rec_buff=(byte*) my_alloca(reclength))) if (!(rec_buff=(byte*) my_alloca(reclength)))
{ {
my_errno=ENOMEM; my_errno= HA_ERR_OUT_OF_MEM; /* purecov: inspected */
return(-1); return(-1);
} }
reclength=_mi_rec_pack(info,rec_buff+ALIGN_SIZE(MI_MAX_DYN_BLOCK_HEADER), reclength=_mi_rec_pack(info,rec_buff+ALIGN_SIZE(MI_MAX_DYN_BLOCK_HEADER),
......
...@@ -193,7 +193,8 @@ err: ...@@ -193,7 +193,8 @@ err:
save_errno=my_errno; save_errno=my_errno;
if (changed) if (changed)
key_changed|= HA_STATE_CHANGED; key_changed|= HA_STATE_CHANGED;
if (my_errno == HA_ERR_FOUND_DUPP_KEY || my_errno == HA_ERR_RECORD_FILE_FULL) if (my_errno == HA_ERR_FOUND_DUPP_KEY || my_errno == HA_ERR_OUT_OF_MEM ||
my_errno == HA_ERR_RECORD_FILE_FULL)
{ {
info->errkey= (int) i; info->errkey= (int) i;
flag=0; flag=0;
......
...@@ -164,7 +164,7 @@ int mi_write(MI_INFO *info, byte *record) ...@@ -164,7 +164,7 @@ int mi_write(MI_INFO *info, byte *record)
err: err:
save_errno=my_errno; save_errno=my_errno;
if (my_errno == HA_ERR_FOUND_DUPP_KEY || my_errno == HA_ERR_RECORD_FILE_FULL || if (my_errno == HA_ERR_FOUND_DUPP_KEY || my_errno == HA_ERR_RECORD_FILE_FULL ||
my_errno == HA_ERR_NULL_IN_SPATIAL) my_errno == HA_ERR_NULL_IN_SPATIAL || my_errno == HA_ERR_OUT_OF_MEM)
{ {
if (info->bulk_insert) if (info->bulk_insert)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment