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