Repository navigation
zone: keep nameserver assignments on the zone - #86
Merged
Merged
Conversation
A zone's `nameservers` is the list of nameserver ids that serve it, as
in NicTool 2: the apex NS set, with the lowest id as the SOA MNAME.
mysql maps it to nt_zone_nameserver; the file stores keep it on the zone
row. Both return it ascending. GET /zone/{id}/ns lists the active ones in
that order, and destroy drops the assignments, since nt_zone_nameserver
has no foreign key to cascade from.
POST /zone without `nameservers` takes the group's usable nameservers,
the default NicTool 2 offered.
Needs @nictool/validate 1.0, where `nameservers` is a list of ids and PUT
accepts it, so this builds on #70.
Two concurrent replacements of a zone's set shared one connection and could interleave as DELETE, DELETE, INSERT, INSERT, leaving the union. A put that sets nameservers now holds the zone row FOR UPDATE inside a transaction on its own connection, and answers false when the zone is missing, where it used to insert orphan nt_zone_nameserver rows. A create with nameservers inserts the zone and its set in one transaction. lib/mysql.js gains transaction() exactly as #84 adds it.
| await conn.beginTransaction() | ||
| const tx = { | ||
| execute: async (query, paramsArray) => { | ||
| const [rows] = await conn.execute(query, paramsArray ?? []) |
Contributor
Author
There was a problem hiding this comment.
will handle in a follow up PR
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
A zone's
nameserversis the list of nameserver ids that serve it, as in NicTool 2: the apex NS set, with the lowest id as the SOA MNAME. mysql maps it to nt_zone_nameserver; the file stores keep it on the zone row. Both return it ascending. GET /zone/{id}/ns lists the active ones in that order, and destroy drops the assignments, since nt_zone_nameserver has no foreign key to cascade from.POST /zone without
nameserverstakes the group's usable nameservers, the default NicTool 2 offered.