Commit 017ba130 authored by pem@mysql.com's avatar pem@mysql.com

Check for thd->killed in execution loop. (Makes more graceful behaviour in

certain interrupt cases.)
parent 9b6d015a
...@@ -136,6 +136,7 @@ sp_head::execute(THD *thd) ...@@ -136,6 +136,7 @@ sp_head::execute(THD *thd)
int ret= 0; int ret= 0;
uint ip= 0; uint ip= 0;
LINT_INIT(olddbname);
if (olddbptr) if (olddbptr)
olddbname= my_strdup(olddbptr, MYF(MY_WME)); olddbname= my_strdup(olddbptr, MYF(MY_WME));
...@@ -148,14 +149,18 @@ sp_head::execute(THD *thd) ...@@ -148,14 +149,18 @@ sp_head::execute(THD *thd)
break; break;
DBUG_PRINT("execute", ("Instruction %u", ip)); DBUG_PRINT("execute", ("Instruction %u", ip));
ret= i->execute(thd, &ip); ret= i->execute(thd, &ip);
} while (ret == 0); } while (ret == 0 && !thd->killed);
DBUG_PRINT("info", ("ret=%d killed=%d", ret, thd->killed));
if (thd->killed)
ret= -1;
/* If the DB has changed, the pointer has changed too, but the /* If the DB has changed, the pointer has changed too, but the
original thd->db will then have been freed */ original thd->db will then have been freed */
if (olddbptr && olddbptr != thd->db && olddbname) if (olddbptr && olddbptr != thd->db && olddbname)
{ {
/* QQ Maybe we should issue some special error message or warning here, /* QQ Maybe we should issue some special error message or warning here,
if this fails?? */ if this fails?? */
if (! thd->killed)
ret= mysql_change_db(thd, olddbname); ret= mysql_change_db(thd, olddbname);
my_free(olddbname, MYF(0)); my_free(olddbname, MYF(0));
} }
......
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