Skip to content

Commit 651dae3

Browse files
fix: When getting the key in the slot where migration failed, codis-proxy exited abnormally (#3238)
Co-authored-by: chejinge <[email protected]>
1 parent bc8de39 commit 651dae3

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

codis/pkg/proxy/backend.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,9 @@ func (bc *BackendConn) run() {
269269
}
270270

271271
var (
272-
errRespMasterDown = []byte("MASTERDOWN")
273-
errRespLoading = []byte("LOADING")
272+
errRespMasterDown = []byte("MASTERDOWN")
273+
errRespLoading = []byte("LOADING")
274+
errRespSlotMigrateClosed = []byte("ERR please open slotmigrate and reload slot")
274275
)
275276

276277
func (bc *BackendConn) loopReader(tasks <-chan *Request, c *redis.Conn, round int) (err error) {
@@ -300,6 +301,11 @@ func (bc *BackendConn) loopReader(tasks <-chan *Request, c *redis.Conn, round in
300301
log.Warnf("backend conn [%p] to %s, db-%d state = DataStale, caused by 'LOADING'",
301302
bc, bc.addr, bc.database)
302303
}
304+
case bytes.HasPrefix(resp.Value, errRespSlotMigrateClosed):
305+
if bc.state.CompareAndSwap(stateConnected, stateDataStale) {
306+
log.Warnf("backend conn [%p] to %s, db-%d state = DataStale, caused by 'slotmigrate disabled'",
307+
bc, bc.addr, bc.database)
308+
}
303309
}
304310
}
305311
bc.setResponse(r, resp, nil)

0 commit comments

Comments
 (0)