Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
eos
QuarkDB
Commits
da2d8c9a
Commit
da2d8c9a
authored
Dec 06, 2019
by
Georgios Bitzes
Browse files
Add support for CLIENT SETNAME as potential aid in debugging
parent
e5cd7931
Pipeline
#1277982
passed with stages
in 54 minutes and 47 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/Commands.cc
View file @
da2d8c9a
...
...
@@ -37,6 +37,7 @@ struct cmdMapInit {
redis_cmd_map
[
"client_id"
]
=
{
RedisCommand
::
CLIENT_ID
,
CommandType
::
CONTROL
};
redis_cmd_map
[
"command_stats"
]
=
{
RedisCommand
::
COMMAND_STATS
,
CommandType
::
CONTROL
};
redis_cmd_map
[
"activate_push_types"
]
=
{
RedisCommand
::
ACTIVATE_PUSH_TYPES
,
CommandType
::
CONTROL
};
redis_cmd_map
[
"client"
]
=
{
RedisCommand
::
CLIENT
,
CommandType
::
CONTROL
};
redis_cmd_map
[
"auth"
]
=
{
RedisCommand
::
AUTH
,
CommandType
::
AUTHENTICATION
};
redis_cmd_map
[
"hmac_auth_generate_challenge"
]
=
{
RedisCommand
::
HMAC_AUTH_GENERATE_CHALLENGE
,
CommandType
::
AUTHENTICATION
};
...
...
src/Commands.hh
View file @
da2d8c9a
...
...
@@ -37,6 +37,7 @@ enum class RedisCommand {
CLIENT_ID
,
COMMAND_STATS
,
ACTIVATE_PUSH_TYPES
,
CLIENT
,
FLUSHALL
,
...
...
src/QuarkDBNode.cc
View file @
da2d8c9a
...
...
@@ -104,6 +104,17 @@ LinkStatus QuarkDBNode::dispatch(Connection *conn, RedisRequest &req) {
case
RedisCommand
::
PING
:
{
return
conn
->
raw
(
handlePing
(
req
));
}
case
RedisCommand
::
CLIENT
:
{
if
(
req
.
size
()
!=
3
)
return
conn
->
errArgs
(
req
[
0
]);
if
(
!
caseInsensitiveEquals
(
req
[
1
],
"setname"
))
{
return
conn
->
err
(
"malformed request"
);
}
qdb_info
(
"Connection with UUID "
<<
conn
->
getID
()
<<
" identifying as '"
<<
StringUtils
::
escapeNonPrintable
(
req
[
2
])
<<
"'"
);
return
conn
->
ok
();
}
case
RedisCommand
::
DEBUG
:
{
if
(
req
.
size
()
!=
2
)
return
conn
->
errArgs
(
req
[
0
]);
if
(
caseInsensitiveEquals
(
req
[
1
],
"segfault"
))
{
...
...
test/e2e.cc
View file @
da2d8c9a
...
...
@@ -93,6 +93,7 @@ TEST_F(Raft_e2e, simultaneous_clients) {
// send off many requests, pipeline them
futures
.
emplace_back
(
tunnel
(
leaderID
)
->
exec
(
"get"
,
"asdf"
));
futures
.
emplace_back
(
tunnel
(
leaderID
)
->
exec
(
"ping"
));
futures
.
emplace_back
(
tunnel
(
leaderID
)
->
exec
(
"client"
,
"setname"
,
"aaa"
));
futures
.
emplace_back
(
tunnel
(
leaderID
)
->
exec
(
"set"
,
"asdf"
,
"1234"
));
futures
.
emplace_back
(
tunnel
(
leaderID
)
->
exec
(
"get"
,
"asdf"
));
futures
.
emplace_back
(
tunnel
(
leaderID
)
->
exec
(
"raft-fetch"
,
SSTR
(
lastEntry
+
1
),
"raw"
));
...
...
@@ -100,10 +101,11 @@ TEST_F(Raft_e2e, simultaneous_clients) {
ASSERT_REPLY
(
futures
[
0
],
""
);
ASSERT_REPLY
(
futures
[
1
],
"PONG"
);
ASSERT_REPLY
(
futures
[
2
],
"OK"
);
ASSERT_REPLY
(
futures
[
3
],
"1234"
);
ASSERT_REPLY
(
futures
[
3
],
"OK"
);
ASSERT_REPLY
(
futures
[
4
],
"1234"
);
RaftEntry
entry
;
ASSERT_TRUE
(
RaftParser
::
fetchResponse
(
futures
[
4
].
get
().
get
(),
entry
));
ASSERT_TRUE
(
RaftParser
::
fetchResponse
(
futures
[
5
].
get
().
get
(),
entry
));
ASSERT_EQ
(
entry
.
term
,
state
(
0
)
->
getSnapshot
()
->
term
);
ASSERT_EQ
(
entry
.
request
,
make_req
(
"set"
,
"asdf"
,
"1234"
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment