diff --git a/include/cache.h b/include/cache.h index 371170d..4d2bbe8 100644 --- a/include/cache.h +++ b/include/cache.h @@ -82,6 +82,7 @@ struct cache { uint32_t upd_fail_enoent; uint32_t commit_ok; + uint32_t commit_delete; uint32_t commit_fail; uint32_t flush; diff --git a/src/cache_iterators.c b/src/cache_iterators.c index e16a621..54613b9 100644 --- a/src/cache_iterators.c +++ b/src/cache_iterators.c @@ -134,6 +134,7 @@ retry: if (errno == EEXIST && retry == 1) { ret = nl_destroy_conntrack(tmp->h, ct); if (ret == 0 || (ret == -1 && errno == ENOENT)) { + tmp->c->stats.commit_delete++; if (retry) { retry = 0; goto retry; @@ -179,6 +180,7 @@ void cache_commit(struct cache *c) { unsigned int commit_ok = c->stats.commit_ok; unsigned int commit_fail = c->stats.commit_fail; + unsigned int commit_delete = c->stats.commit_delete; struct __commit_container tmp; struct timeval commit_start, commit_stop, res; @@ -199,6 +201,11 @@ void cache_commit(struct cache *c) /* calculate new entries committed */ commit_ok = c->stats.commit_ok - commit_ok; commit_fail = c->stats.commit_fail - commit_fail; + commit_delete = c->stats.commit_delete - commit_delete; + + if (commit_delete) + dlog(LOG_NOTICE, "%u old entries deleted before " + "commit", c->stats.commit_delete); /* log results */ dlog(LOG_NOTICE, "Committed %u new entries", commit_ok);