Skip to content

Commit

Permalink
update code style
Browse files Browse the repository at this point in the history
  • Loading branch information
AntiTopQuark committed Aug 29, 2024
1 parent 87d5603 commit 7a10cd6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
12 changes: 6 additions & 6 deletions src/search/indexer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -226,18 +226,18 @@ Status IndexUpdater::UpdateTagIndex(engine::Context &ctx, std::string_view key,
for (const auto &tag : tags_to_delete) {
auto index_key = search_key.ConstructTagFieldData(tag, key);

auto rocker_status = batch->Delete(cf_handle, index_key);
if (!rocker_status.ok()) {
return {Status::NotOK, rocker_status.ToString()};
auto s = batch->Delete(cf_handle, index_key);
if (!s.ok()) {
return {Status::NotOK, s.ToString()};
}
}

for (const auto &tag : tags_to_add) {
auto index_key = search_key.ConstructTagFieldData(tag, key);

auto rocker_status = batch->Put(cf_handle, index_key, Slice());
if (!rocker_status.ok()) {
return {Status::NotOK, rocker_status.ToString()};
auto s = batch->Put(cf_handle, index_key, Slice());
if (!s.ok()) {
return {Status::NotOK, s.ToString()};
}
}

Expand Down
1 change: 0 additions & 1 deletion src/types/redis_stream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1677,7 +1677,6 @@ rocksdb::Status Stream::trim(engine::Context &ctx, const std::string &ns_key, co
}

return rocksdb::Status::OK();
;
}

rocksdb::Status Stream::SetId(engine::Context &ctx, const Slice &stream_name, const StreamEntryID &last_generated_id,
Expand Down
14 changes: 7 additions & 7 deletions src/types/redis_zset.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ rocksdb::Status ZSet::Add(engine::Context &ctx, const Slice &user_key, ZAddFlags
auto batch = storage_->GetWriteBatchBase();
WriteBatchLogData log_data(kRedisZSet);
s = batch->PutLogData(log_data.Encode());
if (!s.ok() && !s.IsNotFound()) return s;
if (!s.ok()) return s;
std::unordered_set<std::string_view> added_member_keys;
for (auto it = mscores->rbegin(); it != mscores->rend(); ++it) {
if (!added_member_keys.insert(it->member).second) {
Expand Down Expand Up @@ -85,16 +85,16 @@ rocksdb::Status ZSet::Add(engine::Context &ctx, const Slice &user_key, ZAddFlags
std::string old_score_key =
InternalKey(ns_key, old_score_bytes, metadata.version, storage_->IsSlotIdEncoded()).Encode();
s = batch->Delete(score_cf_handle_, old_score_key);
if (!s.ok() && !s.IsNotFound()) return s;
if (!s.ok()) return s;
std::string new_score_bytes;
PutDouble(&new_score_bytes, it->score);
s = batch->Put(member_key, new_score_bytes);
if (!s.ok() && !s.IsNotFound()) return s;
if (!s.ok()) return s;
new_score_bytes.append(it->member);
std::string new_score_key =
InternalKey(ns_key, new_score_bytes, metadata.version, storage_->IsSlotIdEncoded()).Encode();
s = batch->Put(score_cf_handle_, new_score_key, Slice());
if (!s.ok() && !s.IsNotFound()) return s;
if (!s.ok()) return s;
changed++;
}
continue;
Expand All @@ -106,11 +106,11 @@ rocksdb::Status ZSet::Add(engine::Context &ctx, const Slice &user_key, ZAddFlags
std::string score_bytes;
PutDouble(&score_bytes, it->score);
s = batch->Put(member_key, score_bytes);
if (!s.ok() && !s.IsNotFound()) return s;
if (!s.ok()) return s;
score_bytes.append(it->member);
std::string score_key = InternalKey(ns_key, score_bytes, metadata.version, storage_->IsSlotIdEncoded()).Encode();
s = batch->Put(score_cf_handle_, score_key, Slice());
if (!s.ok() && !s.IsNotFound()) return s;
if (!s.ok()) return s;
added++;
}
if (added > 0) {
Expand All @@ -119,7 +119,7 @@ rocksdb::Status ZSet::Add(engine::Context &ctx, const Slice &user_key, ZAddFlags
std::string bytes;
metadata.Encode(&bytes);
s = batch->Put(metadata_cf_handle_, ns_key, bytes);
if (!s.ok() && !s.IsNotFound()) return s;
if (!s.ok()) return s;
}
if (flags.HasCH()) {
*added_cnt += changed;
Expand Down

0 comments on commit 7a10cd6

Please sign in to comment.