redis/tests/unit/type
Moti Cohen e26ea35cd4
Adapt HRANDFIELD to HFE feature (#13348)
Considerations for the selected imp of HRANDFIELD & HFE feature:

HRANDFIELD might access any of the fields in the hash as some of them
might be expired. And so the Implementation of HRANDFIELD along with HFEs
might be one of the two options:
1. Expire hash-fields before diving into handling HRANDFIELD.
2. Refine HRANDFIELD cases to deal with expired fields.

Regarding the first option, as reference, the command RANDOMKEY also
declareson O(1) complexity, yet might be stuck on a very long (but not infinite)
loop trying to find non-expired keys. Furthermore RANDOMKEY also evicts expired 
keys along the way even though it is categorized as a read-only command. Note
that the case of HRANDFIELD is more lightweight versus RANDOMKEY since 
HFEs have much more effective and aggressive active-expiration for fields behind.

The second option introduces additional implementation complexity to HRANDFIELD.
We could further refine HRANDFIELD cases to differentiate between scenarios
with many expired fields versus few expired fields, and adjust based on the
percentage of expired fields. However, this approach could still lead to long
loops or necessitate expiring fields before selecting them. For the “lightweight”
cases it is also expected to have a lightweight expiration.

Considering the pros and cons, and the fact that HRANDFIELD is an infrequent
command (particularly with HFEs) and the fact we have effective active-expiration
behind for hash-fields, it is better to keep it simple and choose option number 1.

Other changes:
* Don't mark command dirty by internal hashTypeExpire(). It causes to read 
  only command of HRANDFIELD to be accidently propagated (This flag
  should be indicated at higher level, by the command functions).
* Align `hashTypeExpireIfNeeded()` and `hashTypeGetValue()` to be more
  aligned with `expireIfNeeded()` logic of keyspace.
2024-06-24 18:11:53 +03:00
..
hash-field-expire.tcl Adapt HRANDFIELD to HFE feature (#13348) 2024-06-24 18:11:53 +03:00
hash.tcl dynamically list test files (#13220) 2024-05-30 19:09:26 +08:00
incr.tcl Add INCR type command against wrong argument test cases. (#12836) 2024-01-23 15:39:38 +02:00
list-2.tcl dynamically list test files (#13220) 2024-05-30 19:09:26 +08:00
list-3.tcl Fix quicklist node not being recompressed correctly after inserting a new node before or after it (#10120) 2022-01-16 08:54:40 +02:00
list.tcl dynamically list test files (#13220) 2024-05-30 19:09:26 +08:00
set.tcl Reduce performance impact of dict rehashing and make it shorter. (#12899) 2024-01-27 11:11:53 +02:00
stream-cgroups.tcl Fix test failure due to differing reply format of XREADGROUP under RESP3 in MULTI (#13255) 2024-05-14 20:08:32 +08:00
stream.tcl Xread last entry in stream (#7388) (#13117) 2024-03-13 08:23:32 +02:00
string.tcl Add test case for APPEND command usage on integer value (#12429) 2023-07-24 18:25:50 -07:00
zset.tcl fix wrong data type conversion in zrangeResultBeginStore (#13148) 2024-03-19 08:52:55 +02:00