Bug 1683981

Summary: logrotate throws error while rotating mariadb.log
Product: [Fedora] Fedora Reporter: redhat
Component: mariadbAssignee: Michal Schorm <mschorm>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: dciabrin, hhorak, jstanek, mbayer, mkocka, mmuzila, mschorm, ondrejj, praiskup, SpikeFedora
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: mariadb-10.5.9-1.fc34 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-03-25 00:17:18 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description redhat 2019-02-28 08:52:08 UTC
Description of problem:
The rules for rotating the mariodb logs are wrong in the case, that the file to be zipped is still in use and may change while zipping.


Version-Release number of selected component (if applicable):
mariadb-server-10.3.12-10.fc29.x86_64

How reproducible:
Always


Steps to Reproduce:
1. regular log rotate
2.
3.

Actual results:
/etc/cron.daily/logrotate:

error: Compressing program wrote following message to stderr when compressing log /var/log/mariadb/mariadb.log-20190228:
gzip: stdin: file size changed while zipping


Expected results:
No error at all

Additional info:
You might want to use "copytruncate" and zip the copied file.

Comment 1 Michal Schorm 2019-03-20 03:24:58 UTC
I'd incline to adding "delaycompress" option.

The "copytruncate" explixitly says in its manpage it may loose log entries.

--

The whole script would use fixing on several places. You can check and discuss upstream.
  https://jira.mariadb.org/browse/MDEV-16621

Comment 2 redhat 2019-05-12 09:05:55 UTC
Any progress on that topic concerning the Fedora package?

Comment 3 Michal Schorm 2019-05-13 08:51:11 UTC
Let's move this bug to Rawhide.

--

Progress? Not really.
I've dig deeper into the issue and it's really like 4 issues entangled together.

What we need right now, would be MariaDB start flushing logs more wisely on ceratin signals, so the signals can be used in real-case, heavy load, scenario.
Without solving this part, in the database itself, I won't expect a huge progress.

--

I'll keep the needinfo on myself to remind me to check on it time to time.

Comment 4 Ben Cotton 2019-08-13 16:55:33 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 31 development cycle.
Changing version to '31'.

Comment 5 Ben Cotton 2019-08-13 19:20:11 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 31 development cycle.
Changing version to 31.

Comment 6 Ben Cotton 2020-08-11 13:05:56 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 33 development cycle.
Changing version to 33.

Comment 7 Jan ONDREJ 2020-12-08 05:51:52 UTC
Also reported for RHEL. Can you please fix this. Thank you.
I tested "delaycompress" and works well.

RHEL bug:
  https://bugzilla.redhat.com/show_bug.cgi?id=1772330

Comment 9 Michal Schorm 2021-02-12 10:05:07 UTC
Build available:
  https://koji.fedoraproject.org/koji/buildinfo?buildID=1708682

I'd be glad for a feedback

Comment 10 Jan ONDREJ 2021-02-16 08:29:15 UTC
Changes looks fine, but hard to test. Need to wait a week or two on a real production server and wait until there are enough logs to rotate.

I can really test only if you can put this change at least to updates-testing for stable Fedora/EPEL. Then I can test on production servers.

Comment 11 Fedora Update System 2021-03-08 08:12:27 UTC
FEDORA-2021-7e035eeb6e has been submitted as an update to Fedora 34. https://bodhi.fedoraproject.org/updates/FEDORA-2021-7e035eeb6e

Comment 12 Fedora Update System 2021-03-08 15:59:52 UTC
FEDORA-2021-7e035eeb6e has been pushed to the Fedora 34 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-7e035eeb6e`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-7e035eeb6e

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 13 Fedora Update System 2021-03-25 00:17:18 UTC
FEDORA-2021-7e035eeb6e has been pushed to the Fedora 34 stable repository.
If problem still persists, please make note of it in this bug report.