MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / fix_log_state

Function fix_log_state

sql/sys_vars.cc:1262–1293  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1260 ON_UPDATE(fix_log_state));
1261
1262static bool fix_log_state(sys_var *self, THD *thd, enum_var_type type)
1263{
1264 bool res;
1265 my_bool *UNINIT_VAR(newvalptr), newval, UNINIT_VAR(oldval);
1266 uint UNINIT_VAR(log_type);
1267
1268 if (self == &Sys_general_log)
1269 {
1270 newvalptr= &opt_log;
1271 oldval= logger.get_log_file_handler()->is_open();
1272 log_type= QUERY_LOG_GENERAL;
1273 }
1274 else
1275 DBUG_ASSERT(FALSE);
1276
1277 newval= *newvalptr;
1278 if (oldval == newval)
1279 return false;
1280
1281 *newvalptr= oldval; // [de]activate_log_handler works that way (sigh)
1282
1283 mysql_mutex_unlock(&LOCK_global_system_variables);
1284 if (!newval)
1285 {
1286 logger.deactivate_log_handler(thd, log_type);
1287 res= false;
1288 }
1289 else
1290 res= logger.activate_log_handler(thd, log_type);
1291 mysql_mutex_lock(&LOCK_global_system_variables);
1292 return res;
1293}
1294
1295static bool check_not_empty_set(sys_var *self, THD *thd, set_var *var)
1296{

Callers

nothing calls this directly

Calls 4

is_openMethod · 0.80
get_log_file_handlerMethod · 0.80
activate_log_handlerMethod · 0.80

Tested by

no test coverage detected