Add extra debug statements
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
parent
d3826c9743
commit
399ca11038
|
@ -1065,6 +1065,7 @@ void DB_read_queries(void)
|
|||
query->qtype = type - 100;
|
||||
}
|
||||
counters->querytype[query->type]++;
|
||||
log_debug(DEBUG_GC, "GC: query type %d set (database), new count = %d", query->type, counters->querytype[query->type]);
|
||||
|
||||
// Status is set below
|
||||
query->domainID = domainID;
|
||||
|
@ -1076,6 +1077,7 @@ void DB_read_queries(void)
|
|||
query->dnssec = dnssec;
|
||||
query->reply = reply;
|
||||
counters->reply[query->reply]++;
|
||||
log_debug(DEBUG_GC, "GC: reply type %d set (database), new count = %d", query->reply, counters->reply[query->reply]);
|
||||
query->response = reply_time;
|
||||
query->CNAME_domainID = -1;
|
||||
// Initialize flags
|
||||
|
|
|
@ -1037,8 +1037,12 @@ void _query_set_status(queriesData *query, const enum query_status new_status, c
|
|||
|
||||
// else: update global counters, ...
|
||||
if(!init)
|
||||
{
|
||||
counters->status[old_status]--;
|
||||
log_debug(DEBUG_GC, "GC: status %d removed (!init), new count = %d", QUERY_UNKNOWN, counters->status[QUERY_UNKNOWN]);
|
||||
}
|
||||
counters->status[new_status]++;
|
||||
log_debug(DEBUG_GC, "GC: status %d set, new count = %d", new_status, counters->status[new_status]);
|
||||
|
||||
// ... update overTime counters, ...
|
||||
const int timeidx = getOverTimeID(query->timestamp);
|
||||
|
|
|
@ -747,6 +747,7 @@ bool _FTL_new_query(const unsigned int flags, const char *name,
|
|||
query->timestamp = querytimestamp;
|
||||
query->type = querytype;
|
||||
counters->querytype[querytype]++;
|
||||
log_debug(DEBUG_GC, "GC: query type %d set (new query), new count = %d", query->type, counters->querytype[query->type]);
|
||||
query->qtype = qtype;
|
||||
query->id = id; // Has to be set before calling query_set_status()
|
||||
|
||||
|
@ -763,6 +764,7 @@ bool _FTL_new_query(const unsigned int flags, const char *name,
|
|||
// Initialize reply type
|
||||
query->reply = REPLY_UNKNOWN;
|
||||
counters->reply[REPLY_UNKNOWN]++;
|
||||
log_debug(DEBUG_GC, "GC: reply type %d set (new query), new count = %d", query->reply, counters->reply[query->reply]);
|
||||
// Store DNSSEC result for this domain
|
||||
query->dnssec = DNSSEC_UNKNOWN;
|
||||
query->CNAME_domainID = -1;
|
||||
|
@ -2729,10 +2731,12 @@ static void _query_set_reply(const unsigned int flags, const enum reply_type rep
|
|||
|
||||
// Subtract from old reply counter
|
||||
counters->reply[query->reply]--;
|
||||
log_debug(DEBUG_GC, "GC: reply type %d removed (set_reply), new count = %d", query->reply, counters->reply[query->reply]);
|
||||
// Add to new reply counter
|
||||
counters->reply[new_reply]++;
|
||||
// Store reply type
|
||||
query->reply = new_reply;
|
||||
log_debug(DEBUG_GC, "GC: reply type %d added (set_reply), new count = %d", query->reply, counters->reply[query->reply]);
|
||||
|
||||
// Save response time
|
||||
// Skipped internally if already computed
|
||||
|
@ -3349,8 +3353,10 @@ void FTL_multiple_replies(const int id, int *firstID)
|
|||
|
||||
// Copy relevant information over
|
||||
counters->reply[duplicated_query->reply]--;
|
||||
log_debug(DEBUG_GC, "GC: duplicated_query reply type %d removed, new count = %d", duplicated_query->reply, counters->reply[duplicated_query->reply]);
|
||||
duplicated_query->reply = source_query->reply;
|
||||
counters->reply[duplicated_query->reply]++;
|
||||
log_debug(DEBUG_GC, "GC: duplicated_query reply type %d set, new count = %d", duplicated_query->reply, counters->reply[duplicated_query->reply]);
|
||||
|
||||
duplicated_query->dnssec = source_query->dnssec;
|
||||
duplicated_query->flags.complete = true;
|
||||
|
|
29
src/gc.c
29
src/gc.c
|
@ -297,8 +297,8 @@ void runGC(const time_t now, time_t *lastGCrun, const bool flush)
|
|||
}
|
||||
|
||||
// Process all queries
|
||||
int removed = 0;
|
||||
for(long int i=0; i < counters->queries; i++)
|
||||
unsigned int removed = 0;
|
||||
for(long int i = 0; i < counters->queries; i++)
|
||||
{
|
||||
queriesData* query = getQuery(i, true);
|
||||
if(query == NULL)
|
||||
|
@ -308,19 +308,25 @@ void runGC(const time_t now, time_t *lastGCrun, const bool flush)
|
|||
if(query->timestamp > mintime)
|
||||
break;
|
||||
|
||||
// Adjust client counter (total and overTime)
|
||||
clientsData* client = getClient(query->clientID, true);
|
||||
// Adjust overTime counter
|
||||
const int timeidx = getOverTimeID(query->timestamp);
|
||||
overTime[timeidx].total--;
|
||||
|
||||
// Adjust client counter (total and overTime)
|
||||
clientsData* client = getClient(query->clientID, true);
|
||||
if(client != NULL)
|
||||
change_clientcount(client, -1, 0, timeidx, -1);
|
||||
|
||||
// Adjust domain counter (no overTime information)
|
||||
domainsData* domain = getDomain(query->domainID, true);
|
||||
domainsData *domain = getDomain(query->domainID, true);
|
||||
if(domain != NULL)
|
||||
domain->count--;
|
||||
|
||||
// Get upstream pointer
|
||||
// Adjust upstream counter (no overTime information)
|
||||
upstreamsData *upstream = getUpstream(query->upstreamID, true);
|
||||
if(upstream != NULL)
|
||||
// Adjust upstream counter
|
||||
upstream->count--;
|
||||
|
||||
// Change other counters according to status of this query
|
||||
switch(query->status)
|
||||
|
@ -354,24 +360,29 @@ void runGC(const time_t now, time_t *lastGCrun, const bool flush)
|
|||
if(client != NULL)
|
||||
change_clientcount(client, 0, -1, -1, 0);
|
||||
break;
|
||||
case QUERY_IN_PROGRESS: // Don't have to do anything here
|
||||
case QUERY_IN_PROGRESS: // fall through
|
||||
case QUERY_STATUS_MAX: // fall through
|
||||
default:
|
||||
/* That cannot happen */
|
||||
// Don't have to do anything here
|
||||
break;
|
||||
}
|
||||
|
||||
// Update reply counters
|
||||
counters->reply[query->reply]--;
|
||||
log_debug(DEBUG_GC, "GC: reply type %d removed (GC), new count = %d", query->reply, counters->reply[query->reply]);
|
||||
|
||||
// Update type counters
|
||||
counters->querytype[query->type]--;
|
||||
log_debug(DEBUG_GC, "GC: query type %d removed (GC), new count = %d", query->type, counters->querytype[query->type]);
|
||||
|
||||
// Subtract UNKNOWN from the counters before
|
||||
// setting the status if different.
|
||||
// Minus one here and plus one below = net zero
|
||||
if(query->status != QUERY_UNKNOWN)
|
||||
{
|
||||
counters->status[QUERY_UNKNOWN]--;
|
||||
log_debug(DEBUG_GC, "GC: status %d removed (GC), new count = %d", QUERY_UNKNOWN, counters->status[QUERY_UNKNOWN]);
|
||||
}
|
||||
|
||||
// Set query again to UNKNOWN to reset the counters
|
||||
query_set_status(query, QUERY_UNKNOWN);
|
||||
|
@ -417,7 +428,7 @@ void runGC(const time_t now, time_t *lastGCrun, const bool flush)
|
|||
// Determine if overTime memory needs to get moved
|
||||
moveOverTimeMemory(mintime);
|
||||
|
||||
log_debug(DEBUG_GC, "GC removed %i queries (took %.2f ms)", removed, timer_elapsed_msec(GC_TIMER));
|
||||
log_debug(DEBUG_GC, "GC removed %u queries (took %.2f ms)", removed, timer_elapsed_msec(GC_TIMER));
|
||||
|
||||
// Release thread lock
|
||||
if(!flush)
|
||||
|
|
Loading…
Reference in New Issue