From 12480df27becfc5aef5ff0f1d712d4d73c894c7a Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Thu, 2 Feb 2012 19:14:28 +0530 Subject: features/index: Index translator implementation Change-Id: If8a11ecbdd010f64fb4409add5751080f4b59086 BUG: 763820 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.com/2722 Tested-by: Gluster Build System Reviewed-by: Jeff Darcy Reviewed-by: Vijay Bellur --- xlators/mgmt/glusterd/src/glusterd-volgen.c | 47 ++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 14 deletions(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-volgen.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c index ac5378b1acb..f3d29434161 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -1539,20 +1539,21 @@ static int server_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo, dict_t *set_dict, void *param) { - char *volname = NULL; - char *path = NULL; - int pump = 0; - xlator_t *xl = NULL; - xlator_t *txl = NULL; - xlator_t *rbxl = NULL; - char transt[16] = {0,}; - char *ptranst = NULL; - char volume_id[64] = {0,}; - char tstamp_file[PATH_MAX] = {0,}; - int ret = 0; - char *xlator = NULL; - char *loglevel = NULL; - char key[1024] = {0}; + char *volname = NULL; + char *path = NULL; + int pump = 0; + xlator_t *xl = NULL; + xlator_t *txl = NULL; + xlator_t *rbxl = NULL; + char transt[16] = {0,}; + char *ptranst = NULL; + char volume_id[64] = {0,}; + char tstamp_file[PATH_MAX] = {0,}; + int ret = 0; + char *xlator = NULL; + char *loglevel = NULL; + char index_basepath[PATH_MAX] = {0}; + char key[1024] = {0}; path = param; volname = volinfo->volname; @@ -1611,6 +1612,24 @@ server_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo, if (ret) return -1; + if (glusterd_is_volume_replicate (volinfo)) { + xl = volgen_graph_add (graph, "features/index", volname); + if (!xl) + return -1; + + snprintf (index_basepath, sizeof (index_basepath), "%s/%s", + path, ".glusterfs/indices"); + ret = xlator_set_option (xl, "index-base", index_basepath); + if (ret) + return -1; + + ret = check_and_add_debug_xl (graph, set_dict, volname, + "index"); + if (ret) + return -1; + + } + ret = dict_get_int32 (volinfo->dict, "enable-pump", &pump); if (ret == -ENOENT) ret = pump = 0; -- cgit