A brief introduction: to talk binlog cache
Two definitions
Memory allocated for each session, for storing binary log buffer during the transaction.
Three Parameters
1 binlog_cache_size default 32K memory size specified for storing the entire thing generated binlog event, for the big things is likely to exceed the terms set this parameter, you need to open the binlog temporary files for storage.
2 max_binlog_cache_size used to specify when binlog event of something more than the size of the opening set binlog_cache_size binlog temporary files available size, the amount of things if binlog event generated more than max_binlog_cache_size + binlog_cache_size size set will be throwing error:
Four temporary files
1 Temporary files are stored in the directory defined tmpdir the file name begins with "ML". But the file can not be seen with ls, you need lsof command
2 When we execute multi-statement transaction memory usage of all session exceeds the value of max_binlog_cache_size
就会报错:“Multi-statement transaction required more than 'max_binlog_cache_size' bytes ofstorage
Five state
View binlog_cache usage units times
Binlog_cache_disk_use Cache
Binlog_cache_use temporary files
Binlog_cache_disk_use 1 when the corresponding value is relatively large when we can consider appropriate value corresponding binlog_cache_size increase, reduce operator interaction IO layer
Six overall process
1 transaction open
2 transactions executed DML statements allocate a separate binlog_cache, and write
3 If space binlog cache is full, it will binlog data is written to the binlog cache of temporary files, and empty the binlog cache. If the size of the temporary file is larger than the binlog max_binlog_cache_size set the throwing error ERROR 1197 (HY000).
4 things to submit all binlog entire binlog cache and temporary files are written to the binlog file data in cured, release binlog cache and temporary files binlog
5 is disconnected to release recovered
Refer to the original link:
https://www.jianshu.com/p/fb4ffe7fd7d2 eight strange Great God