akka-management
akka-management copied to clipboard
Log a warning trying to gracefully leave unreachable node
In akka/akka#23754 we saw that it is a bit surprising that the DELETE is for graceful leave rathe than downing a node. Perhaps we could check and log a warning if the node that the user is trying to gracefully leave an unrechable node?
Is there a reason for DELETE of an Unreachable node to return a 200 vs a 4xx (maybe 404 or 409) ?
An unreachable node could become reachable again, and then leave gracefully, so I'm not quite sure it should return an error code.
Makes sense but I think then there's a mismatch between the HTTP method of DELETE and what the action does. The 200 response is stating that you have successfully created a request to LEAVE not that it has been performed. Seems like the PUT is a better option. Not excusing my ignorance of the documentation but my silly brain thought DELETE = destructive and 200 meant it would be a done deal and the node would be gone.
I'd be happy to submit a PR for increased logging but let me know if there's an alternative that might provide more feedback that the operation may not succeed.
I would probably have used HTTP 202 in general for these as nothing happens right away, and I agree that maybe DELETE should have been the down rather than leave, I'm however not convinced that it is surprising is good enough a reason that we should change the API as it has been out in the wild for a while and changing the API may break scripts and tools that people have already built against it.
Logging a warning would not break any infra, so that is why I suggested that as an option.
Understood, thanks.
We could also expand the scope of DELETE to run CoordinatedShutdown
if the node is the selfAddress. Leaving will also trigger CoordinatedShutdown, but I think the most correct sequence of phases will be done if starting with CoordinatedShutdown.run
.
maybe it'd be reasonable to add a context parameter like ?graceful=false
to allow non-gracefully removing the node?