Commit 204eb4b8 authored by Geoff Simmons's avatar Geoff Simmons

trackrdrd: consolidated VSL wrap logging (suitable for monitoring)

parent acacc66c
...@@ -519,7 +519,7 @@ static hashentry ...@@ -519,7 +519,7 @@ static hashentry
h += n * n; h += n * n;
} while (probes <= htbl.max_probes); } while (probes <= htbl.max_probes);
/* none eligable for evacuation */ /* none eligible for evacuation */
if ((oldest->insert_time + htbl.mlt) > t) { if ((oldest->insert_time + htbl.mlt) > t) {
htbl.fail++; htbl.fail++;
htbl.insert_probes += probes; htbl.insert_probes += probes;
...@@ -676,7 +676,7 @@ OSL_Track(void *priv, enum VSL_tag_e tag, unsigned fd, unsigned len, ...@@ -676,7 +676,7 @@ OSL_Track(void *priv, enum VSL_tag_e tag, unsigned fd, unsigned len,
float tim, tim_exp_check = 0.0; float tim, tim_exp_check = 0.0;
/* wrap detection statistics */ /* wrap detection statistics */
static const char *pptr = (const char *)UINTPTR_MAX; static const char *pptr = (const char *) UINTPTR_MAX;
static unsigned wrap_start_xid = 0; static unsigned wrap_start_xid = 0;
static unsigned wrap_end_xid = 0; static unsigned wrap_end_xid = 0;
...@@ -715,7 +715,7 @@ OSL_Track(void *priv, enum VSL_tag_e tag, unsigned fd, unsigned len, ...@@ -715,7 +715,7 @@ OSL_Track(void *priv, enum VSL_tag_e tag, unsigned fd, unsigned len,
LOG_Log(LOG_DEBUG, "%s: XID=%u", VSL_tags[tag], xid); LOG_Log(LOG_DEBUG, "%s: XID=%u", VSL_tags[tag], xid);
if (xid > last_start_xid) if (xid > last_start_xid)
last_start_xid = xid; last_start_xid = xid;
tim = TIM_mono(); tim = TIM_mono();
if (! insert(xid, fd, tim)) { if (! insert(xid, fd, tim)) {
...@@ -762,7 +762,7 @@ OSL_Track(void *priv, enum VSL_tag_e tag, unsigned fd, unsigned len, ...@@ -762,7 +762,7 @@ OSL_Track(void *priv, enum VSL_tag_e tag, unsigned fd, unsigned len,
(unsigned) reqend_t.tv_sec, reqend_t.tv_nsec); (unsigned) reqend_t.tv_sec, reqend_t.tv_nsec);
if (xid > last_end_xid) if (xid > last_end_xid)
last_end_xid = xid; last_end_xid = xid;
xid_spread_sum += (last_end_xid - last_start_xid); xid_spread_sum += (last_end_xid - last_start_xid);
xid_spread_count++; xid_spread_count++;
...@@ -792,25 +792,19 @@ OSL_Track(void *priv, enum VSL_tag_e tag, unsigned fd, unsigned len, ...@@ -792,25 +792,19 @@ OSL_Track(void *priv, enum VSL_tag_e tag, unsigned fd, unsigned len,
} }
/* /*
* log when the vsl ptr wraps, so we can relate lost records, if * log when the vsl ptr wraps, to try to monitor lost records
* applicable * XXX: this doesn't work when XIDs wrap at UINT_MAX
*/ */
if (ptr < pptr) { if (ptr < pptr) {
LOG_Log(LOG_INFO, "VSL wrap at %u", xid); if (wrap_start_xid) {
if (wrap_start_xid) { LOG_Log(LOG_INFO,
LOG_Log(LOG_INFO, "VSL wrap start xid %10u current %10u delta %10d", "VSL wrap: delta_start=%u delta_end=%u delta_avg=%f",
wrap_start_xid, last_start_xid, (last_start_xid - wrap_start_xid)); last_start_xid - wrap_start_xid, last_end_xid - wrap_end_xid,
LOG_Log(LOG_INFO, "VSL wrap end xid %10u current %10u delta %10d", 1.0 * xid_spread_sum / xid_spread_count);
wrap_end_xid, last_end_xid, (last_end_xid - wrap_end_xid)); xid_spread_count = xid_spread_sum = 0;
/* AAARRRGLLL, I confess: yes, I am calculating an average here */ }
LOG_Log(LOG_INFO, "VSL wrap xid spread is %u - avg xid spread is %f", wrap_start_xid = last_start_xid;
(last_start_xid - last_end_xid), wrap_end_xid = last_end_xid;
(1.0 * xid_spread_sum / xid_spread_count));
xid_spread_count = xid_spread_sum = 0;
}
wrap_start_xid = last_start_xid;
wrap_end_xid = last_end_xid;
} }
pptr = ptr; pptr = ptr;
......
...@@ -114,7 +114,6 @@ CONF_Add(const char *lval, const char *rval) ...@@ -114,7 +114,6 @@ CONF_Add(const char *lval, const char *rval)
confString("varnish.name", varnish_name); confString("varnish.name", varnish_name);
confString("log.file", log_file); confString("log.file", log_file);
confString("varnish.bindump", varnish_bindump); confString("varnish.bindump", varnish_bindump);
confString("processor.log", processor_log);
confString("mq.qname", mq_qname); confString("mq.qname", mq_qname);
confUnsigned("maxopen.scale", maxopen_scale); confUnsigned("maxopen.scale", maxopen_scale);
...@@ -231,7 +230,6 @@ CONF_Init(void) ...@@ -231,7 +230,6 @@ CONF_Init(void)
config.syslog_facility = LOG_LOCAL0; config.syslog_facility = LOG_LOCAL0;
config.monitor_interval = 30; config.monitor_interval = 30;
config.monitor_workers = false; config.monitor_workers = false;
config.processor_log[0] = '\0';
config.maxopen_scale = DEF_MAXOPEN_SCALE; config.maxopen_scale = DEF_MAXOPEN_SCALE;
config.maxdone = DEF_MAXDONE; config.maxdone = DEF_MAXDONE;
config.maxdata = DEF_MAXDATA; config.maxdata = DEF_MAXDATA;
...@@ -335,7 +333,6 @@ CONF_Dump(void) ...@@ -335,7 +333,6 @@ CONF_Dump(void)
confdump("syslog.facility = %s", config.syslog_facility_name); confdump("syslog.facility = %s", config.syslog_facility_name);
confdump("monitor.interval = %u", config.monitor_interval); confdump("monitor.interval = %u", config.monitor_interval);
confdump("monitor.workers = %s", config.monitor_workers ? "true" : "false"); confdump("monitor.workers = %s", config.monitor_workers ? "true" : "false");
confdump("processor.log = %s", config.processor_log);
confdump("maxopen.scale = %u", config.maxopen_scale); confdump("maxopen.scale = %u", config.maxopen_scale);
confdump("maxdone = %u", config.maxdone); confdump("maxdone = %u", config.maxdone);
confdump("maxdata = %u", config.maxdata); confdump("maxdata = %u", config.maxdata);
......
...@@ -22,7 +22,7 @@ CMD="../trackrdrd -D -f varnish.binlog -l - -d -c test.conf" ...@@ -22,7 +22,7 @@ CMD="../trackrdrd -D -f varnish.binlog -l - -d -c test.conf"
# the user running it # the user running it
CKSUM=$( $CMD | sed -e 's/\(initializing\) \(.*\)/\1/' | sed -e 's/\(Running as\) \([a-zA-Z0-9]*\)$/\1/' | grep -v 'Not running as root' | cksum) CKSUM=$( $CMD | sed -e 's/\(initializing\) \(.*\)/\1/' | sed -e 's/\(Running as\) \([a-zA-Z0-9]*\)$/\1/' | grep -v 'Not running as root' | cksum)
if [ "$CKSUM" != '1848318102 234119' ]; then if [ "$CKSUM" != '358541331 234058' ]; then
echo "ERROR: Regression test incorrect cksum: $CKSUM" echo "ERROR: Regression test incorrect cksum: $CKSUM"
exit 1 exit 1
fi fi
......
...@@ -255,7 +255,6 @@ struct config { ...@@ -255,7 +255,6 @@ struct config {
char syslog_facility_name[BUFSIZ]; char syslog_facility_name[BUFSIZ];
unsigned monitor_interval; unsigned monitor_interval;
bool monitor_workers; bool monitor_workers;
char processor_log[BUFSIZ];
/* scale: unit is log(2,n), iow scale is taken to the power of 2 */ /* scale: unit is log(2,n), iow scale is taken to the power of 2 */
unsigned maxopen_scale; /* max number of records in *_OPEN state */ unsigned maxopen_scale; /* max number of records in *_OPEN state */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment