| 1574 | |
| 1575 | |
| 1576 | void THD::change_user(void) |
| 1577 | { |
| 1578 | #ifdef WITH_WSREP |
| 1579 | bool pause_wsrep= wsrep_cs().state() != wsrep::client_state::s_none; |
| 1580 | if (pause_wsrep) |
| 1581 | { |
| 1582 | wsrep_after_command_ignore_result(this); |
| 1583 | wsrep_close(this); |
| 1584 | } |
| 1585 | #endif /* WITH_WSREP */ |
| 1586 | if (!status_in_global) // Reset in init() |
| 1587 | add_status_to_global(); |
| 1588 | |
| 1589 | if (!cleanup_done) |
| 1590 | cleanup(); |
| 1591 | cleanup_done= 0; |
| 1592 | reset_killed(); |
| 1593 | /* Clear errors from the previous THD */ |
| 1594 | my_errno= 0; |
| 1595 | if (mysys_var) |
| 1596 | mysys_var->abort= 0; |
| 1597 | |
| 1598 | /* Clear warnings. */ |
| 1599 | if (!get_stmt_da()->is_warning_info_empty()) |
| 1600 | get_stmt_da()->clear_warning_info(0); |
| 1601 | |
| 1602 | init(); |
| 1603 | /* cannot clear map if it'll free the currently executing statement */ |
| 1604 | DBUG_ASSERT(stmt_arena->is_conventional()); |
| 1605 | stmt_map.reset(); |
| 1606 | my_hash_init(key_memory_user_var_entry, &user_vars, |
| 1607 | Lex_ident_user_var::charset_info(), |
| 1608 | USER_VARS_HASH_SIZE, 0, 0, get_var_key, free_user_var, |
| 1609 | HASH_THREAD_SPECIFIC); |
| 1610 | my_hash_init(key_memory_user_var_entry, &sequences, |
| 1611 | Lex_ident_fs::charset_info(), SEQUENCES_HASH_SIZE, 0, 0, |
| 1612 | get_sequence_last_key, free_sequence_last, |
| 1613 | HASH_THREAD_SPECIFIC); |
| 1614 | /* cannot clear caches if it'll free the currently running routine */ |
| 1615 | DBUG_ASSERT(!spcont); |
| 1616 | sp_caches_clear(); |
| 1617 | statement_rcontext_reinit(); |
| 1618 | opt_trace.delete_traces(); |
| 1619 | binlog_truncate_tmp_files(); |
| 1620 | #ifdef WITH_WSREP |
| 1621 | if (pause_wsrep) |
| 1622 | { |
| 1623 | wsrep_open(this); |
| 1624 | wsrep_before_command(this); |
| 1625 | } |
| 1626 | #endif /* WITH_WSREP */ |
| 1627 | } |
| 1628 | |
| 1629 | /** |
| 1630 | Change default database |
no test coverage detected