summaryrefslogtreecommitdiffstats
path: root/heal/src/glfs-heal.c
diff options
context:
space:
mode:
authorRavishankar N <ravishankar@redhat.com>2016-03-25 18:48:30 +0530
committerJeff Darcy <jdarcy@redhat.com>2016-03-29 12:08:35 -0700
commit08d18ef9257067fac510af408665360019566000 (patch)
treee3249b6473048e86ce9fb264fb84ba0af2fd82f9 /heal/src/glfs-heal.c
parenta28484443f27332c1a87e00e474ca56427a83669 (diff)
afr: add mtime based split-brain resolution to CLI
Extended the CLI to include support for split-brain resolution based on mtime. The command syntax is: $:gluster volume heal <VOLNAME> split-brain latest-mtime <FILE> where <FILE> can be either the full file name as seen from the root of the volume (or) the gfid-string representation of the file. Change-Id: I7a16f72ff1a4495aa69f43f22758a9404e958b4f BUG: 1321322 Signed-off-by: Ravishankar N <ravishankar@redhat.com> Reviewed-on: http://review.gluster.org/13828 Smoke: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Diffstat (limited to 'heal/src/glfs-heal.c')
-rw-r--r--heal/src/glfs-heal.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/heal/src/glfs-heal.c b/heal/src/glfs-heal.c
index 076b631..4f636c6 100644
--- a/heal/src/glfs-heal.c
+++ b/heal/src/glfs-heal.c
@@ -24,6 +24,7 @@
#define DEFAULT_HEAL_LOG_FILE_DIRECTORY DATADIR "/log/glusterfs"
#define USAGE_STR "Usage: %s <VOLNAME> [bigger-file <FILE> | "\
+ "latest-mtime <FILE> | "\
"source-brick <HOSTNAME:BRICKNAME> [<FILE>] | "\
"split-brain-info]\n"
@@ -803,8 +804,9 @@ out:
}
int
-glfsh_heal_from_bigger_file (glfs_t *fs, xlator_t *top_subvol, loc_t *rootloc,
- char *file)
+glfsh_heal_from_bigger_file_or_mtime (glfs_t *fs, xlator_t *top_subvol,
+ loc_t *rootloc, char *file,
+ gf_xl_afr_op_t heal_op)
{
int ret = -1;
@@ -813,8 +815,7 @@ glfsh_heal_from_bigger_file (glfs_t *fs, xlator_t *top_subvol, loc_t *rootloc,
xattr_req = dict_new();
if (!xattr_req)
goto out;
- ret = dict_set_int32 (xattr_req, "heal-op",
- GF_SHD_OP_SBRAIN_HEAL_FROM_BIGGER_FILE);
+ ret = dict_set_int32 (xattr_req, "heal-op", heal_op);
if (ret)
goto out;
ret = glfsh_heal_splitbrain_file (fs, top_subvol, rootloc, file,
@@ -877,6 +878,9 @@ main (int argc, char **argv)
if (!strcmp (argv[2], "bigger-file")) {
heal_op = GF_SHD_OP_SBRAIN_HEAL_FROM_BIGGER_FILE;
file = argv[3];
+ } else if (!strcmp (argv[2], "latest-mtime")) {
+ heal_op = GF_SHD_OP_SBRAIN_HEAL_FROM_LATEST_MTIME;
+ file = argv[3];
} else if (!strcmp (argv[2], "source-brick")) {
heal_op = GF_SHD_OP_SBRAIN_HEAL_FROM_BRICK;
hostname = strtok (argv[3], ":");
@@ -973,8 +977,9 @@ main (int argc, char **argv)
heal_op);
break;
case GF_SHD_OP_SBRAIN_HEAL_FROM_BIGGER_FILE:
- ret = glfsh_heal_from_bigger_file (fs, top_subvol,
- &rootloc, file);
+ case GF_SHD_OP_SBRAIN_HEAL_FROM_LATEST_MTIME:
+ ret = glfsh_heal_from_bigger_file_or_mtime (fs, top_subvol,
+ &rootloc, file, heal_op);
break;
case GF_SHD_OP_SBRAIN_HEAL_FROM_BRICK:
ret = glfsh_heal_from_brick (fs, top_subvol, &rootloc,