rob05c commented on issue #2161:
URL: https://github.com/apache/trafficcontrol/issues/2161#issuecomment-879231537


   > this could be achieved via a script
   
   Not safely. Issuing multiple requests has race conditions, and results in 
temporarily malformed data in Traffic Ops, potentially permanently if some 
requests fail.
   
   Rather than a specific "POST bulk-dns-ttl", I think we should add a generic 
ability to make bulk requests, which share the same DB transaction, and are 
therefore Atomic and Isolated.
   
   It shouldn't be too hard to do. It's not trivial, but we could add a format 
that's essentially 
   
   ```{"multi-request": [{ "path": "/api/3.1/foo", "method": POST, "headers": 
{"key":"val"}, "body": "foo" }]}``` That returns a `{"responses":[{"response": 
...`
   
   Which would call the handlers for the given path, with a single DB 
transaction, and return the results of each.
   
   Again, not trivial, but probably not much more work than adding a single 
dedicated bulk endpoint like post-bulk-dns-ttl.
   
   And it's something we especially need for Ops automation. Ops scripts often 
need to update a number of fields all at once, and having to do that separately 
has race conditions, and results in temporarily invalid data in Traffic Ops 
(potentially permanently, if early requests succeed and later ones fail).
   
   We need a bulk request feature, to allow Ops automation to safely, 
atomically update multiple things.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to