Commit 8d5c4af8 authored by Satya Bodapati's avatar Satya Bodapati

Merge fix for Bug#14628410 from mysql-5.1 to mysql-5.5

parents b77d3b0c a01e70c2
......@@ -1069,6 +1069,8 @@ convert_error_code_to_mysql(
return(HA_ERR_INDEX_CORRUPT);
case DB_UNDO_RECORD_TOO_BIG:
return(HA_ERR_UNDO_REC_TOO_BIG);
case DB_OUT_OF_MEMORY:
return(HA_ERR_OUT_OF_MEM);
}
}
......@@ -1246,7 +1248,7 @@ innobase_get_lower_case_table_names(void)
return(lower_case_table_names);
}
#if defined (__WIN__) && defined (MYSQL_DYNAMIC_PLUGIN)
#if defined (__WIN__)
extern MYSQL_PLUGIN_IMPORT MY_TMPDIR mysql_tmpdir_list;
/*******************************************************************//**
Map an OS error to an errno value. The OS error number is stored in
......@@ -1288,6 +1290,8 @@ innobase_mysql_tmpfile(void)
DBUG_ENTER("innobase_mysql_tmpfile");
DBUG_EXECUTE_IF("innobase_tmpfile_creation_failure", return(-1););
tmpdir = my_tmpdir(&mysql_tmpdir_list);
/* The tmpdir parameter can not be NULL for GetTempFileName. */
......@@ -1350,6 +1354,9 @@ innobase_mysql_tmpfile(void)
{
int fd2 = -1;
File fd = mysql_tmpfile("ib");
DBUG_EXECUTE_IF("innobase_tmpfile_creation_failure", return(-1););
if (fd >= 0) {
/* Copy the file descriptor, so that the additional resources
allocated by create_temp_file() can be freed by invoking
......@@ -1393,7 +1400,7 @@ innobase_mysql_tmpfile(void)
}
return(fd2);
}
#endif /* defined (__WIN__) && defined (MYSQL_DYNAMIC_PLUGIN) */
#endif /* defined (__WIN__) */
/*********************************************************************//**
Wrapper around MySQL's copy_and_convert function.
......
......@@ -719,6 +719,8 @@ row_merge_read(
ib_uint64_t ofs = ((ib_uint64_t) offset) * sizeof *buf;
ibool success;
DBUG_EXECUTE_IF("row_merge_read_failure", return(FALSE););
#ifdef UNIV_DEBUG
if (row_merge_print_block_read) {
fprintf(stderr, "row_merge_read fd=%d ofs=%lu\n",
......@@ -765,6 +767,8 @@ row_merge_write(
(ulint) (ofs >> 32),
buf_len);
DBUG_EXECUTE_IF("row_merge_write_failure", return(FALSE););
#ifdef UNIV_DEBUG
if (row_merge_print_block_write) {
fprintf(stderr, "row_merge_write fd=%d ofs=%lu\n",
......@@ -2229,7 +2233,7 @@ row_merge_drop_temp_indexes(void)
/*********************************************************************//**
Creates temperary merge files, and if UNIV_PFS_IO defined, register
the file descriptor with Performance Schema.
@return File descriptor */
@return file descriptor, or -1 on failure */
UNIV_INLINE
int
row_merge_file_create_low(void)
......@@ -2251,12 +2255,19 @@ row_merge_file_create_low(void)
#ifdef UNIV_PFS_IO
register_pfs_file_open_end(locker, fd);
#endif
if (fd < 0) {
fprintf(stderr,
"InnoDB: Error: Cannot create temporary merge file\n");
return(-1);
}
return(fd);
}
/*********************************************************************//**
Create a merge file. */
static
void
Create a merge file.
@return file descriptor, or -1 on failure */
static __attribute__((nonnull, warn_unused_result))
int
row_merge_file_create(
/*==================*/
merge_file_t* merge_file) /*!< out: merge file structure */
......@@ -2264,6 +2275,7 @@ row_merge_file_create(
merge_file->fd = row_merge_file_create_low();
merge_file->offset = 0;
merge_file->n_rec = 0;
return(merge_file->fd);
}
/*********************************************************************//**
......@@ -2702,7 +2714,7 @@ row_merge_build_indexes(
ulint block_size;
ulint i;
ulint error;
int tmpfd;
int tmpfd = -1;
ut_ad(trx);
ut_ad(old_table);
......@@ -2721,11 +2733,21 @@ row_merge_build_indexes(
for (i = 0; i < n_indexes; i++) {
row_merge_file_create(&merge_files[i]);
if (row_merge_file_create(&merge_files[i]) < 0)
{
error = DB_OUT_OF_MEMORY;
goto func_exit;
}
}
tmpfd = row_merge_file_create_low();
if (tmpfd < 0)
{
error = DB_OUT_OF_MEMORY;
goto func_exit;
}
/* Reset the MySQL row buffer that is used when reporting
duplicate keys. */
innobase_rec_reset(table);
......
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