Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynomite, Support REDIS SELECT 0 command #670

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/dyn_message.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@
ACTION(REQ_REDIS_JSONOBJKEYS) \
ACTION(REQ_REDIS_JSONOBJLEN) \
/* ACTION(REQ_REDIS_AUTH) */ \
/* ACTION(REQ_REDIS_SELECT)*/ /* only during init */ \
ACTION(REQ_REDIS_SELECT) /* SELECT with arg '0' is valid */ \
ACTION(REQ_REDIS_PFADD) /* redis requests - hyperloglog */ \
ACTION(REQ_REDIS_PFCOUNT) \
ACTION(REQ_REDIS_CONFIG) \
Expand Down
12 changes: 12 additions & 0 deletions src/proto/dyn_redis.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ static bool redis_arg1(struct msg *r) {
static bool redis_arg_upto1(struct msg *r) {
switch (r->type) {
case MSG_REQ_REDIS_INFO:
case MSG_REQ_REDIS_SELECT:
return true;
default:
break;
Expand Down Expand Up @@ -1199,6 +1200,12 @@ void redis_parse_req(struct msg *r, struct context *ctx) {
r->is_read = 0;
break;
}
if (str6icmp(m, 's', 'e', 'l', 'e', 'c', 't')) {
r->type = MSG_REQ_REDIS_SELECT;
r->msg_routing = ROUTING_LOCAL_NODE_ONLY; /* 0 expected */
r->is_read = 0;
break;
}
break;

case 7:
Expand Down Expand Up @@ -1812,6 +1819,11 @@ void redis_parse_req(struct msg *r, struct context *ctx) {
log_error("Redis CONFIG command not supported '%.*s'", p - m, m);
goto error;
}
if (r->type == MSG_REQ_REDIS_SELECT && dn_atoi(p, r->rlen)) {
log_error("Redis SELECT command not supported for db '%.*s'", r->rlen, p);
goto error;
}

m = p + r->rlen;

if (read_repairs_enabled) {
Expand Down