| 1370 | */ |
| 1371 | |
| 1372 | void THD::init() |
| 1373 | { |
| 1374 | DBUG_ENTER("thd::init"); |
| 1375 | mdl_context.reset(); |
| 1376 | mysql_mutex_lock(&LOCK_global_system_variables); |
| 1377 | plugin_thdvar_init(this); |
| 1378 | /* |
| 1379 | plugin_thd_var_init() sets variables= global_system_variables, which |
| 1380 | has reset variables.pseudo_thread_id to 0. We need to correct it here to |
| 1381 | avoid temporary tables replication failure. |
| 1382 | */ |
| 1383 | variables.pseudo_thread_id= thread_id; |
| 1384 | |
| 1385 | mysql_mutex_unlock(&LOCK_global_system_variables); |
| 1386 | |
| 1387 | user_time.val= 0; |
| 1388 | |
| 1389 | server_status= 0; |
| 1390 | if (variables.option_bits & OPTION_AUTOCOMMIT) |
| 1391 | server_status|= SERVER_STATUS_AUTOCOMMIT; |
| 1392 | if (variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES) |
| 1393 | server_status|= SERVER_STATUS_NO_BACKSLASH_ESCAPES; |
| 1394 | if (variables.sql_mode & MODE_ANSI_QUOTES) |
| 1395 | server_status|= SERVER_STATUS_ANSI_QUOTES; |
| 1396 | |
| 1397 | transaction->all.modified_non_trans_table= |
| 1398 | transaction->stmt.modified_non_trans_table= FALSE; |
| 1399 | transaction->all.m_unsafe_rollback_flags= |
| 1400 | transaction->stmt.m_unsafe_rollback_flags= 0; |
| 1401 | |
| 1402 | open_options=ha_open_options; |
| 1403 | update_lock_default= (variables.low_priority_updates ? |
| 1404 | TL_WRITE_LOW_PRIORITY : |
| 1405 | TL_WRITE); |
| 1406 | tx_isolation= (enum_tx_isolation) variables.tx_isolation; |
| 1407 | tx_read_only= variables.tx_read_only; |
| 1408 | update_charset(); // plugin_thd_var() changed character sets |
| 1409 | reset_current_stmt_binlog_format_row(); |
| 1410 | reset_binlog_local_stmt_filter(); |
| 1411 | /* local_memory_used was setup in THD::THD() */ |
| 1412 | set_status_var_init(clear_for_new_connection); |
| 1413 | status_var.max_tmp_space_used= status_var.tmp_space_used; // Should be 0 |
| 1414 | status_var.max_local_memory_used= status_var.local_memory_used; |
| 1415 | bzero((char *) &org_status_var, sizeof(org_status_var)); |
| 1416 | status_in_global= 0; |
| 1417 | bytes_sent_old= 0; |
| 1418 | start_bytes_received= 0; |
| 1419 | bzero(&m_last_commit_gtid, sizeof(m_last_commit_gtid)); |
| 1420 | last_stmt= NULL; |
| 1421 | /* Reset status of last insert id */ |
| 1422 | arg_of_last_insert_id_function= FALSE; |
| 1423 | stmt_depends_on_first_successful_insert_id_in_prev_stmt= FALSE; |
| 1424 | first_successful_insert_id_in_prev_stmt= 0; |
| 1425 | first_successful_insert_id_in_prev_stmt_for_binlog= 0; |
| 1426 | first_successful_insert_id_in_cur_stmt= 0; |
| 1427 | current_backup_stage= BACKUP_FINISHED; |
| 1428 | backup_commit_lock= 0; |
| 1429 | num_of_strings_sorted_on_truncated_length= 0; |
no test coverage detected