feature/changelog: Virtual xattr to trigger explicit sync in geo-rep.

A virtual xattr "glusterfs.geo-rep.trigger-sync" is provided
in glusterfs through changelog translator. Geo-rep triggers
a explicit data sync on setting this xattr on a file.
Changelog captures a DATA entry on file's gfid on setting this
virtual xattr on a file. This is supported only for files. It
doesn't support directories.

Usage: setfattr -n glusterfs.geo-rep.trigger-sync <file-path>

Change-Id: Ia689326ac2dcb31035ffbecad2c548eda4eb9245
BUG: 1176934
Signed-off-by: Kotresh HR <khiremat@redhat.com>
Reviewed-on: http://review.gluster.org/9337
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Venky Shankar <vshankar@redhat.com>
Tested-by: Venky Shankar <vshankar@redhat.com>
This commit is contained in:
Kotresh HR 2014-12-24 21:26:28 +05:30 committed by Venky Shankar
parent 41e0e325aa
commit 5e7e12694e
2 changed files with 12 additions and 0 deletions

View File

@ -131,6 +131,7 @@
#define QUOTA_SIZE_KEY "trusted.glusterfs.quota.size"
#define GFID_TO_PATH_KEY "glusterfs.gfid2path"
#define GF_XATTR_STIME_PATTERN "trusted.glusterfs.*.stime"
#define GF_XATTR_TRIGGER_SYNC "glusterfs.geo-rep.trigger-sync"
/* Index xlator related */
#define GF_XATTROP_INDEX_GFID "glusterfs.xattrop_index_gfid"

View File

@ -1326,6 +1326,17 @@ changelog_setxattr (call_frame_t *frame,
CHANGELOG_INIT (this, frame->local,
loc->inode, loc->inode->gfid, 1);
/* On setting this virtual xattr on a file, an explicit data
sync is triggered from geo-rep as DATA entry is recorded
in changelog. */
if (dict_get (dict, GF_XATTR_TRIGGER_SYNC)
&& loc->inode->ia_type != IA_IFDIR) {
changelog_update (this, priv, frame->local,
CHANGELOG_TYPE_DATA);
CHANGELOG_STACK_UNWIND (setxattr, frame, 0, 0, xdata);
return 0;
}
co = changelog_get_usable_buffer (frame->local);
if (!co)
goto wind;