@@ -14,7 +14,6 @@ import (
14
14
"github.com/cockroachdb/cockroach/pkg/kv/kvserver/kvserverbase"
15
15
"github.com/cockroachdb/cockroach/pkg/settings"
16
16
"github.com/cockroachdb/cockroach/pkg/settings/cluster"
17
- "github.com/cockroachdb/cockroach/pkg/util/buildutil"
18
17
"github.com/cockroachdb/cockroach/pkg/util/retry"
19
18
"github.com/cockroachdb/cockroach/pkg/util/stop"
20
19
"github.com/cockroachdb/cockroach/pkg/util/syncutil"
@@ -169,11 +168,13 @@ func (bs *BufferedSender) sendBuffered(
169
168
// The unbufferedRegistration is the only component that sends non-error
170
169
// events to our stream. In response to the error we return when moving to
171
170
// stateOverflowing, it should immediately send us an error and mark itself
172
- // as disconnected. As a result, no non-error events are expected.
173
- if ev .Error == nil {
174
- panic ("only error events expected after stream has exceeded capacity" )
171
+ // as disconnected.
172
+ //
173
+ // The only unfortunate exception is if we get disconnected while flushing
174
+ // the catch-up scan buffer.
175
+ if ev .Error != nil {
176
+ status .state = streamOverflowed
175
177
}
176
- status .state = streamOverflowed
177
178
case streamOverflowed :
178
179
// If we are overflowed, we don't expect any further events because the
179
180
// registration should have disconnected in response to the error.
@@ -253,8 +254,6 @@ func (bs *BufferedSender) popFront() (e sharedMuxEvent, success bool) {
253
254
if streamFound {
254
255
state .queueItems -= 1
255
256
bs .queueMu .byStream [event .ev .StreamID ] = state
256
- } else {
257
- assumedUnreachable ("event found in queue with no state in byStream" )
258
257
}
259
258
}
260
259
return event , ok
@@ -305,9 +304,3 @@ func (bs *BufferedSender) waitForEmptyBuffer(ctx context.Context) error {
305
304
}
306
305
return errors .New ("buffered sender failed to send in time" )
307
306
}
308
-
309
- func assumedUnreachable (msg string ) {
310
- if buildutil .CrdbTestBuild {
311
- panic (fmt .Sprintf ("assumed unreachable code reached: %v" , msg ))
312
- }
313
- }
0 commit comments