dnsdist: Refactoring of the configuration
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_localreference-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:
- [x] read the CONTRIBUTING.md document
- [x] compiled this code
- [x] tested this code
- [ ] included documentation (including possible behaviour changes)
- [x] documented the code
- [ ] added or modified regression test(s)
- [x] added or modified unit test(s)
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% |
| <!-- | Total: | 1442 | 2010 |
| 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% |
| <!-- | Total: | 167 |
| Totals | |
|---|---|
| Change from base Build 9612093884: | -0.02% |
| Covered Lines: | 124369 |
| Relevant Lines: | 161748 |
💛 - Coveralls
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.
- For more information on this, see Tracking coverage changes with pull request builds.
- To avoid this issue with future PRs, see these Recommended CI Configurations.
- For a quick fix, rebase this PR at GitHub. Your next report should be accurate.
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% |
| <!-- | Total: | 1444 | 2012 |
| 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% |
| <!-- | Total: | 192 |
| Totals | |
|---|---|
| Change from base Build 9612093884: | -0.03% |
| Covered Lines: | 124367 |
| Relevant Lines: | 161749 |
💛 - Coveralls
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.
- For more information on this, see Tracking coverage changes with pull request builds.
- To avoid this issue with future PRs, see these Recommended CI Configurations.
- For a quick fix, rebase this PR at GitHub. Your next report should be accurate.
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% |
| <!-- | Total: | 1448 | 2016 |
| 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% |
| <!-- | Total: | 505 |
| Totals | |
|---|---|
| Change from base Build 9612093884: | -0.02% |
| Covered Lines: | 124390 |
| Relevant Lines: | 161762 |
💛 - Coveralls
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.
- For more information on this, see Tracking coverage changes with pull request builds.
- To avoid this issue with future PRs, see these Recommended CI Configurations.
- For a quick fix, rebase this PR at GitHub. Your next report should be accurate.
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% |
| <!-- | Total: | 1449 | 2017 |
| 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% |
| <!-- | Total: | 504 |
| Totals | |
|---|---|
| Change from base Build 9612093884: | -0.01% |
| Covered Lines: | 124401 |
| Relevant Lines: | 161765 |
💛 - Coveralls
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.
- For more information on this, see Tracking coverage changes with pull request builds.
- To avoid this issue with future PRs, see these Recommended CI Configurations.
- For a quick fix, rebase this PR at GitHub. Your next report should be accurate.
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% |
| <!-- | Total: | 1448 | 2019 |
| 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% |
| <!-- | Total: | 506 |
| Totals | |
|---|---|
| Change from base Build 9612093884: | -0.03% |
| Covered Lines: | 124383 |
| Relevant Lines: | 161766 |
💛 - Coveralls
Rebased to fix a conflict.
Pull Request Test Coverage Report for Build 9805982772
Details
- 1451 of 2019 (71.87%) changed or added relevant lines in 54 files are covered.
- 196 unchanged lines in 23 files lost coverage.
- Overall coverage increased (+0.003%) to 64.682%
| 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% |
| <!-- | Total: | 1451 | 2019 |
| Files with Coverage Reduction | New Missed Lines | % |
|---|---|---|
| pdns/dnsdistdist/dnsdist-web.cc | 1 | 79.35% |
| pdns/packethandler.cc | 1 | 72.86% |
| pdns/dnsdistdist/dnsdist-dynblocks.cc | 1 | 68.56% |
| pdns/pollmplexer.cc | 1 | 83.66% |
| pdns/dnsdistdist/dnsdist-xsk.cc | 1 | 4.2% |
| pdns/recursordist/aggressive_nsec.cc | 2 | 66.39% |
| pdns/ws-auth.cc | 2 | 80.78% |
| pdns/iputils.hh | 3 | 78.29% |
| pdns/channel.hh | 3 | 53.73% |
| pdns/dnsdistdist/dnsdist-rings.hh | 4 | 92.38% |
| <!-- | Total: | 196 |
| Totals | |
|---|---|
| Change from base Build 9803423322: | 0.003% |
| Covered Lines: | 124521 |
| Relevant Lines: | 161899 |
💛 - Coveralls
Pull Request Test Coverage Report for Build 9937324296
Details
- 1451 of 2019 (71.87%) changed or added relevant lines in 54 files are covered.
- 181 unchanged lines in 20 files lost coverage.
- Overall coverage decreased (-0.02%) to 64.674%
| 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% |
| <!-- | Total: | 1451 | 2019 |
| Files with Coverage Reduction | New Missed Lines | % |
|---|---|---|
| pdns/dnsdistdist/dnsdist-web.cc | 1 | 79.35% |
| modules/gpgsqlbackend/gpgsqlbackend.cc | 1 | 88.62% |
| pdns/recursordist/syncres.cc | 1 | 79.51% |
| pdns/dnsdistdist/dnsdist-dynblocks.cc | 1 | 68.56% |
| pdns/dnsdistdist/dnsdist-xsk.cc | 1 | 4.24% |
| pdns/recursordist/aggressive_nsec.cc | 2 | 66.32% |
| pdns/misc.hh | 3 | 87.62% |
| pdns/signingpipe.cc | 3 | 86.29% |
| pdns/dnsdistdist/dnsdist-rings.hh | 4 | 92.38% |
| pdns/ssqlite3.cc | 5 | 66.77% |
| <!-- | Total: | 181 |
| Totals | |
|---|---|
| Change from base Build 9907134661: | -0.02% |
| Covered Lines: | 124542 |
| Relevant Lines: | 161953 |
💛 - Coveralls
I think the time has come to merge this:
- we have no other open pull requests for dnsdist, which is good because I'd expect a fair amount of conflicts otherwise
- we moved a lot of files from pdns/ to pdns/dnsdistdist/ since 1.9.x so backporting is already painful
- code looks good
- performance looks good
- the next version will be 2.0, with some breakage expected anyway