-
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: hset/hdel wrote by braft and binlog #213
feat: hset/hdel wrote by braft and binlog #213
Conversation
要不要写个 go 单测啥的?还是说后面加一个统一的简单一致性测试? |
Do you want to write a go single test or something? Or should we add a unified simple consistency test later? |
有道理,我这两天先试试加个最简单的,这样也方便其他人跑 |
It makes sense. I will try to add the simplest one in the next two days, so that it will be easier for others to run. |
db454ba
to
dfe1d90
Compare
dfe1d90
to
a3180ee
Compare
9868af0
to
08910ee
Compare
go测试不好加,goredis库里没有raft相关命令。。。要是从外部启动、建立集群、然后再测的话,其实我感觉不如脚本方便 |
Go testing is not easy to add. There are no raft-related commands in the goredis library. . . If you start it from the outside, build a cluster, and then test it, I actually feel it is not as convenient as a script. |
直接调用 Do 接口嘛 |
Just call the Do interface directly |
@@ -64,6 +69,8 @@ struct StorageOptions { | |||
size_t small_compaction_duration_threshold = 10000; | |||
size_t db_instance_num = 3; // default = 3 | |||
int db_id; | |||
AppendLogFunction append_log_function; | |||
uint32_t raft_timeout_s = 10; |
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.
默认10s会不会有点小,感觉默认应该可以写到uint32_t::max
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.
已改正
src/storage/src/redis_hashes.cc
Outdated
@@ -118,7 +119,7 @@ Status Redis::HDel(const Slice& key, const std::vector<std::string>& fields, int | |||
} | |||
} | |||
|
|||
rocksdb::WriteBatch batch; | |||
auto batch = Batch::CreateBatch(this); |
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.
这里缩进看着有点问题。
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.
已改正
src/storage/src/redis_hashes.cc
Outdated
} | ||
} else if (s.IsNotFound()) { | ||
*ret = 0; | ||
return Status::OK(); | ||
} else { | ||
return s; | ||
} | ||
s = db_->Write(default_write_options_, &batch); | ||
batch->Commit(); |
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.
这里的缩进。
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.
已改正
src/storage/src/redis_hashes.cc
Outdated
} | ||
} else if (s.IsNotFound()) { | ||
*ret = 0; | ||
return Status::OK(); | ||
} else { | ||
return s; | ||
} | ||
s = db_->Write(default_write_options_, &batch); | ||
batch->Commit(); |
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.
这里的commit没有取status
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.
已改正
2374c2f
into
OpenAtomFoundation:import-braft
完成 praft 添加 binlog 和on_apply解析binlog并写入的逻辑
可以在项目目录下 运行 consistency_test.sh 检验集群是否建立成功、数据是否能同步到 follower、以及向 follower 发送写请求的leader信息回复