使用 PFMERGE 损坏的 HLL 对象

Corrupted HLL object with PFMERGE

我有一个小系统,使用redis中的HLL系统。这个系统做:

  1. GET myHll 来自 db0
  2. SET myHll "<hash>" 到 db1
  3. PFMERGE myOtherHll myHll在db1中合并2个hll

然而,有时我会受到以下问候:(error) INVALIDOBJ Corrupted HLL object detected

示例:

127.0.0.1:6379[7]> pfcount myHll
(integer) 2
127.0.0.1:6379[7]> get myHll
"HYLL\x01\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00@G\x84b\xf8\x84\\xbc"

127.0.0.1:6379[7]> pfcount myOtherHll
(integer) 1
127.0.0.1:6379[7]> get myOtherHll
"HYLL\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00cA\xef\xbf\xbd\\xef\xbf\xbd"

127.0.0.1:6379[7]> pfmerge anotherHll myOtherHll myHll
(error) INVALIDOBJ Corrupted HLL object detected

所以我的问题是:

  1. 理论上我可以GET/SET hll 哈希吗?
  2. 如果我是,知道为什么它在这里不起作用吗?
  3. 如果我不是,我有其他方法吗?

注意:我使用的是redis 6.2.4

谢谢

为了您提到的目的在 HyperLogLog 哈希上使用 GET/SET 没有记录,因此请避免以这种方式使用它。

相反,我建议使用 DUMP 从您的 db0 获取密钥的序列化值,并使用 RESTORE 在您的db1:这些命令使用与 Redis 本身相同的 RDB 格式,同时将数据集的时间点快照持久化到磁盘。