[ https://issues.apache.org/jira/browse/GEODE-8668?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17223120#comment-17223120 ]
ASF GitHub Bot commented on GEODE-8668: --------------------------------------- sabbey37 commented on a change in pull request #5682: URL: https://github.com/apache/geode/pull/5682#discussion_r514479205 ########## File path: geode-redis/src/main/java/org/apache/geode/redis/internal/executor/connection/SelectExecutor.java ########## @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * + */ +package org.apache.geode.redis.internal.executor.connection; + +import static org.apache.geode.redis.internal.RedisConstants.ERROR_SELECT; + +import org.apache.geode.redis.internal.executor.AbstractExecutor; +import org.apache.geode.redis.internal.executor.RedisResponse; +import org.apache.geode.redis.internal.netty.Command; +import org.apache.geode.redis.internal.netty.ExecutionHandlerContext; + +public class SelectExecutor extends AbstractExecutor { + + @Override + public RedisResponse executeCommand(Command command, ExecutionHandlerContext context) { + String dbIndexString = command.getStringKey(); + + if (!dbIndexString.equals("0")) { + return RedisResponse.error(ERROR_SELECT); + } + + return RedisResponse.ok(); Review comment: I changed this so we were no longer parsing the long and just comparing the string value. Let me know if you think this is the right approach. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Implement Redis SELECT command > ------------------------------ > > Key: GEODE-8668 > URL: https://issues.apache.org/jira/browse/GEODE-8668 > Project: Geode > Issue Type: Improvement > Components: redis > Reporter: Sarah Abbey > Assignee: Sarah Abbey > Priority: Major > Labels: pull-request-available > > We are implementing SELECT because some Redis analysis tools (like Redis > Insight) require the SELECT command in order to function properly. Since > Geode Redis is similar to Redis in cluster mode in that currently it only > supports database zero, we emulated the behavior of SELECT in cluster mode. > Only database zero may be selected. All other valid DB indices (from > -9223372036854775807 to 9223372036854775807) return the same error as Redis > in Cluster mode: ERR SELECT is not allowed in cluster mode. Any DB indices > that cannot be parsed as a long will return the error: ERR invalid DB index -- This message was sent by Atlassian Jira (v8.3.4#803005)