diff options
author | Sergei Golubchik <sergii@pisem.net> | 2011-10-19 21:45:18 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2011-10-19 21:45:18 +0200 |
commit | 76f0b94bb0b2994d639353530c5b251d0f1a204b (patch) | |
tree | 9ed50628aac34f89a37637bab2fc4915b86b5eb4 /storage/archive | |
parent | 4e46d8e5bff140f2549841167dc4b65a3c0a645d (diff) | |
parent | 5dc1a2231f55bacc9aaf0e24816f3d9c2ee1f21d (diff) | |
download | mariadb-git-76f0b94bb0b2994d639353530c5b251d0f1a204b.tar.gz |
merge with 5.3
sql/sql_insert.cc:
CREATE ... IF NOT EXISTS may do nothing, but
it is still not a failure. don't forget to my_ok it.
******
CREATE ... IF NOT EXISTS may do nothing, but
it is still not a failure. don't forget to my_ok it.
sql/sql_table.cc:
small cleanup
******
small cleanup
Diffstat (limited to 'storage/archive')
-rw-r--r-- | storage/archive/archive_reader.c | 20 | ||||
-rw-r--r-- | storage/archive/ha_archive.cc | 24 |
2 files changed, 27 insertions, 17 deletions
diff --git a/storage/archive/archive_reader.c b/storage/archive/archive_reader.c index ce4be92a521..ab54164dcc0 100644 --- a/storage/archive/archive_reader.c +++ b/storage/archive/archive_reader.c @@ -93,12 +93,16 @@ int main(int argc, char *argv[]) printf("\tFRM length %u\n", reader_handle.frm_length); if (reader_handle.comment_start_pos) { - char *comment = - (char *) malloc(sizeof(char) * reader_handle.comment_length); - azread_comment(&reader_handle, comment); - printf("\tComment length %u\n\t\t%.*s\n", reader_handle.comment_length, - reader_handle.comment_length, comment); - free(comment); + char *comment = (char *) my_malloc(reader_handle.comment_length, + MYF(MY_WME)); + if (comment) + { + azread_comment(&reader_handle, comment); + printf("\tComment length %u\n\t\t%.*s\n", + reader_handle.comment_length, + reader_handle.comment_length, comment); + my_free(comment,MYF(0)); + } } } else @@ -180,7 +184,7 @@ int main(int argc, char *argv[]) azio_stream writer_handle; - buffer= (char *)malloc(reader_handle.longest_row); + buffer= (char *) my_malloc(reader_handle.longest_row, MYF(0)); if (buffer == NULL) { printf("Could not allocate memory for row %llu\n", row_count); @@ -251,7 +255,7 @@ int main(int argc, char *argv[]) break; } - free(buffer); + my_free(buffer, MYF(0)); azclose(&writer_handle); } diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc index a4631f2fbc8..4112279d3c6 100644 --- a/storage/archive/ha_archive.cc +++ b/storage/archive/ha_archive.cc @@ -388,6 +388,7 @@ ARCHIVE_SHARE *ha_archive::get_share(const char *table_name, int *rc) { *rc= my_errno ? my_errno : -1; mysql_mutex_unlock(&archive_mutex); + mysql_mutex_destroy(&share->mutex); my_free(share); DBUG_RETURN(NULL); } @@ -742,11 +743,11 @@ int ha_archive::create(const char *name, TABLE *table_arg, { if (!mysql_file_fstat(frm_file, &file_stat, MYF(MY_WME))) { - frm_ptr= (uchar *)my_malloc(sizeof(uchar) * file_stat.st_size, MYF(0)); + frm_ptr= (uchar *)my_malloc(sizeof(uchar) * (size_t)file_stat.st_size, MYF(0)); if (frm_ptr) { - my_read(frm_file, frm_ptr, file_stat.st_size, MYF(0)); - azwrite_frm(&create_stream, (char *)frm_ptr, file_stat.st_size); + my_read(frm_file, frm_ptr, (size_t)file_stat.st_size, MYF(0)); + azwrite_frm(&create_stream, (char *)frm_ptr, (size_t)file_stat.st_size); my_free(frm_ptr); } } @@ -893,7 +894,7 @@ int ha_archive::write_row(uchar *buf) if (!share->archive_write_open) if (init_archive_writer()) - DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); + DBUG_RETURN(errno); if (table->next_number_field && record == table->record[0]) @@ -1083,7 +1084,8 @@ int ha_archive::rnd_init(bool scan) if (share->crashed) DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); - init_archive_reader(); + if (init_archive_reader()) + DBUG_RETURN(errno); /* We rewind the file so that we can read from the beginning if scan */ if (scan) @@ -1389,7 +1391,8 @@ int ha_archive::optimize(THD* thd, HA_CHECK_OPT* check_opt) char writer_filename[FN_REFLEN]; DBUG_ENTER("ha_archive::optimize"); - init_archive_reader(); + if (init_archive_reader()) + DBUG_RETURN(errno); // now we close both our writer and our reader for the rename if (share->archive_write_open) @@ -1514,12 +1517,13 @@ THR_LOCK_DATA **ha_archive::store_lock(THD *thd, /* Here is where we get into the guts of a row level lock. If TL_UNLOCK is set - If we are not doing a LOCK TABLE or DISCARD/IMPORT + If we are not doing a LOCK TABLE, DELAYED LOCK or DISCARD/IMPORT TABLESPACE, then allow multiple writers */ if ((lock_type >= TL_WRITE_CONCURRENT_INSERT && - lock_type <= TL_WRITE) && !thd_in_lock_tables(thd) + lock_type <= TL_WRITE) && delayed_insert == FALSE && + !thd_in_lock_tables(thd) && !thd_tablespace_op(thd)) lock_type = TL_WRITE_ALLOW_WRITE; @@ -1618,7 +1622,9 @@ int ha_archive::info(uint flag) if (flag & HA_STATUS_AUTO) { - init_archive_reader(); + if (init_archive_reader()) + DBUG_RETURN(errno); + mysql_mutex_lock(&share->mutex); azflush(&archive, Z_SYNC_FLUSH); mysql_mutex_unlock(&share->mutex); |