-
Notifications
You must be signed in to change notification settings - Fork 914
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
rec: dedup records #14617
Draft
omoerbeek
wants to merge
9
commits into
PowerDNS:master
Choose a base branch
from
omoerbeek:rec-dedup-recs
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
rec: dedup records #14617
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
298efa5
rec: dedup results from auths and results constructed ourselves
omoerbeek 594719d
No need to dedup the dns64 case seperately anymore
omoerbeek 068fe5a
Adapt test to not use repeating records
omoerbeek 51b72ba
Rework dedup code and add a test for pdsn::dedup
omoerbeek af610df
Faster dedup, not using zoneRepresentation but wire format, which all…
omoerbeek 709cf06
Add speedtest for shuffle, plus a speedup in shuffle itself
omoerbeek 97e3d01
rename pdns::shuffle to pdns::shufleRecords, as suggested by @rgacogne
omoerbeek fb4e019
Refactor serialize/wireFormatContent as suggested by @rgacogne
omoerbeek e26c334
Dedup only in specific places
omoerbeek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* This file is part of PowerDNS or dnsdist. | ||
* Copyright -- PowerDNS.COM B.V. and its contributors | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of version 2 of the GNU General Public License as | ||
* published by the Free Software Foundation. | ||
* | ||
* In addition, for the avoidance of any doubt, permission is granted to | ||
* link this program with OpenSSL and to (re)distribute the binaries | ||
* produced as the result of such linking. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
|
||
#ifndef BOOST_TEST_DYN_LINK | ||
#define BOOST_TEST_DYN_LINK | ||
#endif | ||
|
||
#define BOOST_TEST_NO_MAIN | ||
|
||
#include "config.h" | ||
#include <boost/test/unit_test.hpp> | ||
|
||
#include "shuffle.hh" | ||
#include "test-common.hh" | ||
|
||
BOOST_AUTO_TEST_SUITE(shuffle_cc) | ||
|
||
BOOST_AUTO_TEST_CASE(test_simple) | ||
{ | ||
std::vector<DNSRecord> list; | ||
auto* address = &list; | ||
addRecordToList(list, DNSName("foo"), QType::A, "1.2.3.4"); | ||
addRecordToList(list, DNSName("foo2"), QType::A, "1.2.3.4"); | ||
auto dups = pdns::dedupRecords(list); | ||
BOOST_CHECK_EQUAL(dups, 0U); | ||
BOOST_CHECK_EQUAL(list.size(), 2U); | ||
addRecordToList(list, DNSName("foo"), QType::A, "1.2.3.4"); | ||
dups = pdns::dedupRecords(list); | ||
BOOST_CHECK_EQUAL(dups, 1U); | ||
BOOST_CHECK_EQUAL(list.size(), 2U); | ||
addRecordToList(list, DNSName("Foo"), QType::A, "1.2.3.4"); | ||
addRecordToList(list, DNSName("FoO"), QType::A, "1.2.3.4", DNSResourceRecord::ADDITIONAL, 999); | ||
dups = pdns::dedupRecords(list); | ||
BOOST_CHECK_EQUAL(dups, 2U); | ||
BOOST_CHECK_EQUAL(list.size(), 2U); | ||
BOOST_CHECK_EQUAL(address, &list); | ||
} | ||
|
||
BOOST_AUTO_TEST_SUITE_END() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we go forward, we might want to consider a small refactoring to avoid duplicating code between
serialize
andwireFormatContent
.