summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd
diff options
context:
space:
mode:
authorJoseph Fernandes <josferna@redhat.com>2015-03-18 19:55:31 +0530
committerVijay Bellur <vbellur@redhat.com>2015-03-19 01:31:29 -0700
commitb4a0db5ee3b827268fe1aeeed32ad7d417460c50 (patch)
treed79b3182062aa5c1b50eee24b0866d47fa7824c3 /xlators/mgmt/glusterd
parenta1755ee2765f3d1c9c26d51a49ad63d133932710 (diff)
Adding ChangeTimeRecorder(CTR) Xlator to GlusterFS
********************************************************************** ChangeTimeRecorder(CTR) Xlator | ********************************************************************** ChangeTimeRecorder(CTR) is server side xlator(translator) which sits just above posix xlator. The main role of this xlator is to record the access/write patterns on a file residing the brick. It records the read(only data) and write(data and metadata) times and also count on how many times a file is read or written. This xlator also captures the hard links to a file(as its required by data tiering to move files). CTR Xlator is the consumer of libgfdb. To Enable/Disable CTR Xlator: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ gluster volume set <volume-name> features.ctr-enabled {on/off} To Enable/Disable Frequency Counter Recording in CTR Xlator: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ gluster volume set <volume-name> features.record-counters {on/off} Change-Id: I5d3cf056af61ac8e3f8250321a27cb240a214ac2 BUG: 1194753 Signed-off-by: Joseph Fernandes <josferna@redhat.com> Reviewed-on: http://review.gluster.org/9935 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c71
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-set.c15
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.h17
3 files changed, 98 insertions, 5 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index c140e680261..114e57485fc 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -1560,6 +1560,73 @@ out:
}
static int
+brick_graph_add_changetimerecorder (volgen_graph_t *graph,
+ glusterd_volinfo_t *volinfo,
+ dict_t *set_dict,
+ glusterd_brickinfo_t *brickinfo)
+{
+ xlator_t *xl = NULL;
+ int ret = -1;
+ glusterd_brickinfo_t *brickiter = NULL;
+ glusterd_brickinfo_t *tmp = NULL;
+ char *brickname = NULL;
+ char *path = NULL;
+ char *volname = NULL;
+ int bricknum = 0;
+ char index_basepath[PATH_MAX] = {0};
+
+ if (!graph || !volinfo || !set_dict || !brickinfo)
+ goto out;
+
+ path = brickinfo->path;
+
+ xl = volgen_graph_add (graph, "features/changetimerecorder",
+ volinfo->volname);
+
+
+ ret = xlator_set_option (xl, "db-type", "sqlite3");
+ if (ret)
+ goto out;
+
+ bricknum = 0;
+ list_for_each_entry_safe (brickiter, tmp, &volinfo->bricks,
+ brick_list) {
+ if (brickiter == brickinfo)
+ break;
+ bricknum++;
+ }
+ if (bricknum < volinfo->tier_info.hot_brick_count) {
+ ret = xlator_set_option (xl, "hot-brick", "on");
+ } else {
+ ret = xlator_set_option (xl, "hot-brick", "off");
+ }
+
+ brickname = strrchr(path, '/') + 1;
+ snprintf (index_basepath, sizeof (index_basepath), "%s.db",
+ brickname);
+ ret = xlator_set_option (xl, "db-name", index_basepath);
+ if (ret)
+ goto out;
+
+ snprintf (index_basepath, sizeof (index_basepath), "%s/%s",
+ path, ".glusterfs/");
+ ret = xlator_set_option (xl, "db-path", index_basepath);
+ if (ret)
+ goto out;
+
+ ret = xlator_set_option (xl, "record-exit", "off");
+ if (ret)
+ goto out;
+
+ ret = xlator_set_option (xl, "record-entry", "on");
+ if (ret)
+ goto out;
+
+out:
+ return ret;
+}
+
+static int
brick_graph_add_acl (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
dict_t *set_dict, glusterd_brickinfo_t *brickinfo)
{
@@ -2071,6 +2138,7 @@ static volgen_brick_xlator_t server_graph_table[] = {
{brick_graph_add_locks, "locks"},
{brick_graph_add_acl, "acl"},
{brick_graph_add_changelog, "changelog"},
+ {brick_graph_add_changetimerecorder, "changetimerecorder"},
{brick_graph_add_bd, "bd"},
{brick_graph_add_trash, "trash"},
{brick_graph_add_posix, "posix"},
@@ -3554,8 +3622,7 @@ nfs_option_handler (volgen_graph_t *graph,
return -1;
}
-
- if ((strcmp (vme->voltype, "nfs/server") == 0) &&
+ if ((strcmp (vme->voltype, "nfs/server") == 0) &&
(vme->option && vme->option[0]!='!') ) {
ret = xlator_set_option (xl, vme->option, vme->value);
if (ret)
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
index cae7c07ed53..ae866b7ccfc 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
@@ -523,8 +523,6 @@ struct volopt_map_entry glusterd_volopt_map[] = {
.op_version = GD_OP_VERSION_3_7_0,
.flags = OPT_FLAG_CLIENT_OPT
},
-
- /* Stripe xlator options */
{ .key = "cluster.stripe-block-size",
.voltype = "cluster/stripe",
.option = "block-size",
@@ -1692,6 +1690,18 @@ struct volopt_map_entry glusterd_volopt_map[] = {
.voltype = "features/trash",
.op_version = GD_OP_VERSION_3_7_0,
},
+ { .key = "features.ctr-enabled",
+ .voltype = "features/changetimerecorder",
+ .value = "off",
+ .option = "ctr-enabled",
+ .op_version = GD_OP_VERSION_3_7_0
+ },
+ { .key = "features.record-counters",
+ .voltype = "features/changetimerecorder",
+ .value = "off",
+ .option = "record-counters",
+ .op_version = GD_OP_VERSION_3_7_0
+ },
{ .key = "locks.trace",
.voltype = "features/locks",
.type = NO_DOC,
@@ -1727,7 +1737,6 @@ struct volopt_map_entry glusterd_volopt_map[] = {
.type = NO_DOC,
.op_version = GD_OP_VERSION_3_7_0,
},
-
{ .key = NULL
}
};
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
index f70a4c85822..ad280eda053 100644
--- a/xlators/mgmt/glusterd/src/glusterd.h
+++ b/xlators/mgmt/glusterd/src/glusterd.h
@@ -293,11 +293,26 @@ typedef enum gd_quorum_status_ {
DOESNT_MEET_QUORUM, //Follows quorum and does not meet.
} gd_quorum_status_t;
+typedef struct tier_info_ {
+ int cold_type;
+ int cold_brick_count;
+ int cold_replica_count;
+ int cold_disperse_count;
+ int cold_dist_leaf_count;
+ int hot_type;
+ int hot_brick_count;
+ int hot_replica_count;
+ int hot_disperse_count;
+ /*Commented for now Dan's DHT Tier patch will have it*/
+ /*tier_group_t *root;*/
+} gd_tier_info_t;
+
struct glusterd_volinfo_ {
gf_lock_t lock;
gf_boolean_t is_snap_volume;
glusterd_snap_t *snapshot;
uuid_t restored_from_snap;
+ gd_tier_info_t tier_info;
char parent_volname[GD_VOLUME_NAME_MAX];
/* In case of a snap volume
i.e (is_snap_volume == TRUE) this
@@ -983,6 +998,7 @@ int glusterd_op_stage_clearlocks_volume (dict_t *dict, char **op_errstr);
int glusterd_op_clearlocks_volume (dict_t *dict, char **op_errstr,
dict_t *rsp_dict);
+
int glusterd_op_stage_barrier (dict_t *dict, char **op_errstr);
int glusterd_op_barrier (dict_t *dict, char **op_errstr);
@@ -999,6 +1015,7 @@ int glusterd_op_gsync_args_get (dict_t *dict, char **op_errstr,
int glusterd_start_volume (glusterd_volinfo_t *volinfo, int flags,
gf_boolean_t wait);
+
int glusterd_stop_volume (glusterd_volinfo_t *volinfo);
/* Synctask part */