summaryrefslogtreecommitdiffstats
path: root/xlators/features
diff options
context:
space:
mode:
authorRaghavan P <rpichai@redhat.com>2014-01-22 14:53:28 +0530
committerRaghavan P <rpichai@redhat.com>2014-01-23 12:53:33 +0530
commit306f29a8f49dc7358e195cd0a80531776ff679f7 (patch)
treed44499181073f5c01fa41cfaafd1cc0c66282929 /xlators/features
parent007182f1aad9d14e8d5bc7771d500b35026f0afa (diff)
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 <rpichai@redhat.com>
Diffstat (limited to 'xlators/features')
-rw-r--r--xlators/features/changelog/src/policy/changelog-policy-replication.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/xlators/features/changelog/src/policy/changelog-policy-replication.c b/xlators/features/changelog/src/policy/changelog-policy-replication.c
index 2c54d2c..5c6fca4 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)) {