diff options
author | Joseph Fernandes <josferna@redhat.com> | 2015-12-15 18:29:06 +0530 |
---|---|---|
committer | Dan Lambright <dlambrig@redhat.com> | 2015-12-22 14:45:20 -0800 |
commit | a7de0cd095f799e3128f74fcccc57ac4d6fd0b6d (patch) | |
tree | 88c29606bcffa1252ac34f6f7a5ff52be1001c5b /xlators/features/changetimerecorder | |
parent | 7223062cdc1934a6694265cfd73b9cc5a8c4f377 (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/features/changetimerecorder')
3 files changed, 47 insertions, 29 deletions
diff --git a/xlators/features/changetimerecorder/src/changetimerecorder.c b/xlators/features/changetimerecorder/src/changetimerecorder.c index 04cd3145d95..de42c3f629b 100644 --- a/xlators/features/changetimerecorder/src/changetimerecorder.c +++ b/xlators/features/changetimerecorder/src/changetimerecorder.c @@ -106,7 +106,6 @@ ctr_lookup_wind(call_frame_t *frame, goto out; }; ctr_local = frame->local; - ctr_local->client_pid = frame->root->pid; /*Definately no internal fops will reach here*/ ctr_local->is_internal_fop = _gf_false; /*Dont record counters*/ @@ -128,8 +127,6 @@ ctr_lookup_wind(call_frame_t *frame, *((NEW_LINK_CX(ctr_inode_cx))->pargfid)); strcpy (CTR_DB_REC(ctr_local).file_name, NEW_LINK_CX(ctr_inode_cx)->basename); - strcpy (CTR_DB_REC(ctr_local).file_path, - NEW_LINK_CX(ctr_inode_cx)->basepath); /* Since we are in lookup we can ignore errors while * Inserting in the DB, because there may be many @@ -333,8 +330,7 @@ ctr_lookup (call_frame_t *frame, xlator_t *this, goto out; /*fill ctr link context*/ - FILL_CTR_LINK_CX(_link_cx, loc->parent->gfid, loc->name, - loc->path, out); + FILL_CTR_LINK_CX(_link_cx, loc->parent->gfid, loc->name, out); /* Fill ctr inode context*/ /* IA_IFREG : We assume its a file in the wind @@ -901,12 +897,10 @@ ctr_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc, CTR_IF_INTERNAL_FOP_THEN_GOTO (frame, xdata, out); /*Fill old link context*/ - FILL_CTR_LINK_CX(_olink_cx, oldloc->pargfid, oldloc->name, - oldloc->path, out); + FILL_CTR_LINK_CX(_olink_cx, oldloc->pargfid, oldloc->name, out); /*Fill new link context*/ - FILL_CTR_LINK_CX(_nlink_cx, newloc->pargfid, newloc->name, - newloc->path, out); + FILL_CTR_LINK_CX(_nlink_cx, newloc->pargfid, newloc->name, out); /*Fill ctr inode context*/ FILL_CTR_INODE_CONTEXT(_inode_cx, oldloc->inode->ia_type, @@ -1076,7 +1070,7 @@ ctr_unlink (call_frame_t *frame, xlator_t *this, CTR_IS_DISABLED_THEN_GOTO(this, out); /*Fill link context*/ - FILL_CTR_LINK_CX(_link_cx, loc->pargfid, loc->name, loc->path, out); + FILL_CTR_LINK_CX(_link_cx, loc->pargfid, loc->name, out); /*Fill ctr inode context*/ FILL_CTR_INODE_CONTEXT(_inode_cx, loc->inode->ia_type, @@ -1393,7 +1387,7 @@ ctr_mknod (call_frame_t *frame, xlator_t *this, gf_uuid_copy (gfid, uuid_req); /*fill ctr link context*/ - FILL_CTR_LINK_CX (_link_cx, loc->pargfid, loc->name, loc->path, out); + FILL_CTR_LINK_CX (_link_cx, loc->pargfid, loc->name, out); /*Fill ctr inode context*/ FILL_CTR_INODE_CONTEXT (_inode_cx, loc->inode->ia_type, @@ -1484,7 +1478,7 @@ ctr_create (call_frame_t *frame, xlator_t *this, gf_uuid_copy (gfid, uuid_req); /*fill ctr link context*/ - FILL_CTR_LINK_CX(_link_cx, loc->pargfid, loc->name, loc->path, out); + FILL_CTR_LINK_CX(_link_cx, loc->pargfid, loc->name, out); /*Fill ctr inode context*/ FILL_CTR_INODE_CONTEXT(_inode_cx, loc->inode->ia_type, @@ -1566,8 +1560,7 @@ ctr_link (call_frame_t *frame, xlator_t *this, GF_ASSERT(frame->root); /*fill ctr link context*/ - FILL_CTR_LINK_CX(_link_cx, newloc->pargfid, newloc->name, - newloc->path, out); + FILL_CTR_LINK_CX(_link_cx, newloc->pargfid, newloc->name, out); /*Fill ctr inode context*/ FILL_CTR_INODE_CONTEXT(_inode_cx, oldloc->inode->ia_type, @@ -1880,7 +1873,7 @@ ctr_ipc_helper (xlator_t *this, dict_t *in_dict, goto out; } - ret = get_db_setting (priv->_db_conn, db_param_key, &db_param); + ret = get_db_params (priv->_db_conn, db_param_key, &db_param); if (ret == -1 || !db_param) { goto out; } @@ -1954,7 +1947,6 @@ out: /******************************************************************************/ - int reconfigure (xlator_t *this, dict_t *options) { @@ -1965,7 +1957,7 @@ reconfigure (xlator_t *this, dict_t *options) priv = this->private; if (dict_get_str(options, "changetimerecorder.frequency", &temp_str)) { - gf_msg(this->name, GF_LOG_INFO, 0, CTR_MSG_SET, "set!"); + gf_msg(this->name, GF_LOG_INFO, 0, CTR_MSG_SET, "set"); } GF_OPTION_RECONF ("ctr-enabled", priv->enabled, options, @@ -1995,6 +1987,41 @@ reconfigure (xlator_t *this, dict_t *options) GF_OPTION_RECONF ("record-entry", priv->ctr_record_wind, options, bool, out); + + + + /* If database is sqlite */ + if (priv->gfdb_db_type == GFDB_SQLITE3) { + + /* AUTOCHECKPOINT */ + if (dict_get_str (options, GFDB_SQL_PARAM_WAL_AUTOCHECK, + &temp_str) == 0) { + ret = set_db_params (priv->_db_conn, + "wal_autocheckpoint", temp_str); + if (ret) { + gf_msg (this->name, GF_LOG_ERROR, 0, + CTR_MSG_SET_VALUE_TO_SQL_PARAM_FAILED, + "Failed to set %s", + GFDB_SQL_PARAM_WAL_AUTOCHECK); + } + } + + /* CACHE_SIZE */ + if (dict_get_str (options, GFDB_SQL_PARAM_CACHE_SIZE, &temp_str) + == 0) { + ret = set_db_params (priv->_db_conn, "cache_size", + temp_str); + if (ret) { + gf_msg (this->name, GF_LOG_ERROR, 0, + CTR_MSG_SET_VALUE_TO_SQL_PARAM_FAILED, + "Failed to set %s", + GFDB_SQL_PARAM_CACHE_SIZE); + } + } + } + + ret = 0; + out: return ret; diff --git a/xlators/features/changetimerecorder/src/ctr-helper.c b/xlators/features/changetimerecorder/src/ctr-helper.c index 44abf7d5142..263eb58db6f 100644 --- a/xlators/features/changetimerecorder/src/ctr-helper.c +++ b/xlators/features/changetimerecorder/src/ctr-helper.c @@ -138,8 +138,6 @@ fill_db_record_for_wind (xlator_t *this, *((NEW_LINK_CX(ctr_inode_cx))->pargfid)); strcpy (CTR_DB_REC(ctr_local).file_name, NEW_LINK_CX(ctr_inode_cx)->basename); - strcpy (CTR_DB_REC(ctr_local).file_path, - NEW_LINK_CX(ctr_inode_cx)->basepath); } /*rename fop*/ if (OLD_LINK_CX(ctr_inode_cx)) { @@ -147,8 +145,6 @@ fill_db_record_for_wind (xlator_t *this, *((OLD_LINK_CX(ctr_inode_cx))->pargfid)); strcpy (CTR_DB_REC(ctr_local).old_file_name, OLD_LINK_CX(ctr_inode_cx)->basename); - strcpy (CTR_DB_REC(ctr_local).old_path, - OLD_LINK_CX(ctr_inode_cx)->basepath); } } diff --git a/xlators/features/changetimerecorder/src/ctr-helper.h b/xlators/features/changetimerecorder/src/ctr-helper.h index 246468287f4..cf71337a8f5 100644 --- a/xlators/features/changetimerecorder/src/ctr-helper.h +++ b/xlators/features/changetimerecorder/src/ctr-helper.h @@ -102,8 +102,8 @@ do {\ 0, sizeof(gfdb_time_t));\ gf_uuid_clear (ctr_local->gfdb_db_record.gfid);\ gf_uuid_clear (ctr_local->gfdb_db_record.pargfid);\ - memset(ctr_local->gfdb_db_record.file_name, 0, PATH_MAX);\ - memset(ctr_local->gfdb_db_record.old_file_name, 0, PATH_MAX);\ + memset(ctr_local->gfdb_db_record.file_name, 0, GF_NAME_MAX + 1);\ + memset(ctr_local->gfdb_db_record.old_file_name, 0, GF_NAME_MAX + 1);\ ctr_local->gfdb_db_record.gfdb_fop_type = GFDB_FOP_INVALID_OP;\ ctr_local->ia_inode_type = IA_INVAL;\ } while (0) @@ -164,8 +164,6 @@ free_ctr_local (gf_ctr_local_t *ctr_local) typedef struct gf_ctr_link_context { uuid_t *pargfid; const char *basename; - /*basepath is redundent. Will go off*/ - const char *basepath; } gf_ctr_link_context_t; /*Context Carrier Structure for inodes*/ @@ -192,21 +190,18 @@ do {\ if (ctr_link_cx->pargfid)\ GF_ASSERT (*(ctr_link_cx->pargfid));\ GF_ASSERT (ctr_link_cx->basename);\ - GF_ASSERT (ctr_link_cx->basepath);\ };\ } while (0) /*Clear and fill the ctr_link_context with values*/ -#define FILL_CTR_LINK_CX(ctr_link_cx, _pargfid, _basename, _basepath, label)\ +#define FILL_CTR_LINK_CX(ctr_link_cx, _pargfid, _basename, label)\ do {\ GF_VALIDATE_OR_GOTO ("ctr", ctr_link_cx, label);\ GF_VALIDATE_OR_GOTO ("ctr", _pargfid, label);\ GF_VALIDATE_OR_GOTO ("ctr", _basename, label);\ - GF_VALIDATE_OR_GOTO ("ctr", _basepath, label);\ memset (ctr_link_cx, 0, sizeof (*ctr_link_cx));\ ctr_link_cx->pargfid = &_pargfid;\ ctr_link_cx->basename = _basename;\ - ctr_link_cx->basepath = _basepath;\ } while (0) #define NEW_LINK_CX(ctr_inode_cx)\ |