diff options
author | Gaurav Yadav <gyadav@redhat.com> | 2017-10-05 23:44:46 +0530 |
---|---|---|
committer | Shyamsundar Ranganathan <srangana@redhat.com> | 2018-03-20 13:58:38 +0000 |
commit | 9bd5c119076577b1029c7f451d19baa9a735a850 (patch) | |
tree | 16584311d0e8233aad585a7eaa08e60fecfe9669 /xlators/mgmt/glusterd/src/glusterd.c | |
parent | 616c5bf733e64df0f9f6822180d62418688cfc1c (diff) |
glusterd : introduce timer in mgmt_v3_lock
Problem:
In a multinode environment, if two of the op-sm transactions
are initiated on one of the receiver nodes at the same time,
there might be a possibility that glusterd may end up in
stale lock.
Solution:
During mgmt_v3_lock a registration is made to gf_timer_call_after
which release the lock after certain period of time
>Change-Id: I16cc2e5186a2e8a5e35eca2468b031811e093843
>BUG: 1499004
>Signed-off-by: Gaurav Yadav <gyadav@redhat.com>
Change-Id: I16cc2e5186a2e8a5e35eca2468b031811e093843
BUG: 1557304
Signed-off-by: Gaurav Yadav <gyadav@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c index c4661d6be4d..017cbdcf4ab 100644 --- a/xlators/mgmt/glusterd/src/glusterd.c +++ b/xlators/mgmt/glusterd/src/glusterd.c @@ -1857,6 +1857,13 @@ init (xlator_t *this) GD_MSG_DICT_SET_FAILED, "base-port override: %d", conf->base_port); } + conf->mgmt_v3_lock_timeout = GF_LOCK_TIMER; + if (dict_get_uint32 (this->options, "lock-timer", + &conf->mgmt_v3_lock_timeout) == 0) { + gf_msg (this->name, GF_LOG_INFO, 0, + GD_MSG_DICT_SET_FAILED, + "lock-timer override: %d", conf->mgmt_v3_lock_timeout); + } /* Set option to run bricks on valgrind if enabled in glusterd.vol */ conf->valgrind = _gf_false; @@ -1880,6 +1887,7 @@ init (xlator_t *this) this->private = conf; glusterd_mgmt_v3_lock_init (); + glusterd_mgmt_v3_lock_timer_init(); glusterd_txn_opinfo_dict_init (); glusterd_svcs_build (); @@ -2018,6 +2026,7 @@ fini (xlator_t *this) gf_store_handle_destroy (conf->handle); glusterd_sm_tr_log_delete (&conf->op_sm_log); glusterd_mgmt_v3_lock_fini (); + glusterd_mgmt_v3_lock_timer_fini (); glusterd_txn_opinfo_dict_fini (); GF_FREE (conf); @@ -2136,6 +2145,14 @@ struct volume_options options[] = { .type = GF_OPTION_TYPE_INT, .description = "Sets the base port for portmap query" }, + { .key = {"mgmt-v3-lock-timeout"}, + .type = GF_OPTION_TYPE_INT, + .max = 600, + .description = "Sets the mgmt-v3-lock-timeout for transactions." + "Specifes the default timeout value after which " + "lock acquired while performing transaction will " + "be released." + }, { .key = {"snap-brick-path"}, .type = GF_OPTION_TYPE_STR, .description = "directory where the bricks for the snapshots will be created" |