summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSaravanakumar Arumugam <sarumuga@redhat.com>2016-06-29 15:36:06 +0530
committerAravinda VK <avishwan@redhat.com>2016-08-19 03:46:52 -0700
commit10d044b62e476e032e8bda59fe8fbb3b8b0576b4 (patch)
treeea735960cae74441798f5f0684b07c7c213a393a
parent56343cf608f02c2b6dbaef04ae7a897b13a97d42 (diff)
glusterd/geo-rep: Handle empty monitor.status during upgrade
Problem: Consider geo-replication is in Stopped state. Following which, glusterfs is upgraded (where monitor.status is the new status file). Now, When geo-replication status command is run, empty monitor status file gets created. Now, if glusterd is restarted, it reads empty monitor status and starts geo-replication session. This is incorrect as session was in Stopped state earlier. Solution: If monitor status is empty, error out and avoid starting geo-replication session. Note: if monitor status is empty, geo-rep session is displayed as Stopped state. Change-Id: Ifb3db896e5ed92b927764cf1163503765cb08bb4 BUG: 1368053 Signed-off-by: Saravanakumar Arumugam <sarumuga@redhat.com> > Reviewed-on: http://review.gluster.org/14830 > Smoke: Gluster Build System <jenkins@build.gluster.org> > CentOS-regression: Gluster Build System <jenkins@build.gluster.org> > NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> > Reviewed-by: Jeff Darcy <jdarcy@redhat.com> (cherry picked from commit f938b3a26ffab9482d5f910ee76d2bb2b370517f) Reviewed-on: http://review.gluster.org/15196 NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Aravinda VK <avishwan@redhat.com>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-geo-rep.c5
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c8
2 files changed, 8 insertions, 5 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
index 1b0af527897..e7afb9b599d 100644
--- a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
+++ b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
@@ -4281,7 +4281,10 @@ glusterd_gsync_read_frm_status (char *path, char *buf, size_t blen)
while (isspace (*p))
*p-- = '\0';
}
- } else if (ret < 0)
+ } else if (ret == 0)
+ gf_msg (this->name, GF_LOG_ERROR, 0, GD_MSG_GSYNCD_ERROR,
+ "Status file of gsyncd is empty");
+ else /* ret < 0 */
gf_msg (this->name, GF_LOG_ERROR, 0, GD_MSG_GSYNCD_ERROR,
"Status file of gsyncd is corrupt");
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 58a316caaa6..5bfa809b053 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -5091,7 +5091,7 @@ _local_gsyncd_start (dict_t *this, char *key, data_t *value, void *data)
}
ret = glusterd_gsync_read_frm_status (statefile, buf, sizeof (buf));
- if (ret < 0) {
+ if (ret <= 0) {
gf_msg (this1->name, GF_LOG_ERROR, 0,
GD_MSG_STAT_FILE_READ_FAILED,
"Unable to read the status");
@@ -5102,9 +5102,9 @@ _local_gsyncd_start (dict_t *this, char *key, data_t *value, void *data)
if ((key1 = strchr (slave, '/')))
key1 = key1 + 2;
- /* Looks for the last status, to find if the sessiom was running
- * when the node went down. If the session was not started or
- * not started, do not restart the geo-rep session */
+ /* Looks for the last status, to find if the session was running
+ * when the node went down. If the session was just created or
+ * stopped, do not restart the geo-rep session */
if ((!strcmp (buf, "Created")) ||
(!strcmp (buf, "Stopped"))) {
gf_msg (this1->name, GF_LOG_INFO, 0,