-
Notifications
You must be signed in to change notification settings - Fork 63
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
feat: floyd supports one key for one data structure #240
Conversation
1721c06
to
4ebdfd8
Compare
目前遇到的一个问题是我们使用的是 |
One problem currently encountered is that we are using |
4ebdfd8
to
79a34f8
Compare
79a34f8
to
4fc9b57
Compare
如果要增加 cuckoo bloom filter ,建议增加性能对比的测试用例好判断是否有提升以及提升的幅度。 |
If you want to add cuckoo bloom filter, it is recommended to add test cases for performance comparison to judge whether there is improvement and the extent of improvement. |
The second submission added multi-key judgment to the four data structures except string, and tried to repair the test cases. |
嗯嗯,这个算是第二期的任务,第一期先把CF弄好 |
Hmm, this is considered the task of the second period. In the first period, we should finish the CF first. |
ce8a587
to
21fddc0
Compare
第三次提交,新设计了 |
The third submission, newly designed |
68dfa7a
to
2d2a013
Compare
第四次提交合并了一下代码的冲突,但是发现 |
The fourth submission merged some code conflicts. |
The fifth submission requires changing |
2d2a013
to
acb52b3
Compare
cc6261e
to
5295f09
Compare
} | ||
client->SetRes(CmdRes::kErrOther, cnt); | ||
} | ||
auto res = PSTORE.GetBackend(client->GetCurrentDB())->GetStorage()->Persist(client->Key()); |
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.
删除 map
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.
done
feat: add type
* add constexpr string
d471caa
to
3d7cc93
Compare
from #144 |
dce08d0
to
534ad95
Compare
534ad95
to
5c2e2df
Compare
f8892f2
to
009cb05
Compare
009cb05
to
2c3ceb9
Compare
@@ -1210,55 +1129,19 @@ int64_t Storage::DelByType(const std::vector<std::string>& keys, const DataType& | |||
|
|||
int64_t Storage::Exists(const std::vector<std::string>& keys) { | |||
int64_t count = 0; | |||
int32_t ret; | |||
uint64_t llen; | |||
std::string value; | |||
Status s; | |||
bool is_corruption = false; |
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.
is_corruption没有用到的变量
@@ -1515,225 +1398,48 @@ Status Storage::Scanx(const DataType& data_type, const std::string& start_key, c | |||
int32_t Storage::Expireat(const Slice& key, uint64_t timestamp) { | |||
Status s; | |||
int32_t count = 0; | |||
bool is_corruption = false; | |||
|
|||
auto& inst = GetDBInstance(key); | |||
s = inst->StringsExpireat(key, timestamp); |
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.
这里调用stringsexpireat是说expireat接口只支持string类型?
|
||
if (is_corruption) { | ||
return -1; | ||
return 1; |
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.
是不是少了corruption的情况?
if (s.ok()) { | ||
ParsedHashesMetaValue parsed_hashes_meta_value(&meta_value); | ||
auto type = static_cast<enum Type>(static_cast<uint8_t>(meta_value[0])); |
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.
我看类似的逻辑在挺多的地方都有调用,而且得到的type变量其实也没有其他地方在用,是不是封装一个函数出来?
背景
当前
Pika
的一个Key
可以对应多种数据结构,和Redis
不一致解决方案
在
Floyd
现有的设计之上,将之前String
类型所在的Column-Family
用于存放所有的Key
的Meta
信息,其对应的value
为数据类型type
,并在内存中建立一个所有Key
的cuckoo bloom filter
. 在增加一个Key
时,先去读cuckoo bloom filter
判断被增加的Key
是否存在,如果不存在,则直接进行后续操作,如果存在,但可能是假阳性,所以需要一次读盘操作,去新增加的Column-Family
中读取,验证被增加的Key
是否真正存在,然后再进行后续的操作,单独设置block cache
,为这个新增加的Column-Family
单独设置一个,防止和别的数据共用,导致Key
的Colunm-Family
淘汰出内存kMetaCF 字段设计
修改前
String
Hash
List
set
zset
修改后
我们对每一种数据类型的
Meta
的value
前增加一个字段Type
用于区别每个Key
对应的数据结构以
Set
类型举例String 的 Meta 格式
在解析的时候,先解析头部的第一个字节,然后根据类型判断是否需要继续解析下去
issue #269