From 306f29a8f49dc7358e195cd0a80531776ff679f7 Mon Sep 17 00:00:00 2001 From: Raghavan P Date: Wed, 22 Jan 2014 14:53:28 +0530 Subject: NSR reconciliation: Adding index for each op We need to have the leader generate an index number for each changelog entry. Change-Id: If451dc00a21dbc481771b713ac75fd0af6887014 Signed-off-by: Raghavan P --- .../features/changelog/src/policy/changelog-policy-replication.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'xlators/features') diff --git a/xlators/features/changelog/src/policy/changelog-policy-replication.c b/xlators/features/changelog/src/policy/changelog-policy-replication.c index 2c54d2cff..5c6fca4e0 100644 --- a/xlators/features/changelog/src/policy/changelog-policy-replication.c +++ b/xlators/features/changelog/src/policy/changelog-policy-replication.c @@ -112,6 +112,7 @@ uuid_fn (void *data, char *buffer, gf_boolean_t encode) /* TBD: move declarations here and nsr.c into a common place */ #define NSR_TERM_XATTR "trusted.nsr.term" +#define NSR_INDEX_XATTR "trusted.nsr.index" #define RECON_TERM_XATTR "trusted.nsr.recon-term" #define RECON_INDEX_XATTR "trusted.nsr.recon-index" @@ -121,6 +122,7 @@ changelog_fix_term(xlator_t *this, dict_t *xdata) { int32_t old_term, new_term; + uint32_t index; changelog_priv_t *priv = this->private; int ret = 0; char nfile[PATH_MAX] = {0,}; @@ -130,7 +132,8 @@ changelog_fix_term(xlator_t *this, // If coming via the regular IO path, we should get the dict "nsr-term" // If coming via reconciliation, we should get the dicts "nsr-recon-term" // that indicates the term and "nsr-recon-index" for the index - if (dict_get_int32(xdata,NSR_TERM_XATTR,&new_term) == 0) { + if ((dict_get_int32(xdata,NSR_TERM_XATTR,&new_term) == 0) && + (dict_get_int32(xdata, NSR_INDEX_XATTR, &index) == 0)) { old_term = priv->term; if (old_term != new_term) { @@ -147,7 +150,7 @@ changelog_fix_term(xlator_t *this, return _gf_false; } local->nr_bytes = 0; - local->lu.val = get_index (priv); + local->lu.val = index; } else if ((dict_get_int32(xdata, RECON_TERM_XATTR, &recon_term) == 0) && (dict_get_int32(xdata, RECON_INDEX_XATTR, &recon_index) == 0)) { -- cgit