Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
eos
QuarkDB
Commits
3e434475
Commit
3e434475
authored
Mar 26, 2018
by
Georgios Bitzes
Browse files
Allow showing just the current leader in raft-info
parent
8b6a10e7
Pipeline
#341143
passed with stages
in 26 minutes and 11 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/raft/RaftDispatcher.cc
View file @
3e434475
...
...
@@ -43,6 +43,10 @@ LinkStatus RaftDispatcher::dispatch(Connection *conn, RedisRequest &req) {
switch
(
req
.
getCommand
())
{
case
RedisCommand
::
RAFT_INFO
:
{
// safe, read-only request, does not need authorization
if
(
req
.
size
()
==
2
&&
caseInsensitiveEquals
(
req
[
1
],
"leader"
))
{
return
conn
->
string
(
state
.
getSnapshot
()
->
leader
.
toString
());
}
return
conn
->
statusVector
(
this
->
info
().
toVector
());
}
case
RedisCommand
::
RAFT_FETCH_LAST
:
{
...
...
test/e2e.cc
View file @
3e434475
...
...
@@ -425,6 +425,7 @@ TEST_F(Raft_e2e, test_many_redis_commands) {
futures
.
emplace_back
(
tunnel
(
leaderID
)
->
exec
(
"bad_command"
));
futures
.
emplace_back
(
tunnel
(
leaderID
)
->
exec
(
"exists"
,
"hash"
));
futures
.
emplace_back
(
tunnel
(
leaderID
)
->
exec
(
"exists"
,
"hash2"
));
futures
.
emplace_back
(
tunnel
(
leaderID
)
->
exec
(
"raft_info"
,
"leader"
));
ASSERT_REPLY
(
futures
[
0
],
1
);
ASSERT_REPLY
(
futures
[
1
],
1
);
...
...
@@ -434,6 +435,7 @@ TEST_F(Raft_e2e, test_many_redis_commands) {
ASSERT_REPLY
(
futures
[
5
],
"ERR unknown command 'bad_command'"
);
ASSERT_REPLY
(
futures
[
6
],
0
);
ASSERT_REPLY
(
futures
[
7
],
1
);
ASSERT_REPLY
(
futures
[
8
],
myself
(
leaderID
).
toString
()
);
futures
.
clear
();
futures
.
emplace_back
(
tunnel
(
leaderID
)
->
exec
(
"hmset"
,
"hmset_test"
,
"f1"
,
"v1"
,
"f2"
,
"v2"
));
...
...
Write
Preview
Supports
Markdown
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