Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Repair cockroachdb#2593 "panic: use of finalized trace"
The cause of the issue occurred as such: + Incoming client request to a node creates a trace context. + The context is attached to a raft command which is proposed. The command is added to the 'pending' map in multiraft before being proposed. The client request will be answered once the proposed command is committed and applied. + Concurrently, another raft command changes the configuration of the range's raft group, removing this node's replica. In existing code, all pending commands on that node which target that replica are synchronously dismissed with an error; the trace is therefore finalized. + However, while the replica has been removed from the group, the group itself has not yet been removed from the node; the proposed command can actually commit, it just commits after the configuration change. + When the committed change is applied, it attempts to use the trace, but the trace has already been finalized. The fix is to no longer abort pending commands on a replica just because that replica has been removed from the group; it is not yet safe to immediately abort pending requests, because they may actually complete. Instead, we do not abort commands until the group itself is removed (by the range GC queue).
- Loading branch information