Skip to content

Commit

Permalink
Merge pull request #151 from wayslog/master
Browse files Browse the repository at this point in the history
fixed bugs that skip_module doesn't read module id first
  • Loading branch information
oranagra authored Jan 31, 2019
2 parents fca1c2e + 6cff541 commit 9dd1902
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions rdbtools/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,7 @@ def read_zipmap_next_length(self, f) :
return None

def skip_module(self, f):
self.read_length_with_encoding(f) # read module id first
opcode = self.read_length(f)
while opcode != REDIS_RDB_MODULE_OPCODE_EOF:
if opcode == REDIS_RDB_MODULE_OPCODE_SINT or opcode == REDIS_RDB_MODULE_OPCODE_UINT:
Expand Down
4 changes: 4 additions & 0 deletions tests/parser_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ def test_rdb_version_8_with_module(self):
r = load_rdb('redis_40_with_module.rdb')
self.assertEquals(r.databases[0][b'foo']['module_name'], 'ReJSON-RL')

def test_rdb_version_8_with_module_and_skip(self):
r = load_rdb('redis_40_with_module.rdb', {"keys": "bar"}) # skip foo module
self.assert_(b'foo' not in r.databases[0])

def test_rdb_version_9_with_stream(self):
r = load_rdb('redis_50_with_streams.rdb')
self.assertEquals(r.lengths[0][b"mystream"], 4)
Expand Down

0 comments on commit 9dd1902

Please sign in to comment.