-
Notifications
You must be signed in to change notification settings - Fork 282
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
rpc dumpzone: dump HNS root zone to file #534
base: master
Are you sure you want to change the base?
Conversation
sample:
|
const iter = tree.iterator(true); | ||
|
||
let count = 0; | ||
while ((await iter.next()) && (fd != null)) { |
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.
Is this fd
check redundant with the check on 2571?
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.
probably can remove one or other, just trying to catch if the fd.on('error',...
got triggered
JS isn't my strongest skill, so likely all that error handling can all be done better
I think it was to try & catch things like disk-full
Pull Request Test Coverage Report for Build 602759748
💛 - Coveralls |
Co-authored-by: James Stevens <github@jrcs.net> Co-authored-by: Mark Tyneway <mark.tyneway@gmail.com>
Handling a shutdown gracefully during this is also something to consider |
Excluding The parent owns the So having these If there are
By reading the data from the Urkel Tree, you probably solve a few race conditions if data is updated when the dump is run (:+1:), but it would also be nice if the SOA Serial given, when polled over UDP (say), reflected the Urkel Tree update-time, instead of just being the current date & time ... That way the zone data dumped would be consistent with the SOA Serial ... we did discuss this. Using the Urkel Tree also means if you dump the zone on two different servers, within the same 36-block commit cycle, you should get the same zone - this is good & highly desirable for failover purposes 👍 |
Added one more commit e80b835 which fixes another SYNTH4/SYNTH6 decoding issue that should have been caught in #444 Example output of my own mainnet name
Also worth noting that #566 may affect this rpc output concerning TXT records in the root zone, but I think we decided that was ok. Currently this branch will print TXT even if NS is present:
|
new TODO: some names have unknown resource versions, bypass them, otherwise the process will throw and abort. diff --git a/lib/node/rpc.js b/lib/node/rpc.js
index 1973aa98e..96f276574 100644
--- a/lib/node/rpc.js
+++ b/lib/node/rpc.js
@@ -2629,7 +2629,19 @@ class RPC extends RPCBase {
continue;
const fqdn = bns.util.fqdn(ns.name.toString('ascii'));
- const resource = Resource.decode(ns.data);
+
+ let resource;
+ try {
+ resource = Resource.decode(ns.data);
+ } catch (e) {
+ this.logger.warning(
+ 'could not process resource for name: %s (%s)',
+ fqdn,
+ e.message
+ );
+ continue;
+ }
+
const zone = resource.toZone(fqdn);
for (const record of zone) {
if (fd == null) result:
|
continue; | ||
|
||
const fqdn = bns.util.fqdn(ns.name.toString('ascii')); | ||
const resource = Resource.decode(ns.data); |
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.
const resource = Resource.decode(ns.data); | |
try { | |
const resource = Resource.decode(ns.data); | |
} catch (e) { | |
continue; | |
} |
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.
Per our testing this needs to be updated to:
let resource;
try {
resource = Resource.decode(ns.data);
if (!resource) continue;
} catch (e) {
continue;
}
TBH: I think |
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.
Merged with local pull of master, with rithvikvibhu's update at line 2581 of lib/node/rpc.js:
let resource;
try {
resource = Resource.decode(ns.data);
if (!resource) continue;
} catch (e) {
continue;
}
I was able to pull the zonefile, 16 GB.
continue; | ||
|
||
const fqdn = bns.util.fqdn(ns.name.toString('ascii')); | ||
const resource = Resource.decode(ns.data); |
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.
Per our testing this needs to be updated to:
let resource;
try {
resource = Resource.decode(ns.data);
if (!resource) continue;
} catch (e) {
continue;
}
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.
tested RPC DUMPZONE
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.
Update lib/node/rpc.js
Line 2581 'const resource = Resource.decode(ns.data);'
to
let resource;
try {
resource = Resource.decode(ns.data);
if (!resource) continue;
} catch (e) {
continue;
}
Closes #152
File output is standard zone file format: https://tools.ietf.org/html/rfc1035#section-5.1
Replaces #280
Based on https://github.com/james-stevens/handshake-bridge by @james-stevens
Major differences from these two predecessors:
txn
(which include record updates between the 36-block commit cycle)TXT
records (handshake-bridge didn't either by design or by accident by callingResource.toDNS()
which results in a referral-only answer)