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

Make kvrocks dump rdb file which redis can load. #1001

Closed
2 tasks done
ColinChamber opened this issue Oct 16, 2022 · 3 comments
Closed
2 tasks done

Make kvrocks dump rdb file which redis can load. #1001

ColinChamber opened this issue Oct 16, 2022 · 3 comments
Labels
enhancement type enhancement

Comments

@ColinChamber
Copy link
Contributor

Search before asking

  • I had searched in the issues and found no similar issues.

Motivation

Making Kvrocks write RDB is more straightforward than making it parse RDB.
Because Redis is backward compatible, which can load the original RDB file.
We can easily utilize the primitive RDB object types, which follow the simple
encoding pattern:
or ( consists of <key(value)>)
RDB_TYPE_STRING, RDB_TYPE_LIST, RDB_TYPE_SET, RDB_TYPE_ZSET, RDB_TYPE_HASH,
these five types follow this pattern. We ignore the RDB_TYPE_HASH_ZIPMAP,
RDB_TYPE_LIST_ZIPLIST, RDB_TYPE_SET_INTSET, and other complicated types
only implement the five simple type.

There is a mapping relationship between Redis object type and RDB object type.
But you don't have to worry about Redis using ineffective object types after loading RDB.
Redis will convert it to an efficient type automatically.
E.g
kvrocks> hmset foo foo1 bar1 foo2 bar2
kvrocks> save (use RDB_TYPE_HASH rather than RDB_TYPE_HASH_ZIPLIST)
-------- Redis loads the RDB that kvrocks dumped --------
redis> OBJECT ENCODING foo
"ziplist"

There are more detailed references to RDB.
https://github.com/sripathikrishnan/redis-rdb-tools/wiki/Redis-RDB-Dump-File-Format
https://github.com/sripathikrishnan/redis-rdb-tools/blob/master/docs/RDB_Version_History.textile
https://rdb.fnordig.de/file_format.html

Solution

#958

Are you willing to submit a PR?

  • I'm willing to submit a PR!
@ColinChamber ColinChamber added the enhancement type enhancement label Oct 16, 2022
@git-hulk
Copy link
Member

cool, thanks for @ColinChamber great work.

@ShooterIT
Copy link
Member

Hi @ColinChamber @git-hulk i don't think supporting dumping RDB in Kvrocks is a good idea.
Kvrocks builds its data based on SSD, and its data volume usually is huge, so the RDB usually is big, i don't think it is a general requirement of loading so big RDB file into redis. What's more, Kvrocks is Kvrocks rather than a fork of redis, we support redis protocol and some commands, don't need to support everything, so i think it is not suitable to support dumping RDB in Kvrocks core code, and now we already has kvrocks2redis which could generate AOF, i think it looks enough, even we want to support dumping rdb, we should implement this feature in kvrocks2redis.

@git-hulk
Copy link
Member

git-hulk commented Nov 7, 2022

Hi @ColinChamber @git-hulk i don't think supporting dumping RDB in Kvrocks is a good idea. Kvrocks builds its data based on SSD, and its data volume usually is huge, so the RDB usually is big, i don't think it is a general requirement of loading so big RDB file into redis. What's more, Kvrocks is Kvrocks rather than a fork of redis, we support redis protocol and some commands, don't need to support everything, so i think it is not suitable to support dumping RDB in Kvrocks core code, and now we already has kvrocks2redis which could generate AOF, i think it looks enough, even we want to support dumping rdb, we should implement this feature in kvrocks2redis.

Yes, maybe we need a basic guide or consensus to determine what features can be merged or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement type enhancement
Projects
None yet
Development

No branches or pull requests

3 participants