[MDEV-14108] Log compression isn't working as expected Created: 2017-10-23 Updated: 2017-10-24 Resolved: 2017-10-23 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Server |
| Affects Version/s: | 10.2.9 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Minor |
| Reporter: | Slawomir Pryczek | Assignee: | Unassigned |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | mariadb | ||
| Environment: |
Debian Jessie, Fedora Core 26 |
||
| Description |
|
Hi Guys, I found this new great feature of mariadb (log compression), but unfortunately i cannot make it working. Basically on the servers we're writing terabytes of logs on SSD disks so that would be great if I can get it enabled. log_bin_compress_min_len=10 log_bin_compress_min_len=10 log_bin_compress_min_len=128 Nothing works as expected. I tried enabling by SET GLOBAL and also using config file Still there's plaintext in the log and it doesn't seem that anything is getting compressed... i'm doing something wrong or this feature is no longer supported / broken in 10.2.9? Log file dump: Thanks, |
| Comments |
| Comment by Elena Stepanova [ 2017-10-23 ] |
|
What makes you think that the log in the screenshot is not compressed? It seems compressed to me. I didn't dig into other events, but I think it's the same for them. Further, if you are judging by the log size, please note that it's event compression, not log compression. Even if you are writing terabytes of logs, but each individual event is as small as the ones we see in the screenshot, then probably you'll have minimal effect, if any at all. For a simple experiment to see that the events are written in the special compressed format, use mysqlbinlog to read the binlog. It will show Update_compressed_rows: and such as event types. |
| Comment by Slawomir Pryczek [ 2017-10-23 ] |
|
Hi Elena, sorry for misunderstanding and thanks for the comment. Yes I thought that compression isn't working as i was seeing these raw queries and COMMITs in logs, and log size didn't get any smaller (also i got misled because i just switched from 10.1 to 10.2 mainly for this functionality). So I incorrectly assumed that if i enabled event compression i should see some difference in size... and also it was my assumption that query cleartext and commit would be compressed... So it was very strange to me that these logs (which i can compress from 1GB to 60-80MB using simple zip) are staying same size. Maybe you can later create some code to spawn a thread which will compress whole logfile after the server is done writing to it. I added some quick comment to your DOC page as i wasn't able to find anything else on this topic... so i think this can be closed as resolved and not a bug. Thanks, |
| Comment by Elena Stepanova [ 2017-10-23 ] |
|
pslawek83, thanks for adding a note to the KB.
It shouldn't really be strange to anyone who's using compression, that's exactly how it works, isn't it?
You can create a feature request for it, although I personally don't see such functionality on the database server side being particularly useful. The benefit of binlog event compression is that it happens right away, when the event is created, before it's written; and that the event is transferred in the compressed form. If you compress the whole logfile instead, you'll first need to write the whole file in the uncompressed form, and everything that happens on per-event basis will be also happening with uncompressed data. If you just want to compress binlogs after the fact for a more compact storage, the much easier and flexible solution would be to do it externally – then you can choose a compression tool which works best for you, group files in any way you need, etc. |
| Comment by Slawomir Pryczek [ 2017-10-24 ] |
|
Sure no problem, i'll be trying to add some comments when i find something worth mentioning. Yes the surprising part was not that it isn't compressed as effectively as "whole file", just that that there was no gain at all. I understand that it can't be compressed as effectively as whole file when you have dictionary local to event... probably there'll be x1.5-x2 gain when we'll be able to turn off Annotate, after db restore is done... so that's very nice too (it's dynamic, just new setting is applied after re-connect). For the second part, yes we're having probably not so common use case. Lots of live stats on tokudb, so db size is relatively small only logs are growing very fast because we're re-writing same keys over and over. For thirdparty apps as we're doing offline backups on replicas, so logs need to still be accessible by the master as these take a lot of time... so probably we'll explore some other options, like making these backups faster as that should be very easy to do... |