| 62 | */ |
| 63 | |
| 64 | bool reload_acl_and_cache(THD *thd, unsigned long long options, |
| 65 | TABLE_LIST *tables, int *write_to_binlog) |
| 66 | { |
| 67 | bool result=0; |
| 68 | select_errors=0; /* Write if more errors */ |
| 69 | int tmp_write_to_binlog= *write_to_binlog= 1; |
| 70 | #ifndef DBUG_OFF |
| 71 | /* |
| 72 | When invoked for handling a SIGHUP by rpl_shutdown_sighup.test, we need to |
| 73 | force the signal handler to wait after REFRESH_TABLES, as that will check |
| 74 | for a killed server, and we need to call hostname_cache_refresh after |
| 75 | server cleanup has happened to trigger MDEV-30260. |
| 76 | */ |
| 77 | int do_dbug_sleep= 0; |
| 78 | #endif |
| 79 | |
| 80 | DBUG_ASSERT(!thd || !thd->in_sub_stmt); |
| 81 | |
| 82 | if (options & REFRESH_GRANT) |
| 83 | { |
| 84 | #ifndef NO_EMBEDDED_ACCESS_CHECKS |
| 85 | THD *tmp_thd= 0; |
| 86 | /* |
| 87 | If reload_acl_and_cache() is called from SIGHUP handler we have to |
| 88 | allocate temporary THD for execution of acl_reload()/grant_reload(). |
| 89 | */ |
| 90 | if (unlikely(!thd) && (thd= (tmp_thd= new THD(0)))) |
| 91 | { |
| 92 | thd->store_globals(); |
| 93 | thd->set_query_inner((char*) STRING_WITH_LEN("intern:reload_acl"), |
| 94 | default_charset_info); |
| 95 | } |
| 96 | |
| 97 | if (likely(thd)) |
| 98 | { |
| 99 | bool reload_acl_failed= acl_reload(thd); |
| 100 | bool reload_grants_failed= grant_reload(thd); |
| 101 | bool reload_servers_failed= servers_reload(thd); |
| 102 | |
| 103 | if (reload_acl_failed || reload_grants_failed || reload_servers_failed) |
| 104 | { |
| 105 | result= 1; |
| 106 | /* |
| 107 | When an error is returned, my_message may have not been called and |
| 108 | the client will hang waiting for a response. |
| 109 | */ |
| 110 | my_error(ER_UNKNOWN_ERROR, MYF(0)); |
| 111 | } |
| 112 | |
| 113 | #ifndef DBUG_OFF |
| 114 | DBUG_EXECUTE_IF("hold_sighup_log_refresh", { |
| 115 | DBUG_ASSERT(!debug_sync_set_action( |
| 116 | thd, STRING_WITH_LEN("now SIGNAL in_reload_acl_and_cache " |
| 117 | "WAIT_FOR refresh_logs"))); |
| 118 | do_dbug_sleep= 1; |
| 119 | }); |
| 120 | #endif |
| 121 | } |
no test coverage detected