LindaSummer commented on code in PR #2826:
URL: https://github.com/apache/kvrocks/pull/2826#discussion_r2001232952


##########
src/types/redis_tdigest.cc:
##########
@@ -266,20 +264,19 @@ rocksdb::Status TDigest::Reset(engine::Context& ctx, 
const Slice& digest_name) {
   std::string metadata_bytes;
   metadata.Encode(&metadata_bytes);
 
-  status = batch->Put(metadata_cf_handle_, ns_key, metadata_bytes);
-  if (!status.ok()) {
+  if (auto status = batch->Put(metadata_cf_handle_, ns_key, metadata_bytes); 
!status.ok()) {
     return status;
   }
 
-  if (!status.ok()) return status;
   auto start_key = internalSegmentGuardPrefixKey(metadata, ns_key, 
SegmentType::kBuffer);
   auto guard_key = internalSegmentGuardPrefixKey(metadata, ns_key, 
SegmentType::kGuardFlag);
-  
-  status = batch->DeleteRange(cf_handle_, start_key, guard_key);
-  if (!status.ok()) return status;
-  status = storage_->Write(ctx, storage_->DefaultWriteOptions(), 
batch->GetWriteBatch());
-  if (!status.ok()) return status;
 
+  if (auto status = batch->DeleteRange(cf_handle_, start_key, guard_key); 
!status.ok()) {
+    return status;
+  }
+  if (auto status = storage_->Write(ctx, storage_->DefaultWriteOptions(), 
batch->GetWriteBatch()); !status.ok()) {

Review Comment:
   We can directly return this status.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to