Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dump and restore test #42

Merged
merged 1 commit into from
Jan 27, 2025
Merged

Conversation

nnmehta
Copy link
Contributor

@nnmehta nnmehta commented Jan 24, 2025

Created a python test that tests bloom data using dump and restore commands after deleting a key and making sure the key exists after restoring

dump = client.execute_command('DUMP dump')
assert client.execute_command('DEL dump') == 1
client.execute_command('RESTORE', 'dump', 0, dump)
assert client.execute_command('BF.EXISTS dump 1') == 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we run the DEBUG command and check the DEBUG result on the object before and after restore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, will check the Debug commands before and after

client = self.server.get_new_client()
client.execute_command('BF.INSERT dump error 0.001 capacity 2000 items 1')
dump = client.execute_command('DUMP dump')
assert client.execute_command('DEL dump') == 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's skip out on the deletion for this test

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on this: https://redis.io/docs/latest/commands/restore/
I thought we want to delete the key, then restore the deleted key.
Will update accordingly to just dump and restore the key rather than deleting

@nnmehta nnmehta force-pushed the unstable branch 3 times, most recently from 7aeb537 to e4291ff Compare January 24, 2025 23:36
dump_digest = client.execute_command('DEBUG DIGEST-VALUE original')
client.execute_command('RESTORE', 'copy', 0, dump)
restore_digest = client.execute_command('DEBUG DIGEST-VALUE copy')
assert client.execute_command('BF.EXISTS copy 1') == 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think there would be any benefit of comparing the bf.info values as well or is this covered by comparing the digest value?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we can remove this. DIGEST should cover it

Signed-off-by: Nihal Mehta <[email protected]>
@KarthikSubbarao KarthikSubbarao merged commit 20efd95 into valkey-io:unstable Jan 27, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants