Skip to content

Commit

Permalink
fix: fix problem found by TSAN
Browse files Browse the repository at this point in the history
  • Loading branch information
jackwener committed Jun 23, 2022
1 parent c729935 commit 46fe25a
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@ make_config.mk
.vscode
kvrocks2redis
build
.cache
2 changes: 1 addition & 1 deletion src/config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ void Config::initFieldCallback() {
double cutoff = val / 100;
return srv->storage_->SetColumnFamilyOption(trimRocksDBPrefix(k), std::to_string(cutoff));
}},
{"rocksdb.level_compaction_dynamic_level_bytes", [this](Server* srv, const std::string &k,
{"rocksdb.level_compaction_dynamic_level_bytes", [](Server* srv, const std::string &k,
const std::string& v)->Status {
if (!srv) return Status::OK();
std::string level_compaction_dynamic_level_bytes = v == "yes" ? "true" : "false";
Expand Down
2 changes: 1 addition & 1 deletion src/redis_zset.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ rocksdb::Status ZSet::Add(const Slice &user_key, uint8_t flags, std::vector<Memb
// For example, we add members with `ZADD mykey 1 a 2 a` and `ZRANGE mykey 0 1`
// return only one member(`a`) was expected but got the member `a` twice now.
//
// The root cause of this issue was the score key was composed by member and score,
// The root cause of this issue was the score key was composed by member and score,
// so the last one can't overwrite the previous when the score was different.
// A simple workaround was add those members with reversed order and skip the member if has added.
if (added_member_keys.find(member_key) != added_member_keys.end()) {
Expand Down
2 changes: 1 addition & 1 deletion src/scripting.cc
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ std::string replyToRedisReply(lua_State *lua) {
* by the non-error-trapping version of redis.pcall(), which is redis.call(),
* this function will raise the Lua error so that the execution of the
* script will be halted. */
[[noreturn]] int raiseError(lua_State *lua) {
[[noreturn]] void raiseError(lua_State *lua) {
lua_pushstring(lua, "err");
lua_gettable(lua, -2);
lua_error(lua);
Expand Down
2 changes: 1 addition & 1 deletion src/scripting.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const char *redisProtocolToLuaType_Bool(lua_State *lua, const char *reply, int t
const char *redisProtocolToLuaType_Double(lua_State *lua, const char *reply);
std::string replyToRedisReply(lua_State *lua);
void pushError(lua_State *lua, const char *err);
[[noreturn]] int raiseError(lua_State *lua);
[[noreturn]] void raiseError(lua_State *lua);
void sortArray(lua_State *lua);
void setGlobalArray(lua_State *lua, const std::string &var, const std::vector<std::string> &elems);

Expand Down
2 changes: 1 addition & 1 deletion tests/t_list_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class RedisListLMoveTest : public RedisListTest {
dst_fields_ = {"dst", "dst2", "dst3", "dst4"};
}

void TearDown() {
void TearDown() override {
list->Del(key_);
list->Del(dst_key_);
}
Expand Down

0 comments on commit 46fe25a

Please sign in to comment.