From c3f54e65cfcc1eac71bf0530085ffac561b9ebe9 Mon Sep 17 00:00:00 2001 From: Kirill Solomko Date: Tue, 19 Jun 2018 18:10:29 +0200 Subject: [PATCH] TT#38822 helper/sync-db: ngcp.timezone sync changes * ngcp.timezone table is not updated if new timezone=old timezone * ngcp.timezone change is not replicated to preserve stability of the other (active) node and to address the replication issue during upgrade Change-Id: Id8f7b291c188792a33093ac3ed706b55d1b0a654 --- helper/sync-db | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/helper/sync-db b/helper/sync-db index afed2387..912c44df 100755 --- a/helper/sync-db +++ b/helper/sync-db @@ -160,25 +160,41 @@ sub sync_smsc_peers { sub sync_general_timezone { my $dbh = shift; my $tz = shift; + my $ok = 1; + my $pe = $dbh->{PrintError}; + my ($sql_log_bin) = $dbh->selectrow_array('SELECT @@sql_log_bin'); - unless ($tz) { - print "Error: general.timezone value is not set\n"; - return; - } + eval { + die "Error: general.timezone value is not set\n" unless $tz; - my $pe = $dbh->{PrintError}; - $dbh->{PrintError} = 0; - $dbh->do(<do("SET sql_log_bin=0"); + $dbh->{PrintError} = 0; + + my ($current_tz) = $dbh->selectrow_array(<do(<{PrintError} = $pe; - if ($DBI::err) { - print "Error: Could not insert into ngcp.timezone: $DBI::errstr\n"; - return; + if ($DBI::err) { + die "Error: Could not insert into ngcp.timezone: $DBI::errstr\n"; + } + }; + if ($@) { + print $@; + $ok = 0; } + $dbh->{PrintError} = $pe; + $dbh->do("SET sql_log_bin=$sql_log_bin"); - return 1; + return $ok; } ## /usr/share/zoneinfo into MariaDB ##############################