Skip to contentSkip to conversation

tabled: make two dump displays uniform

PATCH Applied Pete Zaitcev 2 participants 5 messages Apr 2, 2010 – Apr 6, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/7 tabled: make two dump displays uniform

Quoted 9 lines

From: Jeff Garzik <[email protected]>
Subject: Re: Tabled issues
Date: Mon, 29 Mar 2010 15:32:33 -0400

I asserted that the standard stats dump facility must dump all available statistics. That does not exclude other methods of stat(us) dumping. Your patch added new stats to the HTML-pretty version of output, but failed to add the new stats to the standard stat dump facility.

Your wish is my command.

---
 server/replica.c |   28 +++++++++++++++++++++++++
 server/server.c  |   47 ++++++++++++++++++++++++++++++++++--------
 server/status.c  |   22 +------------------
 server/storage.c |   50 +++++++++++++++++++++++++++++++++++++++++----
 server/tabled.h  |    3 ++
 5 files changed, 117 insertions(+), 33 deletions(-)

commit 6bba495d750dcc7ebe63938b91d4bb22740879fe

Author: Pete Zaitcev <[email protected]>
Date:   Thu Apr 1 18:58:08 2010 -0600

Make signal+applog and HTTP displays uniform.

server/replica.c +28 -0
index abdd647..e774824 100644
@@ -871,6 +871,34 @@ void rep_start()
 	kscan_enabled = true;
 }
 
+void rep_stats()
+{
+	bool running;
+	unsigned long kcnt;
+	time_t last;
+
+	applog(LOG_INFO, "REP: Jobs: queued %d active %d done %d",
+	       queue.njobs, active.njobs, done.njobs);
+
+	g_mutex_lock(kscan_mutex);
+	running = kscan_running;
+	last = kscan_last;
+	kcnt = kscan_cnt;
+	g_mutex_unlock(kscan_mutex);
+
+	if (running) {
+		applog(LOG_INFO, "REP: run Active started %lu scanned %lu",
+		      (long) last, kcnt);
+	} else {
+		if (last)
+			applog(LOG_INFO,
+			       "REP: run Done started %lu scanned %lu",
+			       (long) last, kcnt);
+		else
+			applog(LOG_INFO, "REP: run None");
+	}
+}
+
 bool rep_status(struct client *cli, GList *content)
 {
 	time_t now;
server/server.c +38 -9

59 lines not on this page · raw message

server/status.c +2 -20
index bb67ac9..2029c09 100644
@@ -114,25 +114,6 @@ out:
 	return false;
 }
 
-static bool stat_status(struct client *cli, GList *content)
-{
-	char *str;
-
-	/*
-	 * The loadavg is system dependent, we'll figure it out later.
-	 * On Linux, applications read from /proc/loadavg.
-	 */
-	if (asprintf(&str,
-		     "<h1>Status</h1>"
-		     "<p>Host %s port %s</p>\r\n"
-		     "<p>Stats: poll %lu event %lu</p>\r\n",
-		     tabled_srv.ourhost, tabled_srv.port,
-		     tabled_srv.stats.poll, tabled_srv.stats.event) < 0)
-		return false;
-	content = g_list_append(content, str);
-	return true;
-}
-
 static bool stat_root(struct client *cli)
 {
 	GList *content = NULL;
@@ -149,7 +130,8 @@ static bool stat_root(struct client *cli)
 
 	if (!stat_status(cli, content))
 		goto out_err;
-
+	if (!stor_status(cli, content))
+		goto out_err;
 	if (!rep_status(cli, content))
 		goto out_err;
 
server/storage.c +46 -4

57 lines not on this page · raw message

server/tabled.h +3 -0
index 72bf20d..b4f51ed 100644
@@ -315,6 +315,7 @@ extern void req_sign(struct http_req *req, const char *bucket, const char *key,
 extern int debugging;
 extern struct server tabled_srv;
 extern struct compiled_pat patterns[];
+extern bool stat_status(struct client *cli, GList *content);
 extern bool cli_err(struct client *cli, enum errcode code);
 extern bool cli_err_write(struct client *cli, char *hdr, char *content);
 extern bool cli_resp_xml(struct client *cli, int http_status, GList *content);
@@ -357,6 +358,7 @@ extern void stor_add_node(uint32_t nid, const char *hostname,
 			  const char *portstr, struct geo *locp);
 extern int stor_node_check(struct storage_node *stn);
 extern void stor_stats(void);
+extern bool stor_status(struct client *cli, GList *content);
 
 /* storparse.c */
 extern void stor_parse(char *fname, const char *text, size_t len);
@@ -364,6 +366,7 @@ extern void stor_parse(char *fname, const char *text, size_t len);
 /* replica.c */
 extern void rep_init(struct event_base *ev_base);
 extern void rep_start(void);
+extern void rep_stats(void);
 extern bool rep_status(struct client *cli, GList *content);
 
 #endif /* __TABLED_H__ */
#1 lore raw

These patch series look good from a quick glance. Will apply after Easter holiday...

Jeff

#2 lore raw
Quoted 2 lines · On Fri, 02 Apr 2010 13:27:10 -0400 Jeff Garzik <[email protected]> wrote:

These patch series look good from a quick glance. Will apply after Easter holiday...

Thanks. They should be ok to overtake the end-to-end verbosity, but there may be some textual conflicts...

-- Pete

Applied
#3 lore raw
In reply to Pete Zaitcev
Quoted 14 lines · Pete Zaitcev
Quoted 9 lines

From: Jeff Garzik<[email protected]>
Subject: Re: Tabled issues
Date: Mon, 29 Mar 2010 15:32:33 -0400

I asserted that the standard stats dump facility must dump all available statistics. That does not exclude other methods of stat(us) dumping. Your patch added new stats to the HTML-pretty version of output, but failed to add the new stats to the standard stat dump facility.

Your wish is my command.

Quoted 7 lines
---
  server/replica.c |   28 +++++++++++++++++++++++++
  server/server.c  |   47 ++++++++++++++++++++++++++++++++++--------
  server/status.c  |   22 +------------------
  server/storage.c |   50 +++++++++++++++++++++++++++++++++++++++++----
  server/tabled.h  |    3 ++
  5 files changed, 117 insertions(+), 33 deletions(-)

applied, thanks. I will endeavor to make the stats dump more like nfs4d in the future, FWIW.

#4 lore raw
Quoted 2 lines · On Tue, 06 Apr 2010 12:57:57 -0400 Jeff Garzik <[email protected]> wrote:

applied, thanks. I will endeavor to make the stats dump more like nfs4d in the future, FWIW.

I was going to look into it too, but there's now some stuff I urgently need to address in Darcy's report on tabled's faults. So I only wrote nfs4 into the endless TODO.

-- Pete