Furthermore, this error is persistent: each time you kill and restart the broker, the same error appears again (presumably it is re-running the commit log?)
I don't know the correct approach to this problem. Is raft Apply required to succeed always? In which case, maybe the only solution is additional pre-flight checks before sending the change to raft. If so, what are the rules for validating the topic?
But I think there is a deeper issue with error handling. For example: topic create has a pre-flight check to reject a topic which already exists. But this leads to a race condition: what happens if two clients try to create the topic at the same time, both pre-flight checks pass, and then both commit?
If an error occurs in
topic create
, the client thinks it was successful. A simple way to trigger this is to create a topic with empty name:But at the server side you get:
Furthermore, this error is persistent: each time you kill and restart the broker, the same error appears again (presumably it is re-running the commit log?)
I don't know the correct approach to this problem. Is raft
Apply
required to succeed always? In which case, maybe the only solution is additional pre-flight checks before sending the change to raft. If so, what are the rules for validating the topic?But I think there is a deeper issue with error handling. For example:
topic create
has a pre-flight check to reject a topic which already exists. But this leads to a race condition: what happens if two clients try to create the topic at the same time, both pre-flight checks pass, and then both commit?