]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
daemon/worker: reverted inbound deduping
authorMarek Vavrusa <marek@vavrusa.com>
Thu, 23 Jun 2016 06:12:38 +0000 (23:12 -0700)
committerMarek Vavrusa <marek@vavrusa.com>
Wed, 6 Jul 2016 06:33:38 +0000 (23:33 -0700)
the e638f9fb6e5aa20e090ebfa52255abc36a619bfd introduced deduplication
for queries over UDP, the idea is to track same queries and answer
only once, however that introduces both constant processing and
memory overhead and could break clients who count packet loss
by queries sent/received. disabling for now.

daemon/worker.c
daemon/worker.h
tests/deckard

index 30cce83426631ec4b238b92791620e7222d3e7e8..02cbfdcbf9d83d2c9606d235d9f15f86f182d8aa 100644 (file)
@@ -353,11 +353,6 @@ static int qr_task_start(struct qr_task *task, knot_pkt_t *query)
        if (worker->stats.concurrent < QUERY_RATE_THRESHOLD) {
                task->req.options |= QUERY_NO_THROTTLE;
        }
-       /* Track outstanding inbound queries as well for deduplication. */
-       char key[KR_RRKEY_LEN];
-       if (subreq_key(key, query) > 0) {
-               map_set(&task->worker->outstanding, key, task);
-       }
        return 0;
 }
 
@@ -396,12 +391,6 @@ static void qr_task_complete(struct qr_task *task)
        if (task->on_complete) {
                task->on_complete(worker, &task->req, task->baton);
        }
-       char key[KR_RRKEY_LEN];
-       /* Clear outstanding query. */
-       int ret = subreq_key(key, task->req.answer);
-       if (ret > 0) {
-               map_del(&task->worker->outstanding, key);
-       }
        /* Release primary reference to task. */
        qr_task_unref(task);
 }
@@ -796,28 +785,6 @@ int worker_submit(struct worker_ctx *worker, uv_handle_t *handle, knot_pkt_t *ms
                        if (msg) worker->stats.dropped += 1;
                        return kr_error(EINVAL); /* Ignore. */
                }
-               /* De-duplicate inbound requests.
-                * Many clients do frequent retransmits of the query
-                * in order to avoid network losses and get better service,
-                * but fail to work properly when resolver answers them all
-                * but some of them SERVFAIL because of the time limit and some
-                * of them succeed. It's also a good idea to avoid wasting time
-                * tracking pending tasks to solve the same thing. */
-               char key[KR_RRKEY_LEN];
-               if (subreq_key(key, msg) > 0) {
-                       struct qr_task *task = map_get(&worker->outstanding, key);
-                       if (task && task->source.handle == handle && task->req.qsource.addr &&
-                               addr->sa_family == task->source.addr.ip4.sin_family &&
-                               knot_wire_get_id(msg->wire) == knot_wire_get_id(task->req.answer->wire)) {
-                               /* Query probably matches, check if it comes from the same origin. */
-                               size_t addr_len = sizeof(struct sockaddr_in);
-                               if (addr->sa_family == AF_INET6)
-                                       addr_len = sizeof(struct sockaddr_in6);
-                               if (memcmp(&task->source.addr, addr, addr_len) == 0) {
-                                       return kr_error(EEXIST); /* Ignore query */
-                               }
-                       }
-               }
                task = qr_task_create(worker, handle, addr);
                if (!task) {
                        return kr_error(ENOMEM);
@@ -1019,7 +986,6 @@ int worker_reserve(struct worker_ctx *worker, size_t ring_maxlen)
        worker->pkt_pool.ctx = mp_new (4 * sizeof(knot_pkt_t));
        worker->pkt_pool.alloc = (knot_mm_alloc_t) mp_alloc;
        worker->outgoing = map_make();
-       worker->outstanding = map_make();
        worker->tcp_pipeline_max = MAX_PIPELINED;
        return kr_ok();
 }
@@ -1040,7 +1006,6 @@ void worker_reclaim(struct worker_ctx *worker)
        mp_delete(worker->pkt_pool.ctx);
        worker->pkt_pool.ctx = NULL;
        map_clear(&worker->outgoing);
-       map_clear(&worker->outstanding);
 }
 
 #undef DEBUG_MSG
index e5527486e9a8f54ada0bb4451b8a3aac156b8738..981e03b6c97b69b5425a9ab3cc7fc2f863a9ae55 100644 (file)
@@ -51,7 +51,6 @@ struct worker_ctx {
                size_t timeout;
        } stats;
        map_t outgoing;
-       map_t outstanding;
        mp_freelist_t pool_mp;
        mp_freelist_t pool_ioreq;
        mp_freelist_t pool_sessions;
index e97631844d4f0cca5381ca541f31b8a2acb46b54..1bdecfcde89a39d47dfcc03a0712a04bb668583f 160000 (submodule)
@@ -1 +1 @@
-Subproject commit e97631844d4f0cca5381ca541f31b8a2acb46b54
+Subproject commit 1bdecfcde89a39d47dfcc03a0712a04bb668583f