Remove dnsutil.Dedup (#1867)

Remove the code and remove the call in etcd and kubernetes handlers.
This does mean we should not add dups in the first place, which means
adding maps in backend_lookup to prevent dups from begin added.

This should cut down on the allocations because dnsutil.Dedup is very
expensive by converting everything to strings, we avoid doing that now.
This commit is contained in:
Miek Gieben 2018-06-12 03:23:25 +01:00 committed by Yong Tang
parent 58d6991363
commit 6e466d5092
6 changed files with 66 additions and 61 deletions

View file

@ -4,7 +4,6 @@ import (
"context"
"github.com/coredns/coredns/plugin"
"github.com/coredns/coredns/plugin/pkg/dnsutil"
"github.com/coredns/coredns/request"
"github.com/miekg/dns"
@ -79,9 +78,6 @@ func (k Kubernetes) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.M
m.Answer = append(m.Answer, records...)
m.Extra = append(m.Extra, extra...)
// TODO(miek): get rid of this by not adding dups in the first place, dnsutil.Append()?
m = dnsutil.Dedup(m)
state.SizeAndDo(m)
m, _ = state.Scrub(m)
w.WriteMsg(m)