sripathikrishnan/redis-rdb-tools

test_rdb_with_stream failed

vitlav opened this issue · 6 comments

  • ./run_tests
    ..................................E.........................
    ======================================================================
    ERROR: test_rdb_with_stream (tests.memprofiler_tests.MemoryCallbackTestCase)

Traceback (most recent call last):
File "redis-rdb-tools-0.1.13/tests/memprofiler_tests.py", line 94, in test_rdb_with_stream
stats = get_stats('redis_50_with_streams.rdb')
File "redis-rdb-tools-0.1.13/tests/memprofiler_tests.py", line 38, in get_stats
parser.parse(os.path.join(os.path.dirname(file), 'dumps', file_name))
File "redis-rdb-tools-0.1.13/rdbtools/parser.py", line 394, in parse
self.parse_fd(open(filename, "rb"))
File "redis-rdb-tools-0.1.13/rdbtools/parser.py", line 461, in parse_fd
self.read_object(f, data_type)
File "redis-rdb-tools-0.1.13/rdbtools/parser.py", line 583, in read_object
self.read_list_from_quicklist(f)
File "redis-rdb-tools-0.1.13/rdbtools/parser.py", line 710, in read_list_from_quicklist
self._callback.rpush(self._key, self.read_ziplist_entry(buff))
File "redis-rdb-tools-0.1.13/rdbtools/memprofiler.py", line 285, in rpush
self._list_items_zipped_size += self.ziplist_entry_overhead(value)
File "redis-rdb-tools-0.1.13/rdbtools/memprofiler.py", line 491, in ziplist_entry_overhead
size = len(value)
TypeError: object of type 'long' has no len()

Is it look like a solution?

--- a/redis-rdb-tools/rdbtools/memprofiler.py
+++ b/redis-rdb-tools/rdbtools/memprofiler.py
@@ -473,7 +473,7 @@ class MemoryCallback(RdbCallback):
 
     def ziplist_entry_overhead(self, value):
         # See https://github.com/antirez/redis/blob/unstable/src/ziplist.c
-        if type(value) == int:
+        if type(value) == int or  type(value) == long:

@vitlav which version of python are you using?

@vitlav which version of python are you using?
Python 2.7.14

This problem related to i586 arch.

we run that very same test suite on a bunch of various python versions, including 2.7, and it passes.
so while it is possible that there's a bug here to fix, i can't figure out why it fails the test suite.
i suppose there's some small integer in that ziplist, so i don't understand why on i586 it would be creating a long object.

Can you test 32 bit arch? Or can I do some debug run for you?

parser.py:
    def read_ziplist_entry(self, f) :
...
        elif (entry_header >> 4) == 13 :
            value = read_signed_int(f)
        elif (entry_header >> 4) == 14 :
            value = read_signed_long(f)

@vitlav i made a fix in #145
didn't merge it to the master yet, but if this blocks you, you can use that branch.