The gossiped view update backlog is updated on the wrong shard
wmitros opened this issue · 1 comments
We have 3 sources of the view update backlog:
- The view update semaphore on each shard:
Lines 1847 to 1849 in 2d91422
- The cached view update backlogs for all shards that need to be accessed atomically, used for gossiping and for propagating by responses:
Lines 2612 to 2627 in 2d91422
- The max view update backlogs stored for all replicas, which store the maximum backlog across all shards of a node, and are actually used when deciding how much should requests be delayed by the mv flow control
scylladb/service/storage_proxy.hh
Line 282 in 2d91422
The values from backlog 1) are finally stored as 3) in the following way:
- In gossip, every
1s
each shard checks the current backlog 1), saves it as 2) and if the maximum of backlogs 2) across all shards is different than the previously gossiped value, the new value is gossiped and eventually stored in all replicas as backlog 3) - In mutation responses, when coordinator sends a mutation to another node, and the mutation applying is finished, only the coordinator shard on replica updates its backlog 2) and sends the maximum of backlogs 2) along with the response. The coordinator (node handling the request) then updates the corresponding backlog of type 3)
- When the coordinator sends mutation to the same node the coordinator's on (local mutation), some shard performs the update, and then, the coordinator shard updates the value of its backlog 1), takes the maximum of backlogs 2) and updates the backlog 3) for the local node with the resulting value
Both 2) and 3) pathways are incorrect, the updated backlog should come from the shard that performed the mutation, not from the coordinator's shard:
scylladb/service/storage_proxy.cc
Lines 4071 to 4078 in 2d91422
scylladb/service/storage_proxy.cc
Lines 488 to 546 in cc8b4e0
I updated the description - this issue concerns also remote writes in the same capacity