-
Notifications
You must be signed in to change notification settings - Fork 473
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 support of the command DUMP #2227
Conversation
@AntiTopQuark Running the |
I feel good about this, and we can make it work first and then improve. |
} | ||
|
||
/* CRC64 */ | ||
std::string &output = static_cast<RdbStringStream *>(stream_.get())->GetInput(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to assume it must be an RdbStringStream
here, you can add a CHECK
statement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But TBH, to support output files rather than strings, we need a better solution here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the Redis dump command, it needs to echo the result to the client, so it should be good to keep in memory. Not sure if I misunderstood @PragmaTwice point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to assume it must be an
RdbStringStream
here, you can add aCHECK
statement.
I added a member attribute named type_ to RdbStream, and I ensure its safety by checking it before performing a static_cast
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But TBH, to support output files rather than strings, we need a better solution here.
Is it absolutely necessary to dump a value into a file?
If the goal is simply to dump the contents of specific keys, this can be readily achieved by redirecting the output of redis-cli to a designated file.
For dumping an entire RDB, might this feature be unnecessary? Directly utilizing kvrocks2redis would suffice. This requirement has been previously discussed: #1001 (comment)
Quality Gate passedIssues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The beautiful code that ignites a delightful start to my day.
Thank you!
Close #1946
Command Desc:
Redis Documentation: https://redis.io/commands/dump/