From a6c176f14b109cee3d344fe775323859aa8f622e Mon Sep 17 00:00:00 2001
From: Pranith Kumar K <pkarampu@redhat.com>
Date: Thu, 17 Nov 2016 13:11:16 +0530
Subject: [PATCH 174/206] cli: Print to screen frequently
Problem:
CLI appears to be hung because XML document is not flushed periodically
Fix:
Flush the buffer as soon as we print something
>BUG: 1395993
>Change-Id: Ic5f61d4c7d29ee162a124a049e60ceb810d6da6d
>Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
>Reviewed-on: http://review.gluster.org/15863
>Smoke: Gluster Build System <jenkins@build.gluster.org>
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
>CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
>Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
BUG: 1382686
Change-Id: Iea6dcc05ffb10a2cf198bf3075bebee8faa50eee
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/90522
---
heal/src/glfs-heal.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/heal/src/glfs-heal.c b/heal/src/glfs-heal.c
index e885dd9..2a85e75 100644
--- a/heal/src/glfs-heal.c
+++ b/heal/src/glfs-heal.c
@@ -119,6 +119,7 @@ glfsh_xml_init ()
/* <bricks> */
xmlTextWriterStartElement (glfsh_writer,
(xmlChar *)"bricks");
+ xmlTextWriterFlush (glfsh_writer);
xml_out:
return ret;
}
@@ -217,7 +218,9 @@ glfsh_print_xml_heal_op_status (int ret, uint64_t num_entries, char *fmt_str)
"%"PRIu64"", num_entries);
}
out:
- return xmlTextWriterEndElement (glfsh_writer);
+ ret = xmlTextWriterEndElement (glfsh_writer);
+ xmlTextWriterFlush (glfsh_writer);
+ return ret;
}
void
@@ -228,6 +231,7 @@ glfsh_print_xml_file_status (char *path, uuid_t gfid, char *status)
"%s", uuid_utoa (gfid));
xmlTextWriterWriteFormatString (glfsh_writer, "%s", path);
xmlTextWriterEndElement (glfsh_writer);
+ xmlTextWriterFlush (glfsh_writer);
return;
}
@@ -268,6 +272,7 @@ print:
remote_host ? remote_host : "-",
remote_subvol ? remote_subvol : "-");
XML_RET_CHECK_AND_GOTO (x_ret, xml_out);
+ xmlTextWriterFlush (glfsh_writer);
xml_out:
return ret;
}
--
2.9.3