Bug 1151623
| Summary: | mysql-zrm doesn't check the exitcode of all the commands in the pipeline | ||
|---|---|---|---|
| Product: | [Fedora] Fedora EPEL | Reporter: | Kris <kris> |
| Component: | MySQL-zrm | Assignee: | Orion Poplawski <orion> |
| Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | urgent | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | el6 | CC: | maurizio.antillon, orion |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | MySQL-zrm-3.0-6.el6.1 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2017-08-31 15:16:40 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: | |||
MySQL-zrm-3.0-6.el6.1 has been submitted as an update to Fedora EPEL 6. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-e06c2b4baa MySQL-zrm-3.0-6.el6.1 has been pushed to the Fedora EPEL 6 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-e06c2b4baa MySQL-zrm-3.0-6.el6.1 has been pushed to the Fedora EPEL 6 stable repository. If problems still persist, please make note of it in this bug report. |
I believe I stumbled upon a fairly major bug when using mysql-zrm 2 and 3 (EPEL version) where the exitcodes of the command pipeline when using logical backups are ignored. It seems like the logic for it is half implemented or I'm missing something obvious. I stumbled upon this issue when noticing that one database installation wasn't actually backing up all the data, but mysql-zrm was reporting it as a success. When debugging I found that the mysqldump was failing with an exitcode of 2 and this message: "VIEW references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them (1356)" The temporary file that records the $PIPESTATUS[@] of the run shows exitcode 2 as well, but the $rt that's tested is 0. Here is the patch I created that resolves the issue. --- /usr/bin/mysql-zrm-backup 2014-07-25 13:16:37.000000000 -0400 +++ mysql-zrm-backup 2014-10-10 15:32:05.558346707 -0400 @@ -1833,7 +1833,29 @@ if( $abort_flag ){ &abortAndDie( ); } - if( $r > 0 ) { + + # Check the pipestatus as it will indicate if something horrendously wrong + # occurred with mysqldump + unless (open(PIPESTATUS, $pipestatus)) { + &printAndDie( "Could not read pipestatus file for pipe exitcode ".$pipestatus."\n" ); + } + my @pipe_exitcodes = <PIPESTATUS>; + close(PIPESTATUS); + if( ! @pipe_exitcodes ) { + &printAndDie( "Could not get pipe exitcodes!" ); + } + + # Check exitcode of every command in pipeline + my $pipe_exit = 0; + my @s_exitcodes = split(/\s+/, $pipe_exitcodes[0]); + foreach (@s_exitcodes) { + if ($_ > 0) { + $pipe_exit = $_; + last; + } + } + + if( $r > 0 or $pipe_exit > 0) { &printLog("Command exit status is : $r \n" ); &printCommandOutputToLog( "ERROR", "command is : $command", $CMDERR ); &printCommandOutputToLog( "ERROR", "pipe exit status", $pipestatus ); @@ -1841,8 +1863,8 @@ }elsif ( -s $CMDERR ) { &printCommandOutputToLog( ($CMDERR =~ /warning/i) ? "INFO" : "WARNING", "mysqldump output for command : $command", $CMDERR ); } unlink($CMDERR); unlink($pipestatus); } sub checkAndBackupReplicationData() Can anyone comment on this?