mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 10:25:47 +02:00
fix(rdb_load): load listpack encoded zset (#1646)
This commit is contained in:
parent
78bd49405a
commit
df771f9138
4 changed files with 31 additions and 1 deletions
|
@ -1004,6 +1004,17 @@ void RdbLoaderBase::OpaqueObjLoader::HandleBlob(string_view blob) {
|
|||
}
|
||||
pv_->InitRobj(OBJ_ZSET, encoding, inner);
|
||||
return;
|
||||
} else if (rdb_type_ == RDB_TYPE_ZSET_LISTPACK) {
|
||||
if (!lpValidateIntegrity((uint8_t*)blob.data(), blob.size(), 0, nullptr, nullptr)) {
|
||||
LOG(ERROR) << "ListPack integrity check failed.";
|
||||
ec_ = RdbError(errc::rdb_file_corrupted);
|
||||
return;
|
||||
}
|
||||
unsigned char* src_lp = (unsigned char*)blob.data();
|
||||
unsigned long long bytes = lpBytes(src_lp);
|
||||
unsigned char* lp = (uint8_t*)zmalloc(bytes);
|
||||
std::memcpy(lp, src_lp, bytes);
|
||||
pv_->InitRobj(OBJ_ZSET, OBJ_ENCODING_LISTPACK, lp);
|
||||
} else {
|
||||
LOG(FATAL) << "Unsupported rdb type " << rdb_type_;
|
||||
}
|
||||
|
@ -1301,6 +1312,7 @@ error_code RdbLoaderBase::ReadObj(int rdbtype, OpaqueObj* dest) {
|
|||
break;
|
||||
case RDB_TYPE_HASH_ZIPLIST:
|
||||
case RDB_TYPE_HASH_LISTPACK:
|
||||
case RDB_TYPE_ZSET_LISTPACK:
|
||||
iores = ReadGeneric(rdbtype);
|
||||
break;
|
||||
case RDB_TYPE_HASH:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue