summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--geo-replication/syncdaemon/libgfchangelog.py14
-rw-r--r--geo-replication/syncdaemon/master.py13
2 files changed, 17 insertions, 10 deletions
diff --git a/geo-replication/syncdaemon/libgfchangelog.py b/geo-replication/syncdaemon/libgfchangelog.py
index e6bfbefd0a6..89ae032016f 100644
--- a/geo-replication/syncdaemon/libgfchangelog.py
+++ b/geo-replication/syncdaemon/libgfchangelog.py
@@ -9,7 +9,7 @@
#
import os
-from ctypes import CDLL, create_string_buffer, get_errno
+from ctypes import CDLL, create_string_buffer, get_errno, byref, c_ulong
from ctypes.util import find_library
from syncdutils import ChangelogException
@@ -86,12 +86,14 @@ class Changes(object):
@classmethod
def cl_history_changelog(cls, changelog_path, start, end, num_parallel):
+ actual_end = c_ulong()
ret = cls._get_api('gf_history_changelog')(changelog_path, start, end,
- num_parallel)
+ num_parallel,
+ byref(actual_end))
if ret == -1:
cls.raise_changelog_err()
- return ret
+ return (ret, actual_end.value)
@classmethod
def cl_history_startfresh(cls):
@@ -101,6 +103,10 @@ class Changes(object):
@classmethod
def cl_history_getchanges(cls):
+ """ remove hardcoding for path name length """
+ def clsort(f):
+ return f.split('.')[-1]
+
changes = []
buf = create_string_buffer('\0', 4096)
call = cls._get_api('gf_history_changelog_next_change')
@@ -113,7 +119,7 @@ class Changes(object):
if ret == -1:
cls.raise_changelog_err()
- return changes
+ return sorted(changes, key=clsort)
@classmethod
def cl_history_done(cls, clfile):
diff --git a/geo-replication/syncdaemon/master.py b/geo-replication/syncdaemon/master.py
index 1f1fa1122cb..0af21bbe99d 100644
--- a/geo-replication/syncdaemon/master.py
+++ b/geo-replication/syncdaemon/master.py
@@ -1159,10 +1159,11 @@ class GMasterChangeloghistoryMixin(GMasterChangelogMixin):
# location then consuming history will not work(Known issue as of now)
changelog_path = os.path.join(gconf.local_path,
".glusterfs/changelogs")
- ts = self.changelog_agent.history(changelog_path,
- purge_time[0],
- self.changelog_register_time,
- int(gconf.sync_jobs))
+ ret, actual_end = self.changelog_agent.history(
+ changelog_path,
+ purge_time[0],
+ self.changelog_register_time,
+ int(gconf.sync_jobs))
# scan followed by getchanges till scan returns zero.
# history_scan() is blocking call, till it gets the number
@@ -1192,8 +1193,8 @@ class GMasterChangeloghistoryMixin(GMasterChangelogMixin):
# If TS returned from history_changelog is < register_time
# then FS crawl may be required, since history is only available
# till TS returned from history_changelog
- if ts < self.changelog_register_time:
- raise PartialHistoryAvailable(str(ts))
+ if actual_end < self.changelog_register_time:
+ raise PartialHistoryAvailable(str(actual_end))
class GMasterXsyncMixin(GMasterChangelogMixin):