From 5863ab43d7f3b045f5b889b98f73687b07b3f0e8 Mon Sep 17 00:00:00 2001 From: Aravinda VK Date: Tue, 26 May 2015 13:01:17 +0530 Subject: geo-rep: Fix Data counter issue in status ENTRY and META operations executed sequentially, DATA operations are handled async, increment happens when a changelog parsed. Decrement happens after the sync of all files. 'files_in_batch' was reset multiple times in batch instead of once. BUG: 1224098 Change-Id: I87617f2fd5f4d3221a1c9f9d5a8efb0686c42bbe Signed-off-by: Aravinda VK Reviewed-on: http://review.gluster.org/10911 Reviewed-by: Kotresh HR Tested-by: NetBSD Build System Tested-by: Gluster Build System --- geo-replication/syncdaemon/master.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/geo-replication/syncdaemon/master.py b/geo-replication/syncdaemon/master.py index aedfc232b07..e05dc376662 100644 --- a/geo-replication/syncdaemon/master.py +++ b/geo-replication/syncdaemon/master.py @@ -895,8 +895,8 @@ class GMasterChangelogMixin(GMasterCommon): # Increment counters for Status self.status.inc_value("entry", len(entries)) - self.files_in_batch = len(datas) - self.status.inc_value("data", self.files_in_batch) + self.files_in_batch += len(datas) + self.status.inc_value("data", len(datas)) # sync namespace if entries: @@ -930,6 +930,7 @@ class GMasterChangelogMixin(GMasterCommon): tries = 0 retry = False self.unlinked_gfids = [] + self.files_in_batch = 0 while True: self.skipped_gfid_list = [] @@ -983,6 +984,8 @@ class GMasterChangelogMixin(GMasterCommon): self.status.set_last_synced(xtl, checkpoint_time) map(self.changelog_done_func, changes) self.archive_and_purge_changelogs(changes) + + # Reset Data counter after sync self.status.dec_value("data", self.files_in_batch) self.files_in_batch = 0 break @@ -999,7 +1002,10 @@ class GMasterChangelogMixin(GMasterCommon): logging.warn('SKIPPED GFID = %s' % ','.join(self.skipped_gfid_list)) + # Reset data counter on failure + self.status.dec_value("data", self.files_in_batch) self.files_in_batch = 0 + if done: xtl = (int(change.split('.')[-1]) - 1, 0) self.upd_stime(xtl) @@ -1022,6 +1028,10 @@ class GMasterChangelogMixin(GMasterCommon): # TODO: remove entry retries when it's gets fixed. logging.warn('incomplete sync, retrying changelogs: %s' % ' '.join(map(os.path.basename, changes))) + + # Reset the Data counter before Retry + self.status.dec_value("data", self.files_in_batch) + self.files_in_batch = 0 time.sleep(0.5) def upd_stime(self, stime, path=None): -- cgit