From 20854cb6109c23e65dca0174517f3861a55cb694 Mon Sep 17 00:00:00 2001 From: Binbin Date: Fri, 9 Dec 2022 23:08:01 +0800 Subject: Fix zuiFind crash / RM_ScanKey hang on SET object listpack encoding (#11581) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Co-authored-by: Viktor Söderqvist --- src/object.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/object.c') diff --git a/src/object.c b/src/object.c index f2ea7dafe..a11ac1116 100644 --- a/src/object.c +++ b/src/object.c @@ -30,6 +30,7 @@ #include "server.h" #include "functions.h" +#include "intset.h" /* Compact integer set structure */ #include #include -- cgit v1.2.1