diff options
author | Joseph Fernandes <josferna@redhat.com> | 2015-12-15 18:29:06 +0530 |
---|---|---|
committer | Dan Lambright <dlambrig@redhat.com> | 2015-12-22 07:14:10 -0800 |
commit | 439de31320315872d988720991e9baaead8712db (patch) | |
tree | af9003c4b83ad4983c2597c44f5c476664934074 /xlators/mgmt | |
parent | 074158e7081ff0118c719aac7cf1bcde92ee8f7d (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.
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>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volume-set.c | 99 |
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 593ae2aa833..f582009bb5b 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c @@ -77,15 +77,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 */ @@ -133,6 +133,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 @@ -2444,6 +2507,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", |