jjz921024 commented on code in PR #2402:
URL: https://github.com/apache/kvrocks/pull/2402#discussion_r1684136223


##########
src/types/redis_hash.cc:
##########
@@ -45,7 +46,13 @@ rocksdb::Status Hash::Size(const Slice &user_key, uint64_t 
*size) {
   HashMetadata metadata(false);
   rocksdb::Status s = GetMetadata(Database::GetOptions{}, ns_key, &metadata);
   if (!s.ok()) return s;
-  *size = metadata.size;
+  if (!metadata.IsEncodedFieldExpire()) {
+    *size = metadata.size;
+  } else {
+    std::vector<FieldValue> field_values;
+    GetAll(user_key, &field_values, HashFetchType::kOnlyKey);

Review Comment:
   @torwig Yes. maybe we should add a method that check if there is any 
unexpired field in the hash, and avoid query all the fields



-- 
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