Baqend/Orestes-Bloomfilter

Redis not returning status on creation of bit set?

ChrisCurtin opened this issue · 3 comments

Hi,

It took me a little while to understand this block:

public boolean add(byte[] value) {
    begin();
    super.add(value);
    if (commit() == null)
        return add(value);
    else
        return true;
}

but I figured out that the first 'add' wasn't returning anything from Redis (in fact it looks like it was ignoring the request?) for the first call after the filter is created in Redis.

I tried to reproduce this standalone and couldn't, so I'm curious if you had any other insight into what Redis or Jedis is doing with the first 'bitset' pipeline?

Thanks,

Chris

Hi,

you're right, the first add-call in the method does not return anything from Redis nor have an immediate effect. Begin() starts a pipelined Multi-Block, which is a kind of batch transaction in Redis. It is not executed until commit() is called, which sends the Exec-Command for the Multi-Block and flushes the pipeline.

Or did you mean that adding the first element to a new Bloomfilter is ignored?

Thanks,
Felix

Hi Felix,

Actually it looks like the super.add() call does try to contact Redis, but it always returns null in the commit() and the bits aren't set. When the recursive add() call is made the call to Redis writes the bit and returns the previous value.

I spent an hour+ in the debugger trying to figure out why the first one always fails but never could.

Thanks,

Chris

Hi, that code is now replaced with a new recursive version.