Bug 1151623 - mysql-zrm doesn't check the exitcode of all the commands in the pipeline
Summary: mysql-zrm doesn't check the exitcode of all the commands in the pipeline
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: MySQL-zrm
Version: el6
Hardware: All
OS: Linux
unspecified
urgent
Target Milestone: ---
Assignee: Orion Poplawski
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-10-10 20:03 UTC by Kris
Modified: 2017-08-31 15:16 UTC (History)
2 users (show)

Fixed In Version: MySQL-zrm-3.0-6.el6.1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-31 15:16:40 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Kris 2014-10-10 20:03:57 UTC
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?

Comment 1 Fedora Update System 2017-06-15 20:24:00 UTC
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

Comment 2 Fedora Update System 2017-06-16 19:17:40 UTC
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

Comment 3 Fedora Update System 2017-08-31 15:16:40 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.