MDEV-33763: Buffered error logging for Galera#521
Open
janlindstrom wants to merge 1 commit intomainfrom
Open
Conversation
This is adaptation of feature by Zsolt Parragi <zsolt.parragi@percona.com> for Percona XtraDB Cluster to MariaDB. Original feature is documented at https://www.percona.com/blog/introducing-buffered-error-logging-in-percona-server-for-mysql/. In this adaptation variable names are changed and integration to server code is different. Commit adds new variables wsrep_buffered_error_log_buffer_size ulong default 0 dynamic Size of buffer used in buffered error logging. Because wsrep debug setting produces large number of messages it is recomended to set this variable around 1-100Mb. wsrep_buffered_error_log_filename string default NULL static Name of the file where buffered error logging is done. wsrep_buffered_error_log_file_size ulong default 0 dynamic Maximum size of one buffered error log file. This variable should be configured to be 10-100 times bigger than buffer size. wsrep_buffered_error_log_rotations uint default 9 dynamic. Number of buffered error log files kept before deleting them. This implementation uses logger service interface. When wsrep_buffered_error_log_buffer_size is specified and non zero, all logging is written using logger service interface. When logger buffer gets full, the server shuts down, or crashes, the buffer is written to wsrep_buffered_error_log_filename. When log files reaches configured size limit log is rotated and only configured amount of log files are kept. This is useful in situations where debug logs create lots of output and slow down normal server operation, but are helpful for figuring out issues, as writing to a memory buffer has less overhead. Detailed changes: wsrep.h Log printing is now controlled by wsrep_debug_mode variable and controlled by wsrep_debug and wsrep_buffered_error_log_buffer_size variables. sql/log.cc Added sql_print_debug to log wsrep debug messages (WSREP_DEBUG()). print_buffer_to_file Actual buffered error logging if enabled will happen in this function. sql/mysqld.cc Buffered error logging is initialized and shutdown here if it is configured. sql/signal_handler.cc If buffered error logging is enabled remaining buffer is written before continuing signal handling. sql/sys_vars.cc New variables are defined here. sql/wsrep_buffered_error_log.cc sql/wsrep_buffered_error_log.h Buffered error log implementation using logger service API. sql/wsrep_var.cc New variables update and check functions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is adaptation of feature by Zsolt Parragi zsolt.parragi@percona.com for Percona XtraDB Cluster to MariaDB. Original feature is documented at https://www.percona.com/blog/introducing-buffered-error-logging-in-percona-server-for-mysql/.
In this adaptation variable names are changed and integration to server code is different.
Commit adds new variables
wsrep_buffered_error_log_buffer_size ulong default 0 dynamic
Size of buffer used in buffered error logging. Because
wsrep debug setting produces large number of messages
it is recomended to set this variable around 1-100Mb.
This implementation uses logger service interface. When wsrep_buffered_error_log_buffer_size is specified and non zero, all logging is written using logger service interface. When logger buffer gets full, the server shuts down, or crashes, the buffer is written to wsrep_buffered_error_log_filename.
When log files reaches configured size limit log is rotated and only configured amount of log files are kept.
This is useful in situations where debug logs create lots of output and slow down normal server operation, but are helpful for figuring out issues, as writing to a memory buffer has less overhead.
Detailed changes:
wsrep.h
Log printing is now controlled by wsrep_debug_mode variable and
controlled by wsrep_debug and wsrep_buffered_error_log_buffer_size
variables.
sql/log.cc
Added sql_print_debug to log wsrep debug messages (WSREP_DEBUG()).
print_buffer_to_file
Actual buffered error logging if enabled will happen in this
function.
sql/mysqld.cc
Buffered error logging is initialized and shutdown here if it is
configured.
sql/signal_handler.cc
If buffered error logging is enabled remaining buffer is written
before continuing signal handling.
sql/sys_vars.cc
New variables are defined here.
sql/wsrep_buffered_error_log.cc
sql/wsrep_buffered_error_log.h
Buffered error log implementation using logger service API.
sql/wsrep_var.cc
New variables update and check functions.