summaryrefslogtreecommitdiffstats
path: root/xlators/lib
diff options
context:
space:
mode:
authorAjeet Jha <ajha@redhat.com>2013-12-02 12:55:18 +0530
committerAnand Avati <avati@redhat.com>2013-12-12 00:16:25 -0800
commitb198e072cda4bbb98e19701399c4bb4f0743cf20 (patch)
treef8a2b689179752b65a5fcff11a3d89a82d7e2ca4 /xlators/lib
parentf999c17da5a5353196e68e7a68af64f91df6b902 (diff)
glusterd/geo-rep: more glusterd and cli fixes for geo-rep.
-> handle option validation cases in reset case. -> Creating valid conf path when glusterd restarts. -> Reading the gsyncd worker thread status and displaying it. -> Displaying status-detail per worker. -> Fetch checkpoint info in geo-rep status. -> use-tarssh value validation added. misc: misc geo-rep fixes based on cluster, logrotate etc.. -> cluster/dht: fix 'stime' getxattr getting overwritten. -> cluster/afr: return max of 'stime' values in subvol. -> geo-rep-logrotate: Sending SIGHUP to geo-rep auxiliary. -> cluster/dht: fix convoluted logic while aggregating. -> cluster/*: fix 'stime' min/max fetch logic. Change-Id: I811acea0bbd6194797a3e55d89295d1ea021ac85 BUG: 1036552 Signed-off-by: Ajeet Jha <ajha@redhat.com> Reviewed-on: http://review.gluster.org/6405 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@gmail.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/lib')
-rw-r--r--xlators/lib/src/libxlator.c55
-rw-r--r--xlators/lib/src/libxlator.h3
2 files changed, 58 insertions, 0 deletions
diff --git a/xlators/lib/src/libxlator.c b/xlators/lib/src/libxlator.c
index 9e535725544..63e9bcf9f0a 100644
--- a/xlators/lib/src/libxlator.c
+++ b/xlators/lib/src/libxlator.c
@@ -452,6 +452,61 @@ gf_get_min_stime (xlator_t *this, dict_t *dst, char *key, data_t *value)
/* can't use 'min()' macro here as we need to compare two fields
in the array, selectively */
+ if ((host_value_timebuf[0] < host_timebuf[0]) ||
+ ((host_value_timebuf[0] == host_timebuf[0]) &&
+ (host_value_timebuf[1] < host_timebuf[1]))) {
+ update_timebuf (value_timebuf, net_timebuf);
+ }
+
+ ret = 0;
+out:
+ return ret;
+error:
+ /* To be used only when net_timebuf is not set in the dict */
+ if (net_timebuf)
+ GF_FREE (net_timebuf);
+
+ return ret;
+}
+
+int
+gf_get_max_stime (xlator_t *this, dict_t *dst, char *key, data_t *value)
+{
+ int ret = -1;
+ uint32_t *net_timebuf = NULL;
+ uint32_t *value_timebuf = NULL;
+ uint32_t host_timebuf[2] = {0,};
+ uint32_t host_value_timebuf[2] = {0,};
+
+ /* stime should be maximum of all the other nodes */
+ ret = dict_get_bin (dst, key, (void **)&net_timebuf);
+ if (ret < 0) {
+ net_timebuf = GF_CALLOC (1, sizeof (int64_t),
+ gf_common_mt_char);
+ if (!net_timebuf)
+ goto out;
+
+ ret = dict_set_bin (dst, key, net_timebuf, sizeof (int64_t));
+ if (ret < 0) {
+ gf_log (this->name, GF_LOG_WARNING,
+ "key=%s: dict set failed", key);
+ goto error;
+ }
+ }
+
+ value_timebuf = data_to_bin (value);
+ if (!value_timebuf) {
+ gf_log (this->name, GF_LOG_WARNING,
+ "key=%s: getting value of stime failed", key);
+ ret = -1;
+ goto out;
+ }
+
+ get_hosttime (value_timebuf, host_value_timebuf);
+ get_hosttime (net_timebuf, host_timebuf);
+
+ /* can't use 'max()' macro here as we need to compare two fields
+ in the array, selectively */
if ((host_value_timebuf[0] > host_timebuf[0]) ||
((host_value_timebuf[0] == host_timebuf[0]) &&
(host_value_timebuf[1] > host_timebuf[1]))) {
diff --git a/xlators/lib/src/libxlator.h b/xlators/lib/src/libxlator.h
index 08bd77b918c..175d3141d45 100644
--- a/xlators/lib/src/libxlator.h
+++ b/xlators/lib/src/libxlator.h
@@ -151,4 +151,7 @@ match_uuid_local (const char *name, char *uuid);
int
gf_get_min_stime (xlator_t *this, dict_t *dst, char *key, data_t *value);
+int
+gf_get_max_stime (xlator_t *this, dict_t *dst, char *key, data_t *value);
+
#endif /* !_LIBXLATOR_H */