Skip to content

ZSCAN match pattern encoding issue #792

@silvertype

Description

@silvertype

lettuce-core version : 5.0.4-RELEASE

I'm trying to find keys with patterns in the values.
So I created a secondary index key consisting of id and name with sorted sets.

redis-cli works well

127.0.0.1:7001> zscan idx_key 0 match *가전* count 10000
1) "0"
2)  1) "10001396:\xec\x98\x81\xec\x83\x81\xea\xb0\x80\xec\xa0\x84\xec\x95\xa1\xec\x84\xb8\xec\x84\x9c\xeb\xa6\xac"
    2) "0"
    3) "10000209:\xec\x9d\x8c\xed\x96\xa5\xea\xb0\x80\xec\xa0\x84"
    4) "0"
    5) "10000211:\xec\x9d\xb4\xeb\xaf\xb8\xec\x9a\xa9\xea\xb0\x80\xec\xa0\x84"
    6) "0"
    7) "10001850:\xec\x9d\xb4\xeb\xaf\xb8\xec\x9a\xa9\xea\xb0\x80\xec\xa0\x84\xec\x95\xa1\xec\x84\xb8\xec\x84\x9c\xeb\xa6\xac"
    8) "0"
    9) "10000801:\xea\xb0\x80\xec\xa0\x84\xec\xa0\x9c\xed\x92\x88"
   10) "0"

but, lettuce client zscan result 0.

ScanArgs scanArgs = ScanArgs.Builder.matches("*가전*").limit(Integer.MAX_VALUE);
ScoredValueScanCursor ret = lettuceCient.zscan(key, ScanCursor.INITIAL, scanArgs);

on monitor

"ZSCAN" "idx_key" "0" "MATCH" "*\x00\x04*" "COUNT" "2147483647"

가전 -> \x00\x04
The correct utf-8 encoding value is \xea\xb0\x80\xec\xa0\x84

Why does it change like this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions