feat: add RDB_OPCODE_SLOT_INFO support for Redis 7.4 (#881)

This commit is contained in:
suxb201 2024-11-22 10:57:52 +08:00 committed by GitHub
parent 6086d1de7f
commit 7b2fd6fcf1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 3 deletions

View File

@ -18,7 +18,7 @@ RedisShake is a powerful tool for Redis data transformation and migration, offer
1. **Zero Downtime Migration**: Enables seamless data migration without data loss or service interruption, ensuring continuous operation during the transfer process.
2. **Redis Compatibility**: Supports Redis 2.8 to 7.2, across standalone, master-slave, sentinel, and cluster deployments.
2. **Redis Compatibility**: Supports Redis 2.8 to 7.4, across standalone, master-slave, sentinel, and cluster deployments.
3. **Cloud Service Integration**: Seamlessly works with Redis-like databases from major cloud providers:
- Alibaba Cloud: [ApsaraDB for Redis](https://www.alibabacloud.com/product/apsaradb-for-redis), [Tair](https://www.alibabacloud.com/product/tair)

View File

@ -18,8 +18,9 @@ import (
)
const (
kFlagFunction2 = 245 // function library data
kFlagFunction = 246 // old function library data for 7.0 rc1 and rc2
kFlagSlotInfo = 244 // (Redis 7.4) RDB_OPCODE_SLOT_INFO: slot info
kFlagFunction2 = 245 // RDB_OPCODE_FUNCTION2: function library data
kFlagFunction = 246 // RDB_OPCODE_FUNCTION_PRE_GA: old function library data for 7.0 rc1 and rc2
kFlagModuleAux = 247 // RDB_OPCODE_MODULE_AUX: Module auxiliary data.
kFlagIdle = 248 // RDB_OPCODE_IDLE: LRU idle time.
kFlagFreq = 249 // RDB_OPCODE_FREQ: LFU frequency.
@ -124,6 +125,12 @@ func (ld *Loader) parseRDBEntry(ctx context.Context, rd *bufio.Reader) {
typeByte := structure.ReadByte(rd)
log.Debugf("RDB type byte is: [%d]", typeByte)
switch typeByte {
case kFlagSlotInfo:
_ = structure.ReadLength(rd) // slot_id
_ = structure.ReadLength(rd) // slot_size
_ = structure.ReadLength(rd) // expires_slot_size
case kFlagFunction, kFlagFunction2:
log.Panicf("function library data not supported, need PR to support")
case kFlagModuleAux:
moduleId := structure.ReadLength(rd) // module id
moduleName := types.ModuleTypeNameByID(moduleId)