redis/tests
Yang Bodong b9a0500f16
Add HRANDFIELD and ZRANDMEMBER. improvements to SRANDMEMBER (#8297)
New commands:
`HRANDFIELD [<count> [WITHVALUES]]`
`ZRANDMEMBER [<count> [WITHSCORES]]`
Algorithms are similar to the one in SRANDMEMBER.

Both return a simple bulk response when no arguments are given, and an array otherwise.
In case values/scores are requested, RESP2 returns a long array, and RESP3 a nested array.
note: in all 3 commands, the only option that also provides random order is the one with negative count.

Changes to SRANDMEMBER
* Optimization when count is 1, we can use the more efficient algorithm of non-unique random
* optimization: work with sds strings rather than robj

Other changes:
* zzlGetScore: when zset needs to convert string to double, we use safer memcpy (in
  case the buffer is too small)
* Solve a "bug" in SRANDMEMBER test: it intended to test a positive count (case 3 or
  case 4) and by accident used a negative count

Co-authored-by: xinluton <xinluton@qq.com>
Co-authored-by: Oran Agra <oran@redislabs.com>
2021-01-29 10:47:28 +02:00
..
assets Sanitize dump payload: ziplist, listpack, zipmap, intset, stream 2020-12-06 14:54:34 +02:00
cluster Optimize performance of clusterGenNodesDescription for large clusters (#8182) 2021-01-13 12:36:03 -08:00
helpers revert an accidental test code change done as part of the tls project 2019-12-01 16:10:09 +02:00
integration implement FAILOVER command (#8315) 2021-01-28 13:18:05 -08:00
modules Add modules API for streams (#8288) 2021-01-28 16:19:43 +02:00
sentinel Add hostname support in Sentinel. (#8282) 2021-01-28 12:09:11 +02:00
support Add HRANDFIELD and ZRANDMEMBER. improvements to SRANDMEMBER (#8297) 2021-01-29 10:47:28 +02:00
tmp minor fixes to the new test suite, html doc updated 2010-05-14 18:48:33 +02:00
unit Add HRANDFIELD and ZRANDMEMBER. improvements to SRANDMEMBER (#8297) 2021-01-29 10:47:28 +02:00
instances.tcl Add hostname support in Sentinel. (#8282) 2021-01-28 12:09:11 +02:00
test_helper.tcl implement FAILOVER command (#8315) 2021-01-28 13:18:05 -08:00