microwww / redis-mock

redis server for java, java redis mock
https://github.com/microwww/jedis-mock
Apache License 2.0
47 stars 18 forks source link

使用lettuce连接池 不支持HELLO 指令 #7

Closed 592146505 closed 2 years ago

592146505 commented 2 years ago

无法兼容lettuce连接池,版本如下: redis-serve: com.github.microwww:redis-server:0.2.3 lettuce:io.lettuce:lettuce-core:6.1.5.RELEASE

主要异常堆栈如下:

Caused by: io.lettuce.core.RedisCommandExecutionException: ERR unsupported operation now :HELLO
    at io.lettuce.core.internal.ExceptionFactory.createExecutionException(ExceptionFactory.java:137)
    at io.lettuce.core.internal.ExceptionFactory.createExecutionException(ExceptionFactory.java:110)
    at io.lettuce.core.protocol.AsyncCommand.completeResult(AsyncCommand.java:120)
    at io.lettuce.core.protocol.AsyncCommand.complete(AsyncCommand.java:111)
    at io.lettuce.core.protocol.CommandHandler.complete(CommandHandler.java:746)
    at io.lettuce.core.protocol.CommandHandler.decode(CommandHandler.java:681)
    at io.lettuce.core.protocol.CommandHandler.channelRead(CommandHandler.java:598)

是否可将其列入默认支持的命令;

/**
 * Redis HELLO Command
 *
 * @author roamer
 * @version v1.0
 * @since 2021/11/14 23:08
 */
public class HelloOperation extends AbstractOperation {
    static byte[][] SERVER_META_INFO = new byte[][]{
            "server".getBytes(StandardCharsets.UTF_8),
            "redis".getBytes(StandardCharsets.UTF_8),
            "version".getBytes(StandardCharsets.UTF_8),
            "6.0.0".getBytes(StandardCharsets.UTF_8),
            "proto".getBytes(StandardCharsets.UTF_8),
            "2".getBytes(StandardCharsets.UTF_8),
            "id".getBytes(StandardCharsets.UTF_8),
            "2".getBytes(StandardCharsets.UTF_8),
            "mode".getBytes(StandardCharsets.UTF_8),
            "standalone".getBytes(StandardCharsets.UTF_8),
            "role".getBytes(StandardCharsets.UTF_8),
            "master".getBytes(StandardCharsets.UTF_8),
            "modules".getBytes(StandardCharsets.UTF_8),
            new byte[0],
    };

    // HELLO
    public void hello(RedisRequest request) throws IOException {
        request.expectArgumentsCount(4);
        RedisOutputProtocol.writerMulti(request.getOutputStream(), SERVER_META_INFO);
    }
}
lichangshu commented 2 years ago

i will add it , thank you .

lichangshu commented 2 years ago

release 0.3.0 to support RESP-3