Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jjz921024 committed Sep 2, 2024
1 parent feb20bb commit 0704688
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/storage/redis_db.cc
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,17 @@ rocksdb::Status Database::TTL(engine::Context &ctx, const Slice &user_key, int64
Metadata metadata(kRedisNone, false);
s = metadata.Decode(value);
if (!s.ok()) return s;
*ttl = metadata.TTL();
if (metadata.Type() == kRedisHash) {
HashMetadata hash_metadata(false);
s = hash_metadata.Decode(value);
if (!s.ok()) return s;
redis::Hash hash_db(storage_, namespace_);
if (!hash_db.ExistValidField(ctx, ns_key, hash_metadata)) {
*ttl = -2;
}
} else {
*ttl = metadata.TTL();
}

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

0 comments on commit 0704688

Please sign in to comment.