Changeset 1713

Show
Ignore:
Timestamp:
09/11/10 15:41:02 (3 years ago)
Author:
ahu
Message:

make rec_control dump-cache also dump the negative cache, so we can see what is going on

Location:
trunk/pdns/pdns
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/pdns/pdns/rec_channel_rec.cc

    r1683 r1713  
    111111 
    112112 
     113static uint64_t dumpNegCache(SyncRes::negcache_t& negcache, int fd) 
     114{ 
     115  FILE* fp=fdopen(dup(fd), "w"); 
     116  if(!fp) { // dup probably failed 
     117    return 0; 
     118  } 
     119  fprintf(fp, "; negcache dump from thread follows\n;\n"); 
     120  time_t now = time(0); 
     121   
     122  typedef SyncRes::negcache_t::nth_index<1>::type sequence_t; 
     123  sequence_t& sidx=negcache.get<1>(); 
     124 
     125  uint64_t count=0; 
     126  BOOST_FOREACH(const NegCacheEntry& neg, sidx) 
     127  { 
     128    ++count; 
     129    fprintf(fp, "%s IN %s %d VIA %s\n", neg.d_name.c_str(), neg.d_qtype.getName().c_str(), (unsigned int) (neg.d_ttd - now), neg.d_qname.c_str()); 
     130  } 
     131  fclose(fp); 
     132  return count; 
     133} 
     134 
    113135static uint64_t* pleaseDump(int fd) 
    114136{ 
    115   return new uint64_t(t_RC->doDump(fd)); 
     137  return new uint64_t(t_RC->doDump(fd) + dumpNegCache(t_sstorage->negcache, fd)); 
    116138} 
    117139 
  • trunk/pdns/pdns/recursor_cache.cc

    r1705 r1713  
    328328    return 0; 
    329329  } 
    330   fprintf(fp, "; dump from thread follows\n;\n"); 
     330  fprintf(fp, "; main record cache dump from thread follows\n;\n"); 
    331331  typedef cache_t::nth_index<1>::type sequence_t; 
    332332  sequence_t& sidx=d_cache.get<1>(); 
  • trunk/pdns/pdns/syncres.cc

    r1705 r1713  
    662662    } 
    663663  } 
    664  
    665664 
    666665  set<DNSResourceRecord> cset;