Helper function to get the error code of the query to be binlogged. */
| 9905 | Helper function to get the error code of the query to be binlogged. |
| 9906 | */ |
| 9907 | int query_error_code(THD *thd, bool not_killed) |
| 9908 | { |
| 9909 | int error; |
| 9910 | |
| 9911 | if (not_killed || (killed_mask_hard(thd->killed) == KILL_BAD_DATA)) |
| 9912 | { |
| 9913 | error= thd->is_error() ? thd->get_stmt_da()->sql_errno() : 0; |
| 9914 | if (!error) |
| 9915 | return error; |
| 9916 | |
| 9917 | /* thd->get_get_stmt_da()->sql_errno() might be ER_SERVER_SHUTDOWN or |
| 9918 | ER_QUERY_INTERRUPTED, So here we need to make sure that error |
| 9919 | is not set to these errors when specified not_killed by the |
| 9920 | caller. |
| 9921 | */ |
| 9922 | if (error == ER_SERVER_SHUTDOWN || error == ER_QUERY_INTERRUPTED || |
| 9923 | error == ER_NEW_ABORTING_CONNECTION || error == ER_CONNECTION_KILLED) |
| 9924 | error= 0; |
| 9925 | } |
| 9926 | else |
| 9927 | { |
| 9928 | /* killed status for DELAYED INSERT thread should never be used */ |
| 9929 | DBUG_ASSERT(!(thd->system_thread & SYSTEM_THREAD_DELAYED_INSERT)); |
| 9930 | error= thd->killed_errno(); |
| 9931 | } |
| 9932 | |
| 9933 | return error; |
| 9934 | } |
| 9935 | |
| 9936 | |
| 9937 | bool MYSQL_BIN_LOG::write_incident_already_locked(THD *thd) |
no test coverage detected