summaryrefslogtreecommitdiff
path: root/src/t_set.c
diff options
context:
space:
mode:
authorBinbin <binloveplay1314@qq.com>2022-12-09 23:08:01 +0800
committerGitHub <noreply@github.com>2022-12-09 17:08:01 +0200
commit20854cb6109c23e65dca0174517f3861a55cb694 (patch)
tree4a11c1cb4f83d640e66366eadfe88ce85dbada44 /src/t_set.c
parent528bb11d7a25cde99e6d48c418662575c64758b2 (diff)
downloadredis-20854cb6109c23e65dca0174517f3861a55cb694.tar.gz
Fix zuiFind crash / RM_ScanKey hang on SET object listpack encoding (#11581)
In #11290, we added listpack encoding for SET object. But forgot to support it in zuiFind, causes ZINTER, ZINTERSTORE, ZINTERCARD, ZIDFF, ZDIFFSTORE to crash. And forgot to support it in RM_ScanKey, causes it hang. This PR add support SET listpack in zuiFind, and in RM_ScanKey. And add tests for related commands to cover this case. Other changes: - There is no reason for zuiFind to go into the internals of the SET. It can simply use setTypeIsMember and don't care about encoding. - Remove the `#include "intset.h"` from server.h reduce the chance of accidental intset API use. - Move setTypeAddAux, setTypeRemoveAux and setTypeIsMemberAux interfaces to the header. - In scanGenericCommand, use setTypeInitIterator and setTypeNext to handle OBJ_SET scan. - In RM_ScanKey, improve hash scan mode, use lpGetValue like zset, they can share code and better performance. The zuiFind part fixes #11578 Co-authored-by: Oran Agra <oran@redislabs.com> Co-authored-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
Diffstat (limited to 'src/t_set.c')
-rw-r--r--src/t_set.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/t_set.c b/src/t_set.c
index ae5f26540..557ba35ce 100644
--- a/src/t_set.c
+++ b/src/t_set.c
@@ -28,12 +28,7 @@
*/
#include "server.h"
-
-/* Internal prototypes */
-
-int setTypeAddAux(robj *set, char *str, size_t len, int64_t llval, int str_is_sds);
-int setTypeRemoveAux(robj *set, char *str, size_t len, int64_t llval, int str_is_sds);
-int setTypeIsMemberAux(robj *set, char *str, size_t len, int64_t llval, int str_is_sds);
+#include "intset.h" /* Compact integer set structure */
/*-----------------------------------------------------------------------------
* Set Commands