Skip to content

zone: keep nameserver assignments on the zone - #86

Merged
msimerson merged 3 commits into
mainfrom
zone-nameservers
Oct 16, 2026
Merged

msimerson merged 3 commits into
mainfrom
zone-nameservers

Conversation

@msimerson

@msimerson msimerson commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

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.

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.

This comment was marked as outdated.

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.
Comment thread lib/mysql.js
await conn.beginTransaction()
const tx = {
execute: async (query, paramsArray) => {
const [rows] = await conn.execute(query, paramsArray ?? [])

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will handle in a follow up PR

@msimerson
msimerson merged commit 51c9b55 into main Oct 16, 2026
12 of 13 checks passed
@msimerson
msimerson deleted the zone-nameservers branch October 16, 2026 02:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants