Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dnsdist: Refactoring of the configuration #14367

Draft
wants to merge 33 commits into
base: master
Choose a base branch
from

Conversation

rgacogne
Copy link
Member

Short description

This is a big pull request, better reviewed commit by commit!

The gist of this work is to refactor the way dnsdist's configuration is structured: instead of having a myriad of global variables holding the configuration items at runtime, we now have two configuration structure holding them:

  • a part that is immutable at runtime and can only be altered during the initial setup
  • a part that can be modified at runtime, and is wrapped into a RCU-like object so that updates are gracefully handled. To provide better performance, each thread gets a thread_local reference-counted copy of the configuration. Initial testing did not show any performance impact.
    The new structures disentangle a bit the different parts of the dnsdist code-base, but there is significant room for improvement there.

This paves the way to the next step, which is to support a YAML configuration format in addition to the existing Lua one. Later we should also be able to dump the current running configuration in the new YAML format, making it easy to convert from an existing Lua configuration, but to be clear there is no plan to get rid of the Lua configuration format.

Checklist

I have:

  • read the CONTRIBUTING.md document
  • compiled this code
  • tested this code
  • included documentation (including possible behaviour changes)
  • documented the code
  • added or modified regression test(s)
  • added or modified unit test(s)

Getting rid of the ugly DNSQuestion stubs in the meantime.
@rgacogne rgacogne added this to the dnsdist-2.0.0 milestone Jun 21, 2024
@coveralls
Copy link

coveralls commented Jun 21, 2024

Pull Request Test Coverage Report for Build 9612175005

Details

  • 1442 of 2010 (71.74%) changed or added relevant lines in 54 files are covered.
  • 167 unchanged lines in 19 files lost coverage.
  • Overall coverage decreased (-0.02%) to 64.656%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pdns/dnsdistdist/dnsdist-lua-bindings.cc 3 4 75.0%
pdns/dnsdistdist/dnsdist-lua-ffi.cc 6 7 85.71%
pdns/dnsdistdist/dnsdist-rules.hh 1 2 50.0%
pdns/dnsdistdist/dnsdist-svc.cc 2 3 66.67%
pdns/dnsdistdist/dnsdist-configuration.cc 20 22 90.91%
pdns/dnsdistdist/dnsdist-discovery.cc 19 21 90.48%
pdns/dnsdistdist/dnsdist-dnsquestion.cc 23 25 92.0%
pdns/dnsdistdist/dnsdist-nghttp2-in.cc 5 7 71.43%
pdns/tcpiohandler.cc 5 7 71.43%
pdns/dnsdistdist/dnsdist-carbon.cc 13 16 81.25%
Files with Coverage Reduction New Missed Lines %
pdns/dnsdistdist/dnsdist-web.cc 1 79.29%
pdns/pollmplexer.cc 1 83.66%
pdns/dnsdistdist/dnsdist-xsk.cc 1 4.2%
pdns/recursordist/sortlist.cc 2 74.12%
pdns/recursordist/aggressive_nsec.cc 2 66.32%
pdns/misc.cc 2 63.24%
pdns/recursordist/test-syncres_cc2.cc 3 88.85%
modules/gpgsqlbackend/spgsql.cc 3 67.94%
pdns/dnsdistdist/dnsdist-rings.hh 4 92.38%
modules/lmdbbackend/lmdbbackend.cc 4 73.5%
Totals Coverage Status
Change from base Build 9612093884: -0.02%
Covered Lines: 124369
Relevant Lines: 161748

💛 - Coveralls

pdns/dnsdistdist/dnsdist.cc Fixed Show fixed Hide fixed
pdns/dnsdistdist/dnsdist-carbon.cc Fixed Show fixed Hide fixed
@coveralls
Copy link

coveralls commented Jun 24, 2024

Pull Request Test Coverage Report for Build 9641535906

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 1444 of 2012 (71.77%) changed or added relevant lines in 54 files are covered.
  • 192 unchanged lines in 21 files lost coverage.
  • Overall coverage decreased (-0.03%) to 64.646%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pdns/dnsdistdist/dnsdist-lua-bindings.cc 3 4 75.0%
pdns/dnsdistdist/dnsdist-lua-ffi.cc 8 9 88.89%
pdns/dnsdistdist/dnsdist-rules.hh 1 2 50.0%
pdns/dnsdistdist/dnsdist-svc.cc 2 3 66.67%
pdns/dnsdistdist/dnsdist-configuration.cc 20 22 90.91%
pdns/dnsdistdist/dnsdist-discovery.cc 19 21 90.48%
pdns/dnsdistdist/dnsdist-dnsquestion.cc 23 25 92.0%
pdns/dnsdistdist/dnsdist-nghttp2-in.cc 5 7 71.43%
pdns/tcpiohandler.cc 5 7 71.43%
pdns/dnsdistdist/dnsdist-carbon.cc 13 16 81.25%
Files with Coverage Reduction New Missed Lines %
pdns/dnsdistdist/dnsdist-web.cc 1 79.29%
pdns/dnsdistdist/dnsdist-xsk.cc 1 4.2%
pdns/recursordist/sortlist.cc 2 72.94%
pdns/recursordist/aggressive_nsec.cc 2 66.32%
pdns/misc.cc 2 63.24%
pdns/recursordist/pdns_recursor.cc 2 72.35%
pdns/recursordist/test-syncres_cc2.cc 3 88.91%
pdns/misc.hh 3 87.62%
pdns/remote_logger.cc 3 53.81%
modules/gpgsqlbackend/spgsql.cc 3 68.18%
Totals Coverage Status
Change from base Build 9612093884: -0.03%
Covered Lines: 124367
Relevant Lines: 161749

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 24, 2024

Pull Request Test Coverage Report for Build 9644584400

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 1448 of 2016 (71.83%) changed or added relevant lines in 54 files are covered.
  • 505 unchanged lines in 22 files lost coverage.
  • Overall coverage decreased (-0.02%) to 64.649%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pdns/dnsdistdist/dnsdist-lua-bindings.cc 3 4 75.0%
pdns/dnsdistdist/dnsdist-lua-ffi.cc 8 9 88.89%
pdns/dnsdistdist/dnsdist-rules.hh 1 2 50.0%
pdns/dnsdistdist/dnsdist-svc.cc 2 3 66.67%
pdns/dnsdistdist/dnsdist-configuration.cc 20 22 90.91%
pdns/dnsdistdist/dnsdist-discovery.cc 19 21 90.48%
pdns/dnsdistdist/dnsdist-dnsquestion.cc 23 25 92.0%
pdns/dnsdistdist/dnsdist-nghttp2-in.cc 5 7 71.43%
pdns/tcpiohandler.cc 5 7 71.43%
pdns/dnsdistdist/dnsdist-carbon.cc 13 16 81.25%
Files with Coverage Reduction New Missed Lines %
pdns/dnsdistdist/dnsdist-web.cc 1 79.29%
pdns/backends/gsql/gsqlbackend.hh 1 96.0%
pdns/recursordist/syncres.cc 1 79.55%
pdns/pollmplexer.cc 1 83.66%
pdns/dnsdistdist/dnsdist-xsk.cc 1 4.2%
pdns/recursordist/sortlist.cc 2 72.94%
pdns/recursordist/aggressive_nsec.cc 2 66.39%
pdns/tcpiohandler.cc 2 66.87%
pdns/recursordist/test-syncres_cc2.cc 3 88.91%
pdns/misc.hh 3 87.62%
Totals Coverage Status
Change from base Build 9612093884: -0.02%
Covered Lines: 124390
Relevant Lines: 161762

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 24, 2024

Pull Request Test Coverage Report for Build 9647114721

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 1449 of 2017 (71.84%) changed or added relevant lines in 54 files are covered.
  • 504 unchanged lines in 22 files lost coverage.
  • Overall coverage decreased (-0.01%) to 64.66%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pdns/dnsdistdist/dnsdist-dynblocks.cc 52 53 98.11%
pdns/dnsdistdist/dnsdist-lua-bindings.cc 3 4 75.0%
pdns/dnsdistdist/dnsdist-lua-ffi.cc 8 9 88.89%
pdns/dnsdistdist/dnsdist-rules.hh 1 2 50.0%
pdns/dnsdistdist/dnsdist-svc.cc 2 3 66.67%
pdns/dnsdistdist/dnsdist-configuration.cc 20 22 90.91%
pdns/dnsdistdist/dnsdist-discovery.cc 19 21 90.48%
pdns/dnsdistdist/dnsdist-dnsquestion.cc 23 25 92.0%
pdns/dnsdistdist/dnsdist-nghttp2-in.cc 5 7 71.43%
pdns/tcpiohandler.cc 5 7 71.43%
Files with Coverage Reduction New Missed Lines %
pdns/dnsdistdist/dnsdist-web.cc 1 79.29%
pdns/packethandler.cc 1 72.91%
pdns/dnsdistdist/dnsdist-dynblocks.cc 1 68.56%
pdns/dnsdistdist/dnsdist-xsk.cc 1 4.2%
pdns/recursordist/sortlist.cc 2 72.94%
pdns/recursordist/aggressive_nsec.cc 2 66.39%
pdns/distributor.hh 2 51.86%
pdns/tcpiohandler.cc 2 66.75%
modules/lmdbbackend/lmdbbackend.cc 2 73.76%
pdns/misc.hh 3 87.62%
Totals Coverage Status
Change from base Build 9612093884: -0.01%
Covered Lines: 124401
Relevant Lines: 161765

💛 - Coveralls

Copy link
Member

@omoerbeek omoerbeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do have some remarks on the naming and I did not review all individual commits, but I love the general approach.

pdns/dnsdistdist/dnsdist-configuration.hh Outdated Show resolved Hide resolved
pdns/dnsdistdist/dnsdist-configuration.hh Outdated Show resolved Hide resolved
pdns/dnsdistdist/dnsdist-configuration.hh Outdated Show resolved Hide resolved
pdns/dnsdistdist/dnsdist-configuration.cc Show resolved Hide resolved
pdns/dnsdistdist/dnsdist-configuration.hh Show resolved Hide resolved
@coveralls
Copy link

coveralls commented Jun 25, 2024

Pull Request Test Coverage Report for Build 9662968350

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 1448 of 2019 (71.72%) changed or added relevant lines in 54 files are covered.
  • 506 unchanged lines in 19 files lost coverage.
  • Overall coverage decreased (-0.03%) to 64.642%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pdns/dnsdistdist/dnsdist-dynblocks.cc 52 53 98.11%
pdns/dnsdistdist/dnsdist-lua-bindings.cc 3 4 75.0%
pdns/dnsdistdist/dnsdist-lua-ffi.cc 8 9 88.89%
pdns/dnsdistdist/dnsdist-rules.hh 1 2 50.0%
pdns/dnsdistdist/dnsdist-svc.cc 2 3 66.67%
pdns/dnsdistdist/dnsdist-discovery.cc 19 21 90.48%
pdns/dnsdistdist/dnsdist-dnsquestion.cc 23 25 92.0%
pdns/dnsdistdist/dnsdist-nghttp2-in.cc 5 7 71.43%
pdns/tcpiohandler.cc 5 7 71.43%
pdns/dnsdistdist/dnsdist-carbon.cc 13 16 81.25%
Files with Coverage Reduction New Missed Lines %
pdns/dnsdistdist/dnsdist-web.cc 1 79.29%
ext/json11/json11.cpp 1 64.49%
pdns/backends/gsql/gsqlbackend.hh 1 97.71%
pdns/dnsdistdist/dnsdist-dynblocks.cc 1 68.56%
pdns/dnsdistdist/dnsdist-xsk.cc 1 4.2%
pdns/arguments.cc 2 59.45%
pdns/tcpiohandler.cc 2 66.75%
pdns/misc.hh 3 87.62%
pdns/dnsdistdist/dnsdist-rings.hh 4 92.38%
pdns/signingpipe.cc 7 85.75%
Totals Coverage Status
Change from base Build 9612093884: -0.03%
Covered Lines: 124383
Relevant Lines: 161766

💛 - Coveralls

@rgacogne rgacogne requested a review from omoerbeek June 28, 2024 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants