Giter Site home page Giter Site logo

Comments (15)

itamarhaber avatar itamarhaber commented on June 14, 2024

Hello @rolfvandam

Which version of RedisBloom are you using?

from redisbloom-py.

rolfvandam avatar rolfvandam commented on June 14, 2024

I'm using 0.2.0

from redisbloom-py.

rolfvandam avatar rolfvandam commented on June 14, 2024

This is what's in d:

>>> d
'\x01\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x04\x00\x00\x00\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00{\x14\xaeG\xe1z\x84?\x88\x16\x8a\xc5\x8c+#@\x07\x00\x00\x00j5\x00\x00\x11'

from redisbloom-py.

itamarhaber avatar itamarhaber commented on June 14, 2024

Thank you - which version of the server-side RedisBloom module are you using?

from redisbloom-py.

rolfvandam avatar rolfvandam commented on June 14, 2024

I'm not sure which version number but it was pulled a day or so ago from https://github.com/RedisBloom/RedisBloom

My redis server version is 5.0.3

from redisbloom-py.

itamarhaber avatar itamarhaber commented on June 14, 2024

Please run MODULE LIST from redis-cli.

My reasoning for this is that this is related to RedisBloom/RedisBloom#98, which fixes a namespace collision in RedisBloom (with Redis' own hash function).

from redisbloom-py.

rolfvandam avatar rolfvandam commented on June 14, 2024
127.0.0.1:6379> MODULE LIST
1) 1) "name"
   2) "bf"
   3) "ver"
   4) (integer) 20002
127.0.0.1:6379>

from redisbloom-py.

rolfvandam avatar rolfvandam commented on June 14, 2024

I've tried it with the latest RedisBloom and the issue is still present.

Also, I've tried it in redis-cli and it gives the same error so it's probably not a problem in this client:

127.0.0.1:6379> BF.SCANDUMP bloom 0
1) (integer) 1
2) "\x01\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x04\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00{\x14\xaeG\xe1z\x84?\x88\x16\x8a\xc5\x8c+#@\a\x00\x00\x00j\x00\x00\x00\n"
127.0.0.1:6379> BF.LOADCHUNK bloom 0 "\x01\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x04\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00{\x14\xaeG\xe1z\x84?\x88\x16\x8a\xc5\x8c+#@\a\x00\x00\x00j\x00\x00\x00\n"
(error) ERR invalid offset - no link found

from redisbloom-py.

rolfvandam avatar rolfvandam commented on June 14, 2024

@ashtul you've assigned this as a bug on this repo but shouldn't this issue be opened on RedisBloom instead? Is it ok if I open an issue there?

from redisbloom-py.

ashtul avatar ashtul commented on June 14, 2024

@rolfvandam , I have looked at the module and I don't think the error is there.
The test you've run fails since the information isn't parsed correctly. The function expects binary and the "/x..." doesn't work well with it.
I hope to find a good solution for parsing soon.

from redisbloom-py.

rolfvandam avatar rolfvandam commented on June 14, 2024

That's what I thought first too but then I tried doing it directly in Python:

>>> from redisbloom.client import Client
>>> r = Client()
>>> i, d = r.bfScandump('bloom', 0)
>>> type(d)
<class 'bytes'>
>>> d
b'\x01\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x04\x00\x00\x00\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00{\x14\xaeG\xe1z\x84?\x88\x16\x8a\xc5\x8c+#@\x07\x00\x00\x00j5\x00\x00\x11'
>>> r.execute_command('BF.LOADCHUNK', 0, d)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.7/dist-packages/redis/client.py", line 775, in execute_command
    return self.parse_response(connection, command_name, **options)
  File "/usr/local/lib/python3.7/dist-packages/redis/client.py", line 789, in parse_response
    response = connection.read_response()
  File "/usr/local/lib/python3.7/dist-packages/redis/connection.py", line 642, in read_response
    raise response
redis.exceptions.ResponseError: invalid offset - no link found

If I understand correctly it should send d as binary data and it still gives the same error.

from redisbloom-py.

rolfvandam avatar rolfvandam commented on June 14, 2024

It even gives the same error when I do the same on the socket level:

>>> import socket
>>> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>>> s.connect(("127.0.0.1", 6379))
>>> s.send(b"BF.SCANDUMP bloom 0\r\n")
>>> s.recv(100000)
b'*2\r\n:1\r\n$65\r\n\x02\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x04\x00\x00\x00\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00{\x14\xaeG\xe1z\x84?\x88\x16\x8a\xc5\x8c+#@\x07\x00\x00\x00j5\x00\x00\x11\r\n'
>>> s.send(b"BF.LOADCHUNK bloom 0 $65\r\n\x02\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x04\x00\x00\x00\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00{\x14\xaeG\xe1z\x84?\x88\x16\x8a\xc5\x8c+#@\x07\x00\x00\x00j5\x00\x00\x11\r\n")
>>> s.recv(100000)
b'-ERR invalid offset - no link found\r\n'

from redisbloom-py.

mnunberg avatar mnunberg commented on June 14, 2024

Your problem is passing 0 as the second argument to LOADCHUNK. You need to pass the tuple returned from the corresponding call to SCANDUMP.

from redisbloom-py.

mnunberg avatar mnunberg commented on June 14, 2024
127.0.0.1:6379>  BF.LOADCHUNK bloom 0 "\x01\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x04\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00{\x14\xaeG\xe1z\x84?\x88\x16\x8a\xc5\x8c+#@\a\x00\x00\x00j\x00\x00\x00\n"
(error) ERR not found
127.0.0.1:6379>  BF.LOADCHUNK bloom 1 "\x01\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x04\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00{\x14\xaeG\xe1z\x84?\x88\x16\x8a\xc5\x8c+#@\a\x00\x00\x00j\x00\x00\x00\n"
OK

from redisbloom-py.

rolfvandam avatar rolfvandam commented on June 14, 2024

Ah! That explains everything!

It works using redisbloom-py too:

>>> r.execute_command('DEL', 'bloom')
1
>>> r.bfAdd('bloom', 'bla')
1
>>> i, d = r.bfScandump('bloom', 0)
>>> r.delete('bloom')
1
>>> r.bfLoadChunk('bloom', 1, d)
b'OK'

from redisbloom-py.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.