After this patch SYSTEM FLUSH LOGS will force system.*_log table
creatoins (only for enabled tables of course).
This will avoid such hacks like:
set log_queries=1;
select 1;
system flush logs;
This is the second version of the patch, since first has a deadlock [1]
(reported by @alesapin). This version does not use separate lock and do
not issue CREATE TABLE from the query execution thread, instead it
activate flushing thread to do so, hence this should be the same as if
the table will be created during flush.
[1]: https://gist.github.com/alesapin/d915d1deaa27d49aa31223daded02be2Fixes: #11563
Cc: @alesapin
Cc: @nikitamikhaylov