summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAravinda VK <avishwan@redhat.com>2014-12-23 21:13:32 +0530
committerVenky Shankar <vshankar@redhat.com>2014-12-25 09:48:57 -0800
commit92cc5d4f64d55675b45b85f612f513500d4e4fc7 (patch)
tree934d1e948edd21fffe535905ca7fcceb029e018b
parent0299f7f0f7c4d8e5e7e04d8bc1787ecbee6dbe52 (diff)
geo-rep: Sync atime, mtime to slave when SETATTR
Existing geo-rep only syncs chown and chmod, with this patch geo-rep also syncs atime and mtime. Change-Id: Iea52d86682873bb4a47eeb0d325f5b9ddf2de2cf Signed-off-by: Aravinda VK <avishwan@redhat.com> BUG: 1176934 Reviewed-on: http://review.gluster.org/9331 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Venky Shankar <vshankar@redhat.com>
-rw-r--r--geo-replication/syncdaemon/master.py14
-rw-r--r--geo-replication/syncdaemon/resource.py4
2 files changed, 15 insertions, 3 deletions
diff --git a/geo-replication/syncdaemon/master.py b/geo-replication/syncdaemon/master.py
index 51c1e571e53..48da768c935 100644
--- a/geo-replication/syncdaemon/master.py
+++ b/geo-replication/syncdaemon/master.py
@@ -742,10 +742,12 @@ class GMasterCommon(object):
class XCrawlMetadata(object):
- def __init__(self, st_uid, st_gid, st_mode):
+ def __init__(self, st_uid, st_gid, st_mode, st_atime, st_mtime):
self.st_uid = int(st_uid)
self.st_gid = int(st_gid)
self.st_mode = int(st_mode)
+ self.st_atime = float(st_atime)
+ self.st_mtime = float(st_mtime)
class GMasterChangelogMixin(GMasterCommon):
@@ -816,6 +818,8 @@ class GMasterChangelogMixin(GMasterCommon):
dst['uid'] = st.st_uid
dst['gid'] = st.st_gid
dst['mode'] = st.st_mode
+ dst['atime'] = st.st_atime
+ dst['mtime'] = st.st_mtime
else:
dct[k] = ed[k]
return dct
@@ -907,7 +911,9 @@ class GMasterChangelogMixin(GMasterCommon):
meta_gfid.add((os.path.join(pfx, ec[0]),
XCrawlMetadata(st_uid=ec[2],
st_gid=ec[3],
- st_mode=ec[4])))
+ st_mode=ec[4],
+ st_atime=ec[5],
+ st_mtime=ec[6])))
else:
meta_gfid.add((os.path.join(pfx, ec[0]), ))
else:
@@ -1482,7 +1488,9 @@ class GMasterXsyncMixin(GMasterChangelogMixin):
st.st_uid), str(st.st_gid), escape(os.path.join(pargfid,
bname))])
self.write_entry_change("M", [gfid, "SETATTR", str(st.st_uid),
- str(st.st_gid), str(st.st_mode)])
+ str(st.st_gid), str(st.st_mode),
+ str(st.st_atime),
+ str(st.st_mtime)])
self.Xcrawl(e, xtr_root)
stime_to_update = xte
if self.xsync_upper_limit:
diff --git a/geo-replication/syncdaemon/resource.py b/geo-replication/syncdaemon/resource.py
index 1e11b980ad3..c20a243352b 100644
--- a/geo-replication/syncdaemon/resource.py
+++ b/geo-replication/syncdaemon/resource.py
@@ -669,9 +669,13 @@ class Server(object):
mode = e['stat']['mode']
uid = e['stat']['uid']
gid = e['stat']['gid']
+ atime = e['stat']['atime']
+ mtime = e['stat']['mtime']
go = e['go']
errno_wrap(os.chmod, [go, mode], [ENOENT], [ESTALE, EINVAL])
errno_wrap(os.chown, [go, uid, gid], [ENOENT], [ESTALE, EINVAL])
+ errno_wrap(os.utime, [go, (atime, mtime)],
+ [ENOENT], [ESTALE, EINVAL])
@classmethod
@_pathguard