diff options
author | Sergei Golubchik <sergii@pisem.net> | 2013-04-09 15:49:21 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2013-04-09 15:49:21 +0200 |
commit | 2481db063f5262860a8c98635167b55b2ea73e20 (patch) | |
tree | 82ce0687b498f1d48e7791604a431d777dc79f4e /storage/archive | |
parent | 07b252391811d20a6ddd49bac9492257048e8ed6 (diff) | |
download | mariadb-git-2481db063f5262860a8c98635167b55b2ea73e20.tar.gz |
move writing of the frm into init_from_binary_frm_image()
Diffstat (limited to 'storage/archive')
-rw-r--r-- | storage/archive/ha_archive.cc | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc index 37b1273b65d..0de26f37796 100644 --- a/storage/archive/ha_archive.cc +++ b/storage/archive/ha_archive.cc @@ -281,7 +281,7 @@ int archive_discover(handlerton *hton, THD* thd, TABLE_SHARE *share) strxmov(az_file, share->normalized_path.str, ARZ, NullS); if (!(mysql_file_stat(/* arch_key_file_data */ 0, az_file, &file_stat, MYF(0)))) - goto err; + DBUG_RETURN(HA_ERR_NO_SUCH_TABLE); if (!(azopen(&frm_stream, az_file, O_RDONLY|O_BINARY))) { @@ -293,21 +293,23 @@ int archive_discover(handlerton *hton, THD* thd, TABLE_SHARE *share) if (frm_stream.frm_length == 0) DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); - frm_ptr= (uchar *)my_malloc(sizeof(char) * frm_stream.frm_length, MYF(0)); - azread_frm(&frm_stream, frm_ptr); - azclose(&frm_stream); + frm_ptr= (uchar *)my_malloc(sizeof(char) * frm_stream.frm_length, + MYF(MY_THREAD_SPECIFIC | MY_WME)); + if (!frm_ptr) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); - // don't go through the discovery again - if (writefrm(share->normalized_path.str, frm_ptr, frm_stream.frm_length)) - DBUG_RETURN(my_errno); + if (azread_frm(&frm_stream, frm_ptr)) + goto ret; - share->init_from_binary_frm_image(thd, frm_ptr); + azclose(&frm_stream); - my_free(frm_ptr); + if (!share->init_from_binary_frm_image(thd, share->normalized_path.str, + frm_ptr, frm_stream.frm_length)) + my_errno= 0; - DBUG_RETURN(0); -err: - DBUG_RETURN(HA_ERR_NO_SUCH_TABLE); +ret: + my_free(frm_ptr); + DBUG_RETURN(my_errno); } /* |