]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Print out ancient type stats with '~' prefix.
authorMatthijs Mekking <matthijs@isc.org>
Mon, 5 Aug 2019 14:34:28 +0000 (16:34 +0200)
committerMatthijs Mekking <matthijs@isc.org>
Mon, 12 Aug 2019 08:41:19 +0000 (10:41 +0200)
The stale RR types are now printed with '#'.  This used to be the
prefix for RR types that were marked ancient, but commit
df50751585b64f72d93ad665abf0f485c8941a3b changed the meaning.  It is
probably better to keep '#' for stale RR types and introduce a new
prefix for reintroducing ancient type stat counters.

(cherry picked from commit c9d56a818522ace828aaec71400d2add992fddc1)

bin/named/statschannel.c
doc/arm/Bv9ARM-book.xml
lib/dns/include/dns/stats.h

index 8d41844e71e9347516a3e253f15bb116863dd8f2..15152bafa575b9db1a9fb151dbca90e70ce1e4df 100644 (file)
@@ -1246,6 +1246,12 @@ rdtypestat_dump(dns_rdatastatstype_t type, uint64_t val, void *arg) {
 #endif
 }
 
+static bool
+rdatastatstype_attr(dns_rdatastatstype_t type, unsigned int attr)
+{
+       return ((DNS_RDATASTATSTYPE_ATTR(type) & attr) != 0);
+}
+
 static void
 rdatasetstats_dump(dns_rdatastatstype_t type, uint64_t val, void *arg) {
        stats_dumparg_t *dumparg = arg;
@@ -1254,6 +1260,7 @@ rdatasetstats_dump(dns_rdatastatstype_t type, uint64_t val, void *arg) {
        const char *typestr;
        bool nxrrset = false;
        bool stale = false;
+       bool ancient = false;
 #ifdef HAVE_LIBXML2
        xmlTextWriterPtr writer;
        int xmlrc;
@@ -1275,19 +1282,16 @@ rdatasetstats_dump(dns_rdatastatstype_t type, uint64_t val, void *arg) {
                typestr = typebuf;
        }
 
-       if ((DNS_RDATASTATSTYPE_ATTR(type) & DNS_RDATASTATSTYPE_ATTR_NXRRSET)
-           != 0)
-               nxrrset = true;
-
-       if ((DNS_RDATASTATSTYPE_ATTR(type) & DNS_RDATASTATSTYPE_ATTR_STALE)
-           != 0)
-               stale = true;
+       nxrrset = rdatastatstype_attr(type, DNS_RDATASTATSTYPE_ATTR_NXRRSET);
+       stale = rdatastatstype_attr(type, DNS_RDATASTATSTYPE_ATTR_STALE);
+       ancient = rdatastatstype_attr(type, DNS_RDATASTATSTYPE_ATTR_ANCIENT);
 
        switch (dumparg->type) {
        case isc_statsformat_file:
                fp = dumparg->arg;
-               fprintf(fp, "%20" PRIu64 " %s%s%s\n", val,
-                       stale ? "#" : "", nxrrset ? "!" : "", typestr);
+               fprintf(fp, "%20" PRIu64 " %s%s%s%s\n", val,
+                       ancient ? "~" : "", stale ? "#" : "",
+                       nxrrset ? "!" : "", typestr);
                break;
        case isc_statsformat_xml:
 #ifdef HAVE_LIBXML2
@@ -1295,7 +1299,8 @@ rdatasetstats_dump(dns_rdatastatstype_t type, uint64_t val, void *arg) {
 
                TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "rrset"));
                TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "name"));
-               TRY0(xmlTextWriterWriteFormatString(writer, "%s%s%s",
+               TRY0(xmlTextWriterWriteFormatString(writer, "%s%s%s%s",
+                                              ancient ? "~" : "",
                                               stale ? "#" : "",
                                               nxrrset ? "!" : "", typestr));
                TRY0(xmlTextWriterEndElement(writer)); /* name */
@@ -1312,7 +1317,7 @@ rdatasetstats_dump(dns_rdatastatstype_t type, uint64_t val, void *arg) {
        case isc_statsformat_json:
 #ifdef HAVE_JSON
                zoneobj = (json_object *) dumparg->arg;
-               snprintf(buf, sizeof(buf), "%s%s%s",
+               snprintf(buf, sizeof(buf), "%s%s%s%s", ancient ? "~" : "",
                         stale ? "#" : "", nxrrset ? "!" : "", typestr);
                obj = json_object_new_int64(val);
                if (obj == NULL)
index d3864781ef129a9bad575477a27b16480ab3584f..02e2ab258a36e2ed00d38baf45cfe88c4146e519 100644 (file)
@@ -15269,8 +15269,9 @@ HOST-127.EXAMPLE. MX 0 .
                    type, it means that particular type of RRset is
                    known to be nonexistent (this is also known as
                    "NXRRSET").  If a hash mark (#) is present then
-                   the RRset is marked for garbage collection.
-                   Maintained per view.
+                   the RRset is stale.  If a tilde mark (~) is
+                   present, the RRset is marked for garbage
+                   collection.  Maintained per view.
                  </para>
                </entry>
              </row>
index 52bab5378e527ad271f2a53130c8520dbe7bb0f1..a4ee695db899601e41ea2fdc52201aadabd316be 100644 (file)
@@ -474,16 +474,24 @@ LIBDNS_EXTERNAL_DATA extern const char *dns_statscounter_names[];
  *     attribute is set, the base type is of no use.
  *
  * _STALE
- *     RRset type counters only.  This indicates a record that marked for
- *     removal.
+ *     RRset type counters only.  This indicates a record that is stale
+ *     but may still be served.
  *
  *     Note: incrementing _STALE will decrement the corresponding non-stale
  *     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_NXRRSET                0x0002
 #define DNS_RDATASTATSTYPE_ATTR_NXDOMAIN       0x0004
 #define DNS_RDATASTATSTYPE_ATTR_STALE          0x0008
+#define DNS_RDATASTATSTYPE_ATTR_ANCIENT                0x0010
 
 /*%<
  * Conversion macros among dns_rdatatype_t, attributes and isc_statscounter_t.