Commit 69c6cb5d authored by Alexey Yurchenko's avatar Alexey Yurchenko Committed by Julius Goryavsky

Fix recovering state GTID in case log file contains non-text bytes -

use grep with -a option.
Signed-off-by: default avatarJulius Goryavsky <julius.goryavsky@mariadb.com>
parent 54a10a42
......@@ -10,8 +10,8 @@ if (!$wsrep_recover_additional)
--perl
use strict;
my $wsrep_start_position_str = "grep 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'";
my $wsrep_start_position = `grep 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`;
my $wsrep_start_position_str = "grep -a 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'";
my $wsrep_start_position = `grep -a 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`;
chomp($wsrep_start_position);
die if $wsrep_start_position eq '';
......
......@@ -38,10 +38,10 @@ SELECT COUNT(*) = 1 FROM t1;
--perl
use strict;
my $wsrep_start_position1 = `grep 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.1.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`;
my $wsrep_start_position1 = `grep -a 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.1.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`;
chomp($wsrep_start_position1);
my $wsrep_start_position2 = `grep 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.2.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`;
my $wsrep_start_position2 = `grep -a 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.2.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`;
chomp($wsrep_start_position2);
die if $wsrep_start_position1 eq '' || $wsrep_start_position2 eq '';
......
......@@ -18,7 +18,7 @@
--perl
use strict;
my $wsrep_start_position = `grep 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`;
my $wsrep_start_position = `grep -a 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`;
chomp($wsrep_start_position);
die if $wsrep_start_position eq '';
open(FILE, ">", "$ENV{MYSQL_TMP_DIR}/galera_wsrep_start_position.inc") or die;
......
......@@ -81,10 +81,10 @@ wsrep_recover_position() {
# Parse server's error log for recovered position. The server prints
# "..skipping position recovery.." if started without wsrep.
recovered_pos="$(grep 'WSREP: Recovered position:' $log_file)"
recovered_pos="$(grep -a 'WSREP: Recovered position:' $log_file)"
if [ -z "$recovered_pos" ]; then
skipped="$(grep WSREP $log_file | grep 'skipping position recovery')"
skipped="$(grep -a WSREP $log_file | grep 'skipping position recovery')"
if [ -z "$skipped" ]; then
log "WSREP: Failed to recover position: '`cat $log_file`'"
exit 1
......
......@@ -260,9 +260,9 @@ wsrep_recover_position() {
exit 1
fi
local rp="$(grep 'WSREP: Recovered position:' $wr_logfile)"
local rp="$(grep -a 'WSREP: Recovered position:' $wr_logfile)"
if [ -z "$rp" ]; then
local skipped="$(grep WSREP $wr_logfile | grep 'skipping position recovery')"
local skipped="$(grep -a WSREP $wr_logfile | grep 'skipping position recovery')"
if [ -z "$skipped" ]; then
log_error "WSREP: Failed to recover position: '`cat $wr_logfile`'"
ret=1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment