-
Notifications
You must be signed in to change notification settings - Fork 33
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
sort generated data files #1352
Conversation
What benefit does that give?
What are the backsides of that? |
Please give a more descriptive headline of the PR. |
|
To ensure the reproducibility of *.data files when doing a |
I cannot remember that I have ever compare data files. Unless someone has pointed out that he/she really wants it I think it is better not to change. I assume you will remove that change. |
This is something i proposed, it is not implemented in this PR. (i have edited the PR's notes) |
With this approach we gain idempotence in the sense that the saved file is the same every time (provided that no code or configuration has changed). But we also lose idempotence in the sense that the original analysis sees the real IDs, but when we analyze a restored cache the analysis sees zeroed out IDs. In this light wouldn't it be more proper to clear the ID at response reception? I.e. before analysis and insertion into the cache. I don't think we're ever looking at the ID fields in our built-in test modules, but since we want to support custom test modules, I believe it could make sense to have idempotence in both these ways. |
The thing about Message ID is that if the response does not have the same Message ID as the query it is not a response to that query and should be ignored or match with another query. |
Yes, it wouldn't make much sense to clear the response's Message ID before it's matched to the request's Message ID. The ldns library takes care of this matching for us and just returns the correct response matching our request. What I'm suggesting is that we clear the ID field in Zonemaster Engine or perhaps in Zonemaster LDNS after ldns returns it but before we add it to the cache. |
I suggest that we discuss this at the F2F. |
to ensure the idempotence of generated file we need to be sure that all keys of JSON exported data are sorted, especially for "Zonemaster::LDNS::Packet".
This reverts commit 0afe50e.
@MichaelTimbert, please merge. |
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.
I suggest that the description of this PR is also updated to match the latest changes
Purpose
This PR improve generating data files by sorting entries in *.data files and ensuring JSON dump are also sorted.
The goal is to reduce the mess of deletions and insertions from
git diff
whent/*.data
files are modified.Context
Fixes #1265
How to test this PR
run
ZONEMASTER_RECORD=1 make test
to save new formated *.data file.Notes
To improve visibility of change we can also activate indentation of JSON dump with
$json->indent( 1 );
.This makes it easier to read the differences between JSON dump with
vimdiff
orgit diff
but makes*.data
files less readable/compact.