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