Skip to content

Ask the HotKV docs

Answers come only from these docs and can be wrong; check the linked pages before you rely on them.

BF.LOADCHUNK

Last updated
BF.LOADCHUNK key iterator data
Group
Bloom filter
Complexity
O(n), n being the bytes of the chunk
Arity
-1 (at least 1 words, counting the command name)
Flags
none
Keys
first 1, last 1, step 1
HotKV Cloud
All plans
On-Premise
no license needed

BF.LOADCHUNK rebuilds a Bloom filter from a dump made with BF.SCANDUMP. Send the chunks back in the order you received them, each with the iterator that BF.SCANDUMP returned alongside it.

The first chunk (iterator 1) creates the filter at key, replacing any Bloom filter already there. The later chunks fill in its bits. The restored filter answers exactly as the original did.

Case RESP2 RESP3
Chunk loaded Simple string OK Simple string OK

Error replies:

  • ERR received bad data for a chunk that does not belong to the filter being loaded.
  • ERR not found for a data chunk sent before the first chunk.
  • ERR Second argument must be numeric for a non-integer iterator.
  • WRONGTYPE if the key holds a value that is not a Bloom filter.

A typical restore, in client code:

iter = 0
chunks = []
loop:
iter, data = BF.SCANDUMP src iter
if iter == 0: break
chunks.append((iter, data))
for (iter, data) in chunks:
BF.LOADCHUNK dst iter data

Errors from redis-cli:

127.0.0.1:6379> BF.LOADCHUNK restored 1 garbage
(error) ERR received bad data
127.0.0.1:6379> BF.LOADCHUNK restored 145 garbage
(error) ERR not found

Same command flow as BF.LOADCHUNK in RedisBloom. Chunks must come from a HotKV BF.SCANDUMP.

BF.SCANDUMP, BF.RESERVE