diff --git a/src/db.c b/src/db.c index 7b34fcb4700..4c8c0d287f4 100644 --- a/src/db.c +++ b/src/db.c @@ -848,11 +848,10 @@ void scanCallback(void *privdata, const dictEntry *de) { serverAssert(!((data->type != LLONG_MAX) && o)); /* Filter an element if it isn't the type we want. */ - /* TODO: uncomment in redis 8.0 if (!o && data->type != LLONG_MAX) { robj *rval = dictGetVal(de); if (!objectTypeCompare(rval, data->type)) return; - }*/ + } /* Filter element if it does not match the pattern. */ sds keysds = dictGetKey(de); @@ -1000,9 +999,8 @@ void scanGenericCommand(client *c, robj *o, unsigned long cursor) { typename = c->argv[i+1]->ptr; type = getObjectTypeByName(typename); if (type == LLONG_MAX) { - /* TODO: uncomment in redis 8.0 addReplyErrorFormat(c, "unknown type name '%s'", typename); - return; */ + return; } i+= 2; } else { @@ -1129,15 +1127,6 @@ void scanGenericCommand(client *c, robj *o, unsigned long cursor) { while ((ln = listNext(&li))) { sds key = listNodeValue(ln); initStaticStringObject(kobj, key); - /* Filter an element if it isn't the type we want. */ - /* TODO: remove this in redis 8.0 */ - if (typename) { - robj* typecheck = lookupKeyReadWithFlags(c->db, &kobj, LOOKUP_NOTOUCH|LOOKUP_NONOTIFY); - if (!typecheck || !objectTypeCompare(typecheck, type)) { - listDelNode(keys, ln); - } - continue; - } if (expireIfNeeded(c->db, &kobj, 0)) { listDelNode(keys, ln); } diff --git a/tests/unit/scan.tcl b/tests/unit/scan.tcl index d688d7cda1a..41234f4deeb 100644 --- a/tests/unit/scan.tcl +++ b/tests/unit/scan.tcl @@ -109,25 +109,9 @@ start_server {tags {"scan network"}} { after 2 - # TODO: remove this in redis 8.0 - set cur 0 - set keys {} - while 1 { - set res [r scan $cur type "string1"] - set cur [lindex $res 0] - set k [lindex $res 1] - lappend keys {*}$k - if {$cur == 0} break - } - - assert_equal 0 [llength $keys] - # make sure that expired key have been removed by scan command - assert_equal 1000 [scan [regexp -inline {keys\=([\d]*)} [r info keyspace]] keys=%d] - - # TODO: uncomment in redis 8.0 - #assert_error "*unknown type name*" {r scan 0 type "string1"} + assert_error "*unknown type name*" {r scan 0 type "string1"} # expired key will be no touched by scan command - #assert_equal 1001 [scan [regexp -inline {keys\=([\d]*)} [r info keyspace]] keys=%d] + assert_equal 1001 [scan [regexp -inline {keys\=([\d]*)} [r info keyspace]] keys=%d] r debug set-active-expire 1 } {OK} {needs:debug} @@ -191,11 +175,8 @@ start_server {tags {"scan network"}} { assert_equal 1000 [llength $keys] - # make sure that expired key have been removed by scan command - assert_equal 1000 [scan [regexp -inline {keys\=([\d]*)} [r info keyspace]] keys=%d] - # TODO: uncomment in redis 8.0 # make sure that only the expired key in the type match will been removed by scan command - #assert_equal 1001 [scan [regexp -inline {keys\=([\d]*)} [r info keyspace]] keys=%d] + assert_equal 1001 [scan [regexp -inline {keys\=([\d]*)} [r info keyspace]] keys=%d] r debug set-active-expire 1 } {OK} {needs:debug}