a3470f
From 2d1c394b7ea9913c69445d865fb8762ecb4917ce Mon Sep 17 00:00:00 2001
a3470f
From: Kotresh HR <khiremat@redhat.com>
a3470f
Date: Mon, 7 May 2018 01:23:46 -0400
a3470f
Subject: [PATCH 253/260] geo-rep: Fix upgrade issue
a3470f
a3470f
Cause and Analysis:
a3470f
The last synced changelog for entry operations is
a3470f
marked in current version to avoid re-processing
a3470f
of already processed entry operations in a batch
a3470f
during crash/restart of geo-rep. This was not
a3470f
present in previous versoins.
a3470f
a3470f
The marker is maintained in the dictionary with the
a3470f
key 'last_synced_entry' and dictionary is persisted
a3470f
into status file. So upgrading to current version in
a3470f
which the marker is present was failing with KeyError.
a3470f
a3470f
Solution:
a3470f
Load the dictionary with default keys first which
a3470f
contains all the keys including latest ones and then
a3470f
load the values from status file instead of doing
a3470f
otherwise.
a3470f
a3470f
Upstream reference:
a3470f
  > fixes: bz#1575490
a3470f
  > Patch: https://review.gluster.org/19969
a3470f
a3470f
BUG: 1569490
a3470f
Change-Id: Ic654e6f9a3c97f616761f1362f890352a2186fb4
a3470f
Signed-off-by: Kotresh HR <khiremat@redhat.com>
a3470f
Reviewed-on: https://code.engineering.redhat.com/gerrit/137909
a3470f
Tested-by: RHGS Build Bot <nigelb@redhat.com>
a3470f
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
a3470f
---
a3470f
 geo-replication/syncdaemon/gsyncdstatus.py | 5 +++--
a3470f
 1 file changed, 3 insertions(+), 2 deletions(-)
a3470f
a3470f
diff --git a/geo-replication/syncdaemon/gsyncdstatus.py b/geo-replication/syncdaemon/gsyncdstatus.py
a3470f
index 38ca92c..909c669 100644
a3470f
--- a/geo-replication/syncdaemon/gsyncdstatus.py
a3470f
+++ b/geo-replication/syncdaemon/gsyncdstatus.py
a3470f
@@ -152,11 +152,12 @@ class GeorepStatus(object):
a3470f
                  **kwargs)
a3470f
 
a3470f
     def _update(self, mergerfunc):
a3470f
+        data = self.default_values
a3470f
         with LockedOpen(self.filename, 'r+') as f:
a3470f
             try:
a3470f
-                data = json.load(f)
a3470f
+                data.update(json.load(f))
a3470f
             except ValueError:
a3470f
-                data = self.default_values
a3470f
+                pass
a3470f
 
a3470f
             data = mergerfunc(data)
a3470f
             # If Data is not changed by merger func
a3470f
-- 
a3470f
1.8.3.1
a3470f