WL#6613: Refactor logging code - split logging and binlogging code
Affects: Server-5.7
—
Status: Complete
This worklog aims to refactor logging code (log.h/log.cc) Overall aims of the refactoring: - Split binlogging code from general/slow/error logging code so that replication and runtime teams can work independently. - Improve code documentation. - Make logging code easier to test.
Planned refactorings/changes: 1) Get rid of MYSQL_LOG class, so that MYSQL_QUERY_LOG and MYSQL_BIN_LOG become independent classes. Reasons: - MYSQL_LOG has not a lot of code - We never refer to MYSQL_LOG, only to MYSQL_QUERY_LOG and MYSQL_BIN_LOG - MYSQL_LOG has no virtual functions - MYSQL_LOG has a "log_type" member which can be either LOG_NORMAL or LOG_BIN and several functions have different behavior depending on the value. - Some MYSQL_LOG functions/parameters are only used by one of the subclasses. 2) Move code only related to replication out of log.h/log.cc 3) Add doxygen comments to log.h 4) Move logging related code to log.h/log.cc from sys_vars.cc, sql_parse.cc, sql_class.h/.cc. 5) Simplify log initialization/cleanup code. Do more in constructors/destructors, don't initialize the same thing twice etc. 6) Remove dead code. 7) Split error log code from general/slow query log code. These logs are quite different both implementation and usage wise. E.g. we support stderr/file for error log, but file/table for query logs. 8) Rename classes/functions/variables to be more consistent and more clearly indicate their role. 9) Update code to follow coding guidelines. 10) Lock/unlock related mutexes in a more consistent manner - LOCK_log, LOCK_logger, LOCK_global_system_variables. 11) Make functions/variables private and const whenever possible. 12) Remove code duplication.
Copyright (c) 2000, 2024, Oracle Corporation and/or its affiliates. All rights reserved.