Commit c9d56a81 authored by Matthijs Mekking's avatar Matthijs Mekking 🏡
Browse files

Print out ancient type stats with '~' prefix.

The stale RR types are now printed with '#'.  This used to be the
prefix for RR types that were marked ancient, but commit
df507515 changed the meaning.  It is
probably better to keep '#' for stale RR types and introduce a new
prefix for reintroducing ancient type stat counters.
parent 403cc1fa
...@@ -1253,6 +1253,12 @@ rdtypestat_dump(dns_rdatastatstype_t type, uint64_t val, void *arg) { ...@@ -1253,6 +1253,12 @@ rdtypestat_dump(dns_rdatastatstype_t type, uint64_t val, void *arg) {
#endif #endif
} }
static bool
rdatastatstype_attr(dns_rdatastatstype_t type, unsigned int attr)
{
return ((DNS_RDATASTATSTYPE_ATTR(type) & attr) != 0);
}
static void static void
rdatasetstats_dump(dns_rdatastatstype_t type, uint64_t val, void *arg) { rdatasetstats_dump(dns_rdatastatstype_t type, uint64_t val, void *arg) {
stats_dumparg_t *dumparg = arg; stats_dumparg_t *dumparg = arg;
...@@ -1261,6 +1267,7 @@ rdatasetstats_dump(dns_rdatastatstype_t type, uint64_t val, void *arg) { ...@@ -1261,6 +1267,7 @@ rdatasetstats_dump(dns_rdatastatstype_t type, uint64_t val, void *arg) {
const char *typestr; const char *typestr;
bool nxrrset = false; bool nxrrset = false;
bool stale = false; bool stale = false;
bool ancient = false;
#ifdef HAVE_LIBXML2 #ifdef HAVE_LIBXML2
void *writer; void *writer;
int xmlrc; int xmlrc;
...@@ -1282,19 +1289,16 @@ rdatasetstats_dump(dns_rdatastatstype_t type, uint64_t val, void *arg) { ...@@ -1282,19 +1289,16 @@ rdatasetstats_dump(dns_rdatastatstype_t type, uint64_t val, void *arg) {
typestr = typebuf; typestr = typebuf;
} }
if ((DNS_RDATASTATSTYPE_ATTR(type) & DNS_RDATASTATSTYPE_ATTR_NXRRSET) nxrrset = rdatastatstype_attr(type, DNS_RDATASTATSTYPE_ATTR_NXRRSET);
!= 0) stale = rdatastatstype_attr(type, DNS_RDATASTATSTYPE_ATTR_STALE);
nxrrset = true; ancient = rdatastatstype_attr(type, DNS_RDATASTATSTYPE_ATTR_ANCIENT);
if ((DNS_RDATASTATSTYPE_ATTR(type) & DNS_RDATASTATSTYPE_ATTR_STALE)
!= 0)
stale = true;
switch (dumparg->type) { switch (dumparg->type) {
case isc_statsformat_file: case isc_statsformat_file:
fp = dumparg->arg; fp = dumparg->arg;
fprintf(fp, "%20" PRIu64 " %s%s%s\n", val, fprintf(fp, "%20" PRIu64 " %s%s%s%s\n", val,
stale ? "#" : "", nxrrset ? "!" : "", typestr); ancient ? "~" : "", stale ? "#" : "",
nxrrset ? "!" : "", typestr);
break; break;
case isc_statsformat_xml: case isc_statsformat_xml:
#ifdef HAVE_LIBXML2 #ifdef HAVE_LIBXML2
...@@ -1302,7 +1306,8 @@ rdatasetstats_dump(dns_rdatastatstype_t type, uint64_t val, void *arg) { ...@@ -1302,7 +1306,8 @@ rdatasetstats_dump(dns_rdatastatstype_t type, uint64_t val, void *arg) {
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "rrset")); TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "rrset"));
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "name")); TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "name"));
TRY0(xmlTextWriterWriteFormatString(writer, "%s%s%s", TRY0(xmlTextWriterWriteFormatString(writer, "%s%s%s%s",
ancient ? "~" : "",
stale ? "#" : "", stale ? "#" : "",
nxrrset ? "!" : "", typestr)); nxrrset ? "!" : "", typestr));
TRY0(xmlTextWriterEndElement(writer)); /* name */ TRY0(xmlTextWriterEndElement(writer)); /* name */
...@@ -1319,7 +1324,7 @@ rdatasetstats_dump(dns_rdatastatstype_t type, uint64_t val, void *arg) { ...@@ -1319,7 +1324,7 @@ rdatasetstats_dump(dns_rdatastatstype_t type, uint64_t val, void *arg) {
case isc_statsformat_json: case isc_statsformat_json:
#ifdef HAVE_JSON_C #ifdef HAVE_JSON_C
zoneobj = (json_object *) dumparg->arg; zoneobj = (json_object *) dumparg->arg;
snprintf(buf, sizeof(buf), "%s%s%s", snprintf(buf, sizeof(buf), "%s%s%s%s", ancient ? "~" : "",
stale ? "#" : "", nxrrset ? "!" : "", typestr); stale ? "#" : "", nxrrset ? "!" : "", typestr);
obj = json_object_new_int64(val); obj = json_object_new_int64(val);
if (obj == NULL) if (obj == NULL)
......
...@@ -15233,8 +15233,9 @@ HOST-127.EXAMPLE. MX 0 . ...@@ -15233,8 +15233,9 @@ HOST-127.EXAMPLE. MX 0 .
type, it means that particular type of RRset is type, it means that particular type of RRset is
known to be nonexistent (this is also known as known to be nonexistent (this is also known as
"NXRRSET"). If a hash mark (#) is present then "NXRRSET"). If a hash mark (#) is present then
the RRset is marked for garbage collection. the RRset is stale. If a tilde mark (~) is
Maintained per view. present, the RRset is marked for garbage
collection. Maintained per view.
</para> </para>
</entry> </entry>
</row> </row>
......
...@@ -474,16 +474,24 @@ LIBDNS_EXTERNAL_DATA extern const char *dns_statscounter_names[]; ...@@ -474,16 +474,24 @@ LIBDNS_EXTERNAL_DATA extern const char *dns_statscounter_names[];
* attribute is set, the base type is of no use. * attribute is set, the base type is of no use.
* *
* _STALE * _STALE
* RRset type counters only. This indicates a record that marked for * RRset type counters only. This indicates a record that is stale
* removal. * but may still be served.
* *
* Note: incrementing _STALE will decrement the corresponding non-stale * Note: incrementing _STALE will decrement the corresponding non-stale
* counter. * counter.
*
* _ANCIENT
* RRset type counters only. This indicates a record that is marked for
* removal.
*
* Note: incrementing _ANCIENT will decrement the corresponding
* non-ancient counter.
*/ */
#define DNS_RDATASTATSTYPE_ATTR_OTHERTYPE 0x0001 #define DNS_RDATASTATSTYPE_ATTR_OTHERTYPE 0x0001
#define DNS_RDATASTATSTYPE_ATTR_NXRRSET 0x0002 #define DNS_RDATASTATSTYPE_ATTR_NXRRSET 0x0002
#define DNS_RDATASTATSTYPE_ATTR_NXDOMAIN 0x0004 #define DNS_RDATASTATSTYPE_ATTR_NXDOMAIN 0x0004
#define DNS_RDATASTATSTYPE_ATTR_STALE 0x0008 #define DNS_RDATASTATSTYPE_ATTR_STALE 0x0008
#define DNS_RDATASTATSTYPE_ATTR_ANCIENT 0x0010
/*%< /*%<
* Conversion macros among dns_rdatatype_t, attributes and isc_statscounter_t. * Conversion macros among dns_rdatatype_t, attributes and isc_statscounter_t.
......
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