-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Could it fail fast on the propose dropping while leader changed #8975
Copy link
Copy link
Closed
Labels
Description
While leader is transferred, the proposal may be dropped. But we can not get the notify so we can do some retry work.
For example, as below
cctx, cancel := context.WithTimeout(ctx, s.Cfg.ReqTimeout())
defer cancel()
start := time.Now()
s.r.Propose(cctx, data)
proposalsPending.Inc()
defer proposalsPending.Dec()
select {
case x := <-ch:
return x.(*applyResult), nil
case <-cctx.Done():
proposalsFailed.Inc()
s.w.Trigger(id, nil) // GC wait
return nil, s.parseProposeCtxErr(cctx.Err(), start)
case <-s.done:
return nil, ErrStopped
}
We just wait context timeout to get to know we failed to propose which is blocking too long. I think we should handle the proposal dropping event to fail fast. One possible way is to wake up the cctx.Done while dropping proposal.
Reactions are currently unavailable