Skip to content

Commit

Permalink
Optimise delegation lookup ETS queries and drop named index on zone u…
Browse files Browse the repository at this point in the history
…pdate (#131)

The PR introduces optimizations for large zones:

Optimise delegation lookup ETS queries by dropping wildcard in the matchspec for get_delegated/1 function.
Drop named index on zone update via RRSet.
  • Loading branch information
DXTimer authored Jul 14, 2021
1 parent e2bdc4c commit 97d2b8e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
{shell, [{apps, [erldns]},
{config, "erldns.config"}]}.

{relx, [{release, {erldns, "1.0.0"},
{relx, [{release, {erldns, "2.2.0"},
[erldns]},

{dev_mode, true},
Expand Down
5 changes: 2 additions & 3 deletions src/erldns_zone_cache.erl
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ get_delegations(Name) ->
{ok, Zone} ->
Records =
lists:flatten(erldns_storage:select(zone_records_typed,
[{{{erldns:normalize_name(Zone#zone.name), '_', ?DNS_TYPE_NS}, '$1'}, [], ['$$']}],
[{{{erldns:normalize_name(Zone#zone.name), erldns:normalize_name(Name), ?DNS_TYPE_NS}, '$1'}, [], ['$$']}],
infinite)),
lists:filter(erldns_records:match_delegation(Name), Records);
_ ->
Expand Down Expand Up @@ -393,8 +393,7 @@ update_zone_records_and_digest(ZoneName, Records, Digest) ->
UpdatedZone =
Zone#zone{version = Digest,
authority = get_records_by_name_and_type(ZoneName, ?DNS_TYPE_SOA),
record_count = length(Records),
records_by_name = build_named_index(Records)},
record_count = length(Records)},
put_zone(Zone#zone.name, UpdatedZone);
_ ->
{error, zone_not_found}
Expand Down

0 comments on commit 97d2b8e

Please sign in to comment.