summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-volume-set.c
diff options
context:
space:
mode:
authorJoseph Fernandes <josferna@redhat.com>2015-12-15 18:29:06 +0530
committerDan Lambright <dlambrig@redhat.com>2015-12-22 14:45:20 -0800
commita7de0cd095f799e3128f74fcccc57ac4d6fd0b6d (patch)
tree88c29606bcffa1252ac34f6f7a5ff52be1001c5b /xlators/mgmt/glusterd/src/glusterd-volume-set.c
parent7223062cdc1934a6694265cfd73b9cc5a8c4f377 (diff)
ctr/sql: Providing for vol set for sqlcachesize and sqlWALsize and skip recording path
1. Providing vol set option for cache size and wal autocheck point so that performance can be tuned. 2. Removed recording of file path in the db. Trimming database columns. Path need not be stored in the db, as PARGFID, GFID, Basename is suffice to derive the path during migration. Backport of http://review.gluster.org/12972 > Change-Id: I2cb590451a6d244bc91fe66c6dbffe2c2059dfb8 > BUG: 1293034 > Signed-off-by: Joseph Fernandes <josferna@redhat.com> > Reviewed-on: http://review.gluster.org/12972 > Reviewed-by: N Balachandran <nbalacha@redhat.com> > Tested-by: Gluster Build System <jenkins@build.gluster.com> > Tested-by: NetBSD Build System <jenkins@build.gluster.org> > Reviewed-by: Dan Lambright <dlambrig@redhat.com> > Tested-by: Dan Lambright <dlambrig@redhat.com> Signed-off-by: Joseph Fernandes <josferna@redhat.com> Change-Id: Ia1c109983ec6ce75ed27b8c08f454f5b6283c31d BUG: 1293659 Reviewed-on: http://review.gluster.org/13067 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Dan Lambright <dlambrig@redhat.com> Tested-by: Dan Lambright <dlambrig@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-volume-set.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-set.c99
1 files changed, 95 insertions, 4 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
index b3112ca75f5..54b24d87e70 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
@@ -82,15 +82,15 @@ validate_tier_counters (glusterd_volinfo_t *volinfo,
current_rt = get_tier_freq_threshold (volinfo,
"cluster.read-freq-threshold");
if (current_rt == -1) {
- snprintf (errstr, sizeof (errstr), " Failed to retrive value of"
- "cluster.read-freq-threshold");
+ snprintf (errstr, sizeof (errstr), " Failed to retrieve value"
+ " of cluster.read-freq-threshold");
goto out;
}
current_wt = get_tier_freq_threshold (volinfo,
"cluster.write-freq-threshold");
if (current_wt == -1) {
- snprintf (errstr, sizeof (errstr), " Failed to retrive value of"
- "cluster.write-freq-threshold");
+ snprintf (errstr, sizeof (errstr), " Failed to retrieve value "
+ "of cluster.write-freq-threshold");
goto out;
}
/* If record-counters is set to off */
@@ -138,6 +138,69 @@ out:
}
+
+/*
+ * Validation function for ctr sql params
+ * features.ctr-sql-db-cachesize (Range: 1000 to 262144 pages)
+ * features.ctr-sql-db-wal-autocheckpoint (Range: 1000 to 262144 pages)
+ * */
+static int
+validate_ctr_sql_params (glusterd_volinfo_t *volinfo,
+ dict_t *dict,
+ char *key,
+ char *value,
+ char **op_errstr)
+{
+ int ret = -1;
+ xlator_t *this = NULL;
+ char errstr[2048] = "";
+ int origin_val = -1;
+
+ this = THIS;
+ GF_ASSERT (this);
+
+
+ ret = gf_string2int (value, &origin_val);
+ if (ret) {
+ snprintf (errstr, sizeof (errstr), "%s is not a compatible "
+ "value. %s expects an integer value.", value, key);
+ ret = -1;
+ goto out;
+ }
+
+ if (origin_val < 0) {
+ snprintf (errstr, sizeof (errstr), "%s is not a "
+ "compatible value. %s expects a positive"
+ "integer value.", value, key);
+ ret = -1;
+ goto out;
+ }
+
+ if (strstr (key, "sql-db-cachesize") ||
+ strstr (key, "sql-db-wal-autocheckpoint")) {
+ if ((origin_val < 1000) || (origin_val > 262144)) {
+ snprintf (errstr, sizeof (errstr), "%s is not a "
+ "compatible value. %s "
+ "expects a value between : "
+ "1000 to 262144.",
+ value, key);
+ ret = -1;
+ goto out;
+ }
+ }
+
+
+ ret = 0;
+out:
+ if (ret) {
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+ GD_MSG_INCOMPATIBLE_VALUE, "%s", errstr);
+ *op_errstr = gf_strdup (errstr);
+ }
+ return ret;
+}
+
+
/* Validation for tiering frequency thresholds
* If any of the frequency thresholds are set to a non-zero value,
* switch record-counters on, if not already on
@@ -2383,6 +2446,34 @@ struct volopt_map_entry glusterd_volopt_map[] = {
"hits an attempt to heal the database per "
"inode is done"
},
+ { .key = "features.ctr-sql-db-cachesize",
+ .voltype = "features/changetimerecorder",
+ .value = "1000",
+ .option = "sql-db-cachesize",
+ .validate_fn = validate_ctr_sql_params,
+ .op_version = GD_OP_VERSION_3_7_7,
+ .description = "Defines the cache size of the sqlite database of "
+ "changetimerecorder xlator."
+ "The input to this option is in pages."
+ "Each page is 4096 bytes. Default value is 1000 "
+ "pages i.e ~ 4 MB. "
+ "The max value is 262144 pages i.e 1 GB and "
+ "the min value is 1000 pages i.e ~ 4 MB. "
+ },
+ { .key = "features.ctr-sql-db-wal-autocheckpoint",
+ .voltype = "features/changetimerecorder",
+ .value = "1000",
+ .option = "sql-db-wal-autocheckpoint",
+ .validate_fn = validate_ctr_sql_params,
+ .op_version = GD_OP_VERSION_3_7_7,
+ .description = "Defines the autocheckpoint of the sqlite database of "
+ " changetimerecorder. "
+ "The input to this option is in pages. "
+ "Each page is 4096 bytes. Default value is 1000 "
+ "pages i.e ~ 4 MB."
+ "The max value is 262144 pages i.e 1 GB and "
+ "the min value is 1000 pages i.e ~4 MB."
+ },
#endif /* USE_GFDB */
{ .key = "locks.trace",
.voltype = "features/locks",