Skip to content

Commit ccb8aa7

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

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
@@ -270,8 +270,9 @@ func (bc *BackendConn) run() {
270270
}
271271

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

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

0 commit comments

Comments
 (0)