auth: domain transactions - #17809
Conversation
Coverage Report for CI Build 30531048200Warning Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes. Coverage decreased (-0.02%) to 71.177%Details
Uncovered Changes
Coverage Regressions7162 previously-covered lines in 85 files lost coverage.
Coverage Stats💛 - Coveralls |
f1a5e11 to
9df5145
Compare
Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
This spares callers from issueing a getDomainInfo() call. Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
A startTransaction() wrapper around the new APIs is preserved for now. Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
This capability reports that the backend is able to handle domain creation and provisioning in a single transaction. The create*Domain() backend interfaces are extended to take a "startTransaction" boolean, which will be ignored by backends lacking this ability. At the moment, none of the backends implement this functionality yet. Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
…saction. Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
9df5145 to
3f0d22d
Compare
|
While there is still hope LMDB can benefit from this, this requires quite a lot of work in its bowels, so if it eventually happens, this will be in a different PR. Which means this PR can be considered complete (except for bugs) and ready for review now. |
|
For the record (might benefit our future selves), regarding the LMDB backend: Domain transactions can't be done in the current state of things. LMDB requires that, at any time, there is only one active write transaction. That transaction is associated to a unique MDB_env. Every MDB_env in turn is associated to a single file. In order to be able to make domain transactions work, we would thus need domains and records to be stored in the same file. Which isn't the case, as domains are stored in the main file, while records are split across the various shard files. But then, LMDB also allows to nest transactions, so that they can be commited (or aborted) in the reverse order of their creation; so we can theoretically implement domain transactions by making the "records" transaction used to fill the domain contents, a child of the "domain" transaction creating it in the first place. This just requires heavy lifting of the code, which is probably better done in a separate PR while this one gets attention, dust settles, etc. |
Short description
It has been noticed for a while, that the current transaction model used in the authoritative server only covers records (and comments). Which means that attempts to create and populate a domain from invalid data would first, create an empty domain, then start a transaction to fill it, then abort it due to the data being invalid, leaving an empty domain.
This PR tries to make the domain creation part of the transaction, so that aborting it will correctly leave no trace of the new domain.
It is better reviewed on a per-commit basis.
The reason why domains are not part of transactions, is that transactions are tied to a backend domain id, which can't be known unless the domain exist. The first commits perform plumbing, first to make domain creation calls return a filled
DomainInfostruct (i.e. perform an immediategetDomainInfocall which would have been issued by the caller soon anyway).Then we can add the ability to these create domain routines to start a transaction at domain creation time as well. This depends upon backend support, which is why a new capability,
CAP_DOMAIN_TRANSACTION, is added to report that ability.At the moment only the SQL backends and the Bind backend (in secondary mode) support this. I am still wrestling with the LMDB backend, with no success yet.
Checklist
I have: