Commit 1e14db11 authored by Daniele Sciascia's avatar Daniele Sciascia Committed by Nirbhay Choubey

refs codership/mysql-wsrep#228

- Add calls to wsrep_sync_wait for
  SHOW CREATE DB/PROCEDURE/FUNCTION/TRIGGER/EVENT
  and SHOW PROCEDURE/FUNCTION CODE
parent 5ebf6ce7
...@@ -4367,6 +4367,11 @@ case SQLCOM_PREPARE: ...@@ -4367,6 +4367,11 @@ case SQLCOM_PREPARE:
db_name.str= db_name_buff; db_name.str= db_name_buff;
db_name.length= lex->name.length; db_name.length= lex->name.length;
strmov(db_name.str, lex->name.str); strmov(db_name.str, lex->name.str);
#ifdef WITH_WSREP
if (WSREP_CLIENT(thd) && wsrep_sync_wait(thd)) goto error;
#endif /* WITH_WSREP */
if (check_db_name(&db_name)) if (check_db_name(&db_name))
{ {
my_error(ER_WRONG_DB_NAME, MYF(0), db_name.str); my_error(ER_WRONG_DB_NAME, MYF(0), db_name.str);
...@@ -4423,6 +4428,9 @@ case SQLCOM_PREPARE: ...@@ -4423,6 +4428,9 @@ case SQLCOM_PREPARE:
/* lex->unit.cleanup() is called outside, no need to call it here */ /* lex->unit.cleanup() is called outside, no need to call it here */
break; break;
case SQLCOM_SHOW_CREATE_EVENT: case SQLCOM_SHOW_CREATE_EVENT:
#ifdef WITH_WSREP
if (WSREP_CLIENT(thd) && wsrep_sync_wait(thd)) goto error;
#endif /* WITH_WSREP */
res= Events::show_create_event(thd, lex->spname->m_db, res= Events::show_create_event(thd, lex->spname->m_db,
lex->spname->m_name); lex->spname->m_name);
break; break;
...@@ -5389,12 +5397,18 @@ case SQLCOM_PREPARE: ...@@ -5389,12 +5397,18 @@ case SQLCOM_PREPARE:
} }
case SQLCOM_SHOW_CREATE_PROC: case SQLCOM_SHOW_CREATE_PROC:
{ {
#ifdef WITH_WSREP
if (WSREP_CLIENT(thd) && wsrep_sync_wait(thd)) goto error;
#endif /* WITH_WSREP */
if (sp_show_create_routine(thd, TYPE_ENUM_PROCEDURE, lex->spname)) if (sp_show_create_routine(thd, TYPE_ENUM_PROCEDURE, lex->spname))
goto error; goto error;
break; break;
} }
case SQLCOM_SHOW_CREATE_FUNC: case SQLCOM_SHOW_CREATE_FUNC:
{ {
#ifdef WITH_WSREP
if (WSREP_CLIENT(thd) && wsrep_sync_wait(thd)) goto error;
#endif /* WITH_WSREP */
if (sp_show_create_routine(thd, TYPE_ENUM_FUNCTION, lex->spname)) if (sp_show_create_routine(thd, TYPE_ENUM_FUNCTION, lex->spname))
goto error; goto error;
break; break;
...@@ -5407,6 +5421,9 @@ case SQLCOM_PREPARE: ...@@ -5407,6 +5421,9 @@ case SQLCOM_PREPARE:
stored_procedure_type type= (lex->sql_command == SQLCOM_SHOW_PROC_CODE ? stored_procedure_type type= (lex->sql_command == SQLCOM_SHOW_PROC_CODE ?
TYPE_ENUM_PROCEDURE : TYPE_ENUM_FUNCTION); TYPE_ENUM_PROCEDURE : TYPE_ENUM_FUNCTION);
#ifdef WITH_WSREP
if (WSREP_CLIENT(thd) && wsrep_sync_wait(thd)) goto error;
#endif /* WITH_WSREP */
if (sp_cache_routine(thd, type, lex->spname, FALSE, &sp)) if (sp_cache_routine(thd, type, lex->spname, FALSE, &sp))
goto error; goto error;
if (!sp || sp->show_routine_code(thd)) if (!sp || sp->show_routine_code(thd))
...@@ -5431,6 +5448,9 @@ case SQLCOM_PREPARE: ...@@ -5431,6 +5448,9 @@ case SQLCOM_PREPARE:
goto error; goto error;
} }
#ifdef WITH_WSREP
if (WSREP_CLIENT(thd) && wsrep_sync_wait(thd)) goto error;
#endif /* WITH_WSREP */
if (show_create_trigger(thd, lex->spname)) if (show_create_trigger(thd, lex->spname))
goto error; /* Error has been already logged. */ goto error; /* Error has been already logged. */
......
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