From b748b5e2c2fa40f758e3b35ad4f1fde99ab5e11f Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Fri, 8 Feb 2013 14:53:14 -0800 Subject: [PATCH] [master] fix cache/ADB stats in new stats schema new stats that were added for 9.10 (changes 3319-3326) were not all updated when the new statistics schema was merged (change 3418). 3484. [bug] Some statistics were incorrectly rendered in XML. [RT #32587] --- CHANGES | 3 ++ bin/named/bind9.xsl | 61 +++++++++++++++++++++++++++++++++++++++- bin/named/bind9.xsl.h | 61 +++++++++++++++++++++++++++++++++++++++- bin/named/statschannel.c | 22 +++++++++------ lib/dns/cache.c | 15 +++++----- 5 files changed, 144 insertions(+), 18 deletions(-) diff --git a/CHANGES b/CHANGES index 5fdda08453..9562912080 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +3484. [bug] Some statistics were incorrectly rendered in XML. + [RT #32587] + 3483. [placeholder] 3482. [func] dig +nssearch now prints name servers that don't diff --git a/bin/named/bind9.xsl b/bin/named/bind9.xsl index 3f9ed75aa4..2d8772abe8 100644 --- a/bin/named/bind9.xsl +++ b/bin/named/bind9.xsl @@ -366,7 +366,7 @@

Resolver Statistics (Common)

- + @@ -406,6 +406,55 @@
+ + + +

ADB Statistics for View

+ + + + + + even + odd + + + + + + + +
+ + + +
+
+ + +

Cache Statistics for View

+ + + + + + even + odd + + + + + + + +
+ + + +
+
+ +

Cache DB RRsets for View

@@ -614,6 +663,12 @@ + + + +
Tasks Ready + +

Tasks

@@ -624,6 +679,7 @@ References State Quantum + Events @@ -649,6 +705,9 @@ + + + diff --git a/bin/named/bind9.xsl.h b/bin/named/bind9.xsl.h index 15710d740f..91cb49165f 100644 --- a/bin/named/bind9.xsl.h +++ b/bin/named/bind9.xsl.h @@ -371,7 +371,7 @@ static char xslmsg[] = " \n" "

Resolver Statistics (Common)

\n" " \n" - " \n" + " \n" " \n" " \n" " \n" @@ -411,6 +411,55 @@ static char xslmsg[] = " \n" "
\n" "
\n" + "\n" + "\n" + " \n" + "

ADB Statistics for View

\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " even\n" + " odd\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + "
\n" + " \n" + " \n" + " \n" + "
\n" + "
\n" + "\n" + " \n" + "

Cache Statistics for View

\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " even\n" + " odd\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + "
\n" + " \n" + " \n" + " \n" + "
\n" + "
\n" + "\n" + "\n" "

Cache DB RRsets for View

\n" " \n" " \n" @@ -619,6 +668,12 @@ static char xslmsg[] = " \n" " \n" " \n" + " \n" + " \n" + " \n" + " \n" "
Tasks Ready\n" + " \n" + "
\n" "
\n" "

Tasks

\n" @@ -629,6 +684,7 @@ static char xslmsg[] = " References\n" " State\n" " Quantum\n" + " Events\n" " \n" " \n" " \n" @@ -654,6 +710,9 @@ static char xslmsg[] = " \n" " \n" " \n" + " \n" + " \n" + " \n" " \n" " \n" " \n" diff --git a/bin/named/statschannel.c b/bin/named/statschannel.c index fc42adf37f..abec3b68ad 100644 --- a/bin/named/statschannel.c +++ b/bin/named/statschannel.c @@ -971,21 +971,28 @@ generatexml(ns_server_t *server, int *buflen, xmlChar **buf) { TRY0(xmlTextWriterEndElement(writer)); /* cache */ } - TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR - "cachestats")); - TRY0(dns_cache_renderxml(view->cache, writer)); - TRY0(xmlTextWriterEndElement(writer)); /* cachestats */ - - if (view->adbstats != NULL) { + /* */ + TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "counters")); + TRY0(xmlTextWriterWriteAttribute(writer, ISC_XMLCHAR "type", + ISC_XMLCHAR "adbstat")); + if (view->resstats != NULL) { result = dump_counters(view->adbstats, isc_statsformat_xml, writer, - "adbstat", adbstats_xmldesc, + NULL, adbstats_xmldesc, dns_adbstats_max, adbstats_index, adbstat_values, ISC_STATSDUMP_VERBOSE); if (result != ISC_R_SUCCESS) goto error; } + TRY0(xmlTextWriterEndElement(writer)); /* */ + + /* */ + TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "counters")); + TRY0(xmlTextWriterWriteAttribute(writer, ISC_XMLCHAR "type", + ISC_XMLCHAR "cachestats")); + TRY0(dns_cache_renderxml(view->cache, writer)); + TRY0(xmlTextWriterEndElement(writer)); /* */ TRY0(xmlTextWriterEndElement(writer)); /* view */ @@ -1074,7 +1081,6 @@ generatexml(ns_server_t *server, int *buflen, xmlChar **buf) { resstat_values, 0); if (result != ISC_R_SUCCESS) goto error; - TRY0(xmlTextWriterEndElement(writer)); /* counters type=resstat */ TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "counters")); diff --git a/lib/dns/cache.c b/lib/dns/cache.c index 3b23aba15b..cd0c875eae 100644 --- a/lib/dns/cache.c +++ b/lib/dns/cache.c @@ -1400,15 +1400,14 @@ static int renderstat(const char *name, isc_uint64_t value, xmlTextWriterPtr writer) { int xmlrc; - TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "cachestat")); - TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "name")); - TRY0(xmlTextWriterWriteString(writer, ISC_XMLCHAR name)); - TRY0(xmlTextWriterEndElement(writer)); /* name */ - TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "value")); + TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "counter")); + TRY0(xmlTextWriterWriteAttribute(writer, + ISC_XMLCHAR "name", ISC_XMLCHAR name)); TRY0(xmlTextWriterWriteFormatString(writer, - "%" ISC_PRINT_QUADFORMAT "u", value)); - TRY0(xmlTextWriterEndElement(writer)); /* value */ - TRY0(xmlTextWriterEndElement(writer)); /* cachestat */ + "%" ISC_PRINT_QUADFORMAT "u", + value)); + TRY0(xmlTextWriterEndElement(writer)); /* counter */ + error: return (xmlrc); }