auth api: new endpoint to get the size of a zone#17568
Conversation
Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
|
ISTM size and record count could be very different things. if the API returns the count of records, it should IMO also be called like that. (F.e. size could also be count of rrsets, or count of characters of a BIND zone text representation, or ...) |
|
That name was intentional to force people to bikeshed which name would be more appropriate 😁 I'm waiting for people's ideas! |
:-D It could just return all of these things in json fields! |
I considered that too, but I think the user asking for that feature would prefer something simple. |
Coverage Report for CI Build 27420422207Warning Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes. Coverage increased (+11.4%) to 71.092%Details
Uncovered Changes
Coverage Regressions21604 previously-covered lines in 290 files lost coverage.
Coverage Stats💛 - Coveralls |
| static void apiServerZoneRecordCount(HttpRequest* req, HttpResponse* resp) | ||
| { | ||
| ZoneData zoneData{req}; | ||
| size_t recordCount{0}; |
There was a problem hiding this comment.
I wonder if we should cache/store this value in the backend and update it whenever a record change is made to ensure we don't need to list huge zones every time. That would of course require users who directly edit things in the database to update this themselves as well.
There was a problem hiding this comment.
That would require a schema change to store that data in the domain table, and probably a lot of painful procedures in order to be sure to trust the data. While this would be much better, I am not ready to force a database schema change down the throat of our users yet.
There was a problem hiding this comment.
That said, this could be added as a new, optional, backend entrypoint, so that e.g. sql backends could perform a better query to only get a count of records.
There was a problem hiding this comment.
This code still beats the previous practice, which is "list everything and let the client count"
Short description
This PR introduces a
/sizeendpoint for zones, which returns the number of records found in the zone (not counting theENT).Checklist
I have: