Skip to contentSkip to conversation

tabled: Reduce verbosity in CLD client

PATCH Applied Pete Zaitcev 2 participants 3 messages Nov 14, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 3/7 tabled: Reduce verbosity in CLD client

I got into habit of watching logs and there was too much useless messaging in them. Some messages were stubs and reminders, so I left them in the code, but commented out.

---
 server/cldu.c      |    9 ++-------
 server/storage.c   |    2 ++
 server/storparse.c |    5 +----
 3 files changed, 5 insertions(+), 11 deletions(-)
server/cldu.c +2 -7
index ea2266f..b48d86c 100644
@@ -609,8 +609,8 @@ static int cldu_open_x_cb(struct cldc_call_opts *carg, enum cle_err_codes errc)
 		return 0;
 	}
 
-	if (debugging)
-		applog(LOG_DEBUG, "CLD directory \"%s\" opened", sp->xfname);
+	// if (debugging)
+	// 	applog(LOG_DEBUG, "CLD directory \"%s\" opened", sp->xfname);
 
 	/*
 	 * Read the directory.
@@ -713,9 +713,6 @@ static void next_chunk(struct cld_session *sp)
 	}
 	sp->yfname = mem;
 
-	if (debugging)
-		applog(LOG_DEBUG, "opening chunk parameters %s", sp->yfname);
-
 	memset(&copts, 0, sizeof(copts));
 	copts.cb = cldu_open_y_cb;
 	copts.private = sp;
@@ -780,8 +777,6 @@ static int cldu_get_y_cb(struct cldc_call_opts *carg, enum cle_err_codes errc)
 
 	ptr = carg->u.get.buf;
 	len = carg->u.get.size;
-	if (debugging)
-		applog(LOG_DEBUG, "got %d bytes from %s", len, sp->yfname);
 	stor_parse(sp->yfname, ptr, len);
 
 close_and_next:
server/storage.c +2 -0
index e1368a6..f1822f7 100644
@@ -387,6 +387,7 @@ static int stor_add_node_addr(struct storage_node *sn,
 		sn->addr_af = res->ai_family;
 		sn->alen = res->ai_addrlen;
 
+#if 0
 		if (debugging) {
 			char nhost[41];
 			char nport[6];
@@ -400,6 +401,7 @@ static int stor_add_node_addr(struct storage_node *sn,
 				applog(LOG_INFO, "Found Chunk host");
 			}
 		}
+#endif
 
 		/* Use just the first address for now. */
 		freeaddrinfo(res0);
server/storparse.c +1 -4
index d1c43a9..25841d2 100644
@@ -145,7 +145,7 @@ static void cfg_elm_end_geo(struct config_context *cc)
 	}
 
 	if (!cc->loc.rack) {
-		applog(LOG_WARNING, "%s: No rack in Geo element", cc->fname);
+		// applog(LOG_WARNING, "%s: No rack in Geo element", cc->fname);
 		goto end;
 	}
 
@@ -389,9 +389,6 @@ void stor_parse(char *fname, const char *text, size_t len)
 		applog(LOG_WARNING, "%s: No useable Socket clause", fname);
 		goto out_free_all;
 	}
-	if (debugging)
-		applog(LOG_DEBUG, "Adding NID %u host %s port %s",
-		       ctx.nid, ctx.stor_ok_host, ctx.stor_ok_port);
 	stor_add_node(ctx.nid, ctx.stor_ok_host, ctx.stor_ok_port, &ctx.loc);
 
 out_free_all:
#1 lore raw
Quoted 5 lines · Pete Zaitcev

I got into habit of watching logs and there was too much useless messaging in them. Some messages were stubs and reminders, so I left them in the code, but commented out.

I applied this, just to keep things moving, but would really like to see one of two things for each commented-out statement:

1) remove it

2) switch to cld's "-D debuglevel" option format, and bury the logging statements under a debug level that produces a higher verbosity.

cld has three levels:
0, no debug stmts
1, a reasonable amount of debug stmts
2, everything including per-request verbose output

but tabled need not be tied strictly to three debug levels.

One of the minor design goals of each Hail sub-project is to avoid #ifdefs and commented-out sections, and always compile 100% of the source code. Commented-out statements just clutter the code, and _very quickly_ become obsolete because you do not compile them on a regular basis.

If you want to disable something at compile time, use an enum. That ensures the disabled code branch makes it to the C compiler for full type checking, even if the optimizer later strips it out.

Otherwise, just use a simple runtime test to enable/disable features (or simply delete the code).

Jeff

#2 lore raw
Quoted 6 lines · Jeff Garzik

On 11/14/2009 01:32 AM, Pete Zaitcev wrote:

1) remove it

2) switch to cld's "-D debuglevel" option format, and bury the logging statements under a debug level that produces a higher verbosity.

Anything but that. Debugging levels are the worst idea ever. I'll drop them.

-- Pete