diff options
author | Ravishankar N <ravishankar@redhat.com> | 2015-04-15 22:22:08 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2015-05-05 02:30:41 -0700 |
commit | d7c30458c87f1341295f764e1a2a539dc4248ecc (patch) | |
tree | 641750b41cb170ab811f20b9665f6bd488631c3b /xlators/cluster/afr/src/afr-common.c | |
parent | baac2c28ee98e47a3fc0ecf1db3779c7372df526 (diff) |
afr: add arbitration support
Backport of http://review.gluster.org/#/c/10258/
Add logic in afr to work in conjunction with the arbiter xlator when a
replica 3 arbiter volume is created. More specifically, this patch:
* Enables full locks for afr data transaction for such volumes.
* Removes the upfront marking of pending xattrs at the time of pre-op
and defer it to post-op. (This is an arbiter independent change and is made for all afr transactions.)
* After pre-op stage, check if we can proceed with the fop stage without
ending up in split-brain by examining the changelog xattrs.
* Unwinds the fop with failure if only one source was available at the
time of pre-op and the fop happened to fail on particular source brick.
* Skips data self-heal if arbiter brick is the only source available.
* Adds the arbiter-count option to the shd graph.
This patch is a part of the arbiter logic implementation for 3 way AFR
details of which can be found at http://review.gluster.org/#/c/9656/
Change-Id: I9603db9d04de5626eb2f4d8d959ef5b46113561d
BUG: 1217689
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
Reviewed-on: http://review.gluster.org/10514
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-common.c')
-rw-r--r-- | xlators/cluster/afr/src/afr-common.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index 5654e3ad03d..c6501cda97a 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -993,6 +993,17 @@ afr_local_transaction_cleanup (afr_local_t *local, xlator_t *this) afr_entry_lockee_cleanup (&local->internal_lock); GF_FREE (local->transaction.pre_op); + + GF_FREE (local->transaction.pre_op_sources); + if (local->transaction.pre_op_xdata) { + for (i = 0; i < priv->child_count; i++) { + if (!local->transaction.pre_op_xdata[i]) + continue; + dict_unref (local->transaction.pre_op_xdata[i]); + } + GF_FREE (local->transaction.pre_op_xdata); + } + GF_FREE (local->transaction.eager_lock); GF_FREE (local->transaction.fop_subvols); GF_FREE (local->transaction.failed_subvols); @@ -4084,6 +4095,20 @@ afr_transaction_local_init (afr_local_t *local, xlator_t *this) if (!local->transaction.pre_op) goto out; + if (priv->arbiter_count == 1) { + local->transaction.pre_op_xdata = + GF_CALLOC (sizeof (*local->transaction.pre_op_xdata), + priv->child_count, gf_afr_mt_dict_t); + if (!local->transaction.pre_op_xdata) + goto out; + + local->transaction.pre_op_sources = + GF_CALLOC (sizeof (*local->transaction.pre_op_sources), + priv->child_count, gf_afr_mt_char); + if (!local->transaction.pre_op_sources) + goto out; + } + local->transaction.fop_subvols = GF_CALLOC (sizeof (*local->transaction.fop_subvols), priv->child_count, gf_afr_mt_char); |