|
1 | | -/* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. |
| 1 | +/* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. |
2 | 2 |
|
3 | 3 | This program is free software; you can redistribute it and/or modify |
4 | 4 | it under the terms of the GNU General Public License as published by |
@@ -3186,8 +3186,10 @@ case SQLCOM_PREPARE: |
3186 | 3186 | case SQLCOM_SLAVE_START: |
3187 | 3187 | { |
3188 | 3188 | mysql_mutex_lock(&LOCK_active_mi); |
3189 | | - if (active_mi != NULL) |
| 3189 | + if (active_mi != NULL) { |
| 3190 | + DEBUG_SYNC(thd, "begin_start_slave"); |
3190 | 3191 | res= start_slave(thd, active_mi, 1 /* net report*/); |
| 3192 | + } |
3191 | 3193 | else |
3192 | 3194 | my_message(ER_SLAVE_CONFIGURATION, ER(ER_SLAVE_CONFIGURATION), |
3193 | 3195 | MYF(0)); |
@@ -5046,6 +5048,7 @@ case SQLCOM_PREPARE: |
5046 | 5048 | { |
5047 | 5049 | thd->killed= THD::NOT_KILLED; |
5048 | 5050 | thd->mysys_var->abort= 0; |
| 5051 | + thd->reset_query_for_display(); |
5049 | 5052 | } |
5050 | 5053 | if (thd->is_error() || (thd->variables.option_bits & OPTION_MASTER_SQL_ERROR)) |
5051 | 5054 | trans_rollback_stmt(thd); |
@@ -6346,15 +6349,18 @@ void mysql_parse(THD *thd, char *rawbuf, uint length, |
6346 | 6349 | { |
6347 | 6350 | lex->safe_to_cache_query= false; // see comments below |
6348 | 6351 |
|
6349 | | - MYSQL_SET_STATEMENT_TEXT(thd->m_statement_psi, |
6350 | | - thd->rewritten_query.c_ptr_safe(), |
6351 | | - thd->rewritten_query.length()); |
6352 | | - } |
6353 | | - else |
6354 | | - { |
| 6352 | + thd->set_query_for_display(thd->rewritten_query.c_ptr_safe(), |
| 6353 | + thd->rewritten_query.length()); |
| 6354 | + } else if (thd->slave_thread) { |
| 6355 | + /* |
| 6356 | + In the slave, we add the information to pfs.events_statements_history, |
| 6357 | + but not to pfs.threads, as that is what the test suite expects. |
| 6358 | + */ |
6355 | 6359 | MYSQL_SET_STATEMENT_TEXT(thd->m_statement_psi, |
6356 | 6360 | thd->query(), |
6357 | 6361 | thd->query_length()); |
| 6362 | + } else { |
| 6363 | + thd->set_query_for_display(thd->query(), thd->query_length()); |
6358 | 6364 | } |
6359 | 6365 |
|
6360 | 6366 | if (!(opt_log_raw || thd->slave_thread)) |
@@ -6472,9 +6478,7 @@ void mysql_parse(THD *thd, char *rawbuf, uint length, |
6472 | 6478 | SQL injection, finding the source of the SQL injection is critical, so the |
6473 | 6479 | design choice is to log the query text of broken queries (a). |
6474 | 6480 | */ |
6475 | | - MYSQL_SET_STATEMENT_TEXT(thd->m_statement_psi, |
6476 | | - thd->query(), |
6477 | | - thd->query_length()); |
| 6481 | + thd->set_query_for_display(thd->query(), thd->query_length()); |
6478 | 6482 |
|
6479 | 6483 | /* Instrument this broken statement as "statement/sql/error" */ |
6480 | 6484 | thd->m_statement_psi= MYSQL_REFINE_STATEMENT(thd->m_statement_psi, |
@@ -6513,6 +6517,8 @@ void mysql_parse(THD *thd, char *rawbuf, uint length, |
6513 | 6517 | parser_state->m_lip.found_semicolon= NULL; |
6514 | 6518 | } |
6515 | 6519 |
|
| 6520 | + DEBUG_SYNC(thd, "query_rewritten"); |
| 6521 | + |
6516 | 6522 | DBUG_VOID_RETURN; |
6517 | 6523 | } |
6518 | 6524 |
|
|
0 commit comments