Skip to content

Commit 7a0401b

Browse files
Update slot.go
Compatible with old version migrating_slot is -1 to return null
1 parent bb49dae commit 7a0401b

1 file changed

Lines changed: 1 addition & 7 deletions

File tree

‎store/slot.go‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -227,13 +227,7 @@ func (s *MigratingSlot) UnmarshalJSON(data []byte) error {
227227

228228
func (s *MigratingSlot) MarshalJSON() ([]byte, error) {
229229
if !s.IsMigrating {
230-
// backwards compatibility. When we read from an old cluster that had `-1`
231-
// denoting !isMigrating. The MigratingSlot field will not be nil. So when
232-
// this field is marshal'd back into JSON format, we can keep it as it was
233-
// which was "-1".
234-
// The only case this turns back to null is if a migration happens on this
235-
// shard, and the function `ClearMigrateState()` is called on the shard.
236-
return json.Marshal(NotMigratingString)
230+
return json.Marshal(nil)
237231
}
238232
return json.Marshal(s.String())
239233
}

0 commit comments

Comments
 (0)