summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@mysql.com>2009-02-05 10:33:06 +0400
committerAlexey Botchkov <holyfoot@mysql.com>2009-02-05 10:33:06 +0400
commit9404e88dac2a1adfa0b89446c95c4b59bc5b3b35 (patch)
treec6d85d17a6a58b2b6f4395b979298e50af0a13b1 /storage
parentcf0d0a5e96e6625cfb04fddbb452c4ca3c15851c (diff)
parentfd5084f61d3f63e3bae5fa37fe39779e9f9db84b (diff)
downloadmariadb-git-9404e88dac2a1adfa0b89446c95c4b59bc5b3b35.tar.gz
merging
Diffstat (limited to 'storage')
-rw-r--r--storage/innobase/handler/ha_innodb.cc10
-rw-r--r--storage/myisammrg/myrg_open.c27
2 files changed, 24 insertions, 13 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 5d895833f42..50c3917c43c 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -3577,7 +3577,8 @@ ha_innobase::write_row(
/* out: error code */
uchar* record) /* in: a row in MySQL format */
{
- int error = 0;
+ ulint error = 0;
+ int error_result= 0;
ibool auto_inc_used= FALSE;
ulint sql_command;
trx_t* trx = thd_to_trx(user_thd);
@@ -3693,6 +3694,7 @@ no_commit:
}
/* MySQL errors are passed straight back. */
+ error_result = (int) error;
goto func_exit;
}
@@ -3786,7 +3788,7 @@ set_max_autoinc:
err = innobase_set_max_autoinc(auto_inc);
if (err != DB_SUCCESS) {
- error = (int) err;
+ error = err;
}
}
break;
@@ -3796,12 +3798,12 @@ set_max_autoinc:
innodb_srv_conc_exit_innodb(prebuilt->trx);
report_error:
- error = convert_error_code_to_mysql(error, user_thd);
+ error_result = convert_error_code_to_mysql((int) error, user_thd);
func_exit:
innobase_active_small();
- DBUG_RETURN(error);
+ DBUG_RETURN(error_result);
}
/**************************************************************************
diff --git a/storage/myisammrg/myrg_open.c b/storage/myisammrg/myrg_open.c
index b5002116164..64b4be2b7ca 100644
--- a/storage/myisammrg/myrg_open.c
+++ b/storage/myisammrg/myrg_open.c
@@ -47,6 +47,7 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
MI_INFO *isam=0;
uint found_merge_insert_method= 0;
size_t name_buff_length;
+ my_bool bad_children= FALSE;
DBUG_ENTER("myrg_open");
LINT_INIT(key_parts);
@@ -97,13 +98,13 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
fn_format(buff, buff, "", "", 0);
if (!(isam=mi_open(buff,mode,(handle_locking?HA_OPEN_WAIT_IF_LOCKED:0))))
{
- my_errno= HA_ERR_WRONG_MRG_TABLE_DEF;
if (handle_locking & HA_OPEN_FOR_REPAIR)
{
myrg_print_wrong_table(buff);
+ bad_children= TRUE;
continue;
}
- goto err;
+ goto bad_children;
}
if (!m_info) /* First file */
{
@@ -128,13 +129,13 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
files++;
if (m_info->reclength != isam->s->base.reclength)
{
- my_errno=HA_ERR_WRONG_MRG_TABLE_DEF;
if (handle_locking & HA_OPEN_FOR_REPAIR)
{
myrg_print_wrong_table(buff);
+ bad_children= TRUE;
continue;
}
- goto err;
+ goto bad_children;
}
m_info->options|= isam->s->options;
m_info->records+= isam->state->records;
@@ -147,8 +148,8 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
m_info->tables);
}
- if (my_errno == HA_ERR_WRONG_MRG_TABLE_DEF)
- goto err;
+ if (bad_children)
+ goto bad_children;
if (!m_info && !(m_info= (MYRG_INFO*) my_malloc(sizeof(MYRG_INFO),
MYF(MY_WME | MY_ZEROFILL))))
goto err;
@@ -178,12 +179,14 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
pthread_mutex_unlock(&THR_LOCK_open);
DBUG_RETURN(m_info);
+bad_children:
+ my_errno= HA_ERR_WRONG_MRG_TABLE_DEF;
err:
save_errno=my_errno;
switch (errpos) {
case 3:
while (files)
- mi_close(m_info->open_tables[--files].table);
+ (void) mi_close(m_info->open_tables[--files].table);
my_free((char*) m_info,MYF(0));
/* Fall through */
case 2:
@@ -392,6 +395,7 @@ int myrg_attach_children(MYRG_INFO *m_info, int handle_locking,
uint child_nr;
uint key_parts;
uint min_keys;
+ my_bool bad_children= FALSE;
DBUG_ENTER("myrg_attach_children");
DBUG_PRINT("myrg", ("handle_locking: %d", handle_locking));
@@ -441,13 +445,13 @@ int myrg_attach_children(MYRG_INFO *m_info, int handle_locking,
DBUG_PRINT("error", ("definition mismatch table: '%s' repair: %d",
myisam->filename,
(handle_locking & HA_OPEN_FOR_REPAIR)));
- my_errno= HA_ERR_WRONG_MRG_TABLE_DEF;
if (handle_locking & HA_OPEN_FOR_REPAIR)
{
myrg_print_wrong_table(myisam->filename);
+ bad_children= TRUE;
continue;
}
- goto err;
+ goto bad_children;
}
m_info->options|= myisam->s->options;
@@ -462,6 +466,9 @@ int myrg_attach_children(MYRG_INFO *m_info, int handle_locking,
child_nr++;
}
+ if (bad_children)
+ goto bad_children;
+ /* Note: callback() resets my_errno, so it is safe to check it here */
if (my_errno == HA_ERR_WRONG_MRG_TABLE_DEF)
goto err;
if (sizeof(my_off_t) == 4 && file_offset > (ulonglong) (ulong) ~0L)
@@ -477,6 +484,8 @@ int myrg_attach_children(MYRG_INFO *m_info, int handle_locking,
pthread_mutex_unlock(&m_info->mutex);
DBUG_RETURN(0);
+bad_children:
+ my_errno= HA_ERR_WRONG_MRG_TABLE_DEF;
err:
save_errno= my_errno;
switch (errpos) {