Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
eos
QuarkDB
Commits
4738e257
Commit
4738e257
authored
Jun 19, 2018
by
Georgios Bitzes
Browse files
Implement command to show per-compaction-level compression ratio
parent
d463b749
Pipeline
#419299
passed with stages
in 29 minutes and 54 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/Commands.cc
View file @
4738e257
...
...
@@ -126,6 +126,7 @@ struct cmdMapInit {
redis_cmd_map
[
"quarkdb_invalid_command"
]
=
{
RedisCommand
::
QUARKDB_INVALID_COMMAND
,
CommandType
::
QUARKDB
};
redis_cmd_map
[
"quarkdb_manual_compaction"
]
=
{
RedisCommand
::
QUARKDB_MANUAL_COMPACTION
,
CommandType
::
QUARKDB
};
redis_cmd_map
[
"quarkdb_level_stats"
]
=
{
RedisCommand
::
QUARKDB_LEVEL_STATS
,
CommandType
::
QUARKDB
};
redis_cmd_map
[
"quarkdb_compression_stats"
]
=
{
RedisCommand
::
QUARKDB_COMPRESSION_STATS
,
CommandType
::
QUARKDB
};
redis_cmd_map
[
"recovery_info"
]
=
{
RedisCommand
::
RECOVERY_INFO
,
CommandType
::
RECOVERY
};
redis_cmd_map
[
"recovery_set"
]
=
{
RedisCommand
::
RECOVERY_SET
,
CommandType
::
RECOVERY
};
...
...
src/Commands.hh
View file @
4738e257
...
...
@@ -128,6 +128,7 @@ enum class RedisCommand {
QUARKDB_INVALID_COMMAND
,
// used in tests
QUARKDB_MANUAL_COMPACTION
,
QUARKDB_LEVEL_STATS
,
QUARKDB_COMPRESSION_STATS
,
RECOVERY_GET
,
RECOVERY_SET
,
...
...
src/Shard.cc
View file @
4738e257
...
...
@@ -208,6 +208,21 @@ LinkStatus Shard::dispatch(Connection *conn, RedisRequest &req) {
return
conn
->
status
(
stateMachine
->
levelStats
());
}
case
RedisCommand
::
QUARKDB_COMPRESSION_STATS
:
{
if
(
req
.
size
()
!=
1
)
return
conn
->
errArgs
(
req
[
0
]);
InFlightRegistration
registration
(
inFlightTracker
);
if
(
!
registration
.
ok
())
{
return
conn
->
err
(
"unavailable"
);
}
std
::
ostringstream
ss
;
std
::
vector
<
std
::
string
>
stats
=
stateMachine
->
compressionStats
();
for
(
size_t
i
=
0
;
i
<
stats
.
size
();
i
++
)
{
ss
<<
"Level "
<<
i
<<
": "
<<
stats
[
i
]
<<
std
::
endl
;
}
return
conn
->
status
(
ss
.
str
());
}
default:
{
if
(
req
.
getCommandType
()
==
CommandType
::
QUARKDB
)
{
qdb_critical
(
"Unable to dispatch command '"
<<
req
[
0
]
<<
"' of type QUARKDB"
);
...
...
src/StateMachine.cc
View file @
4738e257
...
...
@@ -1229,6 +1229,18 @@ std::string StateMachine::levelStats() {
return
stats
;
}
std
::
vector
<
std
::
string
>
StateMachine
::
compressionStats
()
{
std
::
vector
<
std
::
string
>
results
;
for
(
size_t
i
=
0
;
i
<=
6
;
i
++
)
{
std
::
string
tmp
;
db
->
GetProperty
(
SSTR
(
rocksdb
::
DB
::
Properties
::
kCompressionRatioAtLevelPrefix
<<
i
),
&
tmp
);
results
.
emplace_back
(
tmp
);
}
return
results
;
}
rocksdb
::
Status
StateMachine
::
noop
(
LogIndex
index
)
{
StagingArea
stagingArea
(
*
this
);
return
stagingArea
.
commit
(
index
);
...
...
src/StateMachine.hh
View file @
4738e257
...
...
@@ -173,6 +173,11 @@ public:
//----------------------------------------------------------------------------
std
::
string
levelStats
();
//----------------------------------------------------------------------------
// Get compression stats
//----------------------------------------------------------------------------
std
::
vector
<
std
::
string
>
compressionStats
();
bool
inBulkLoad
()
const
{
return
bulkLoad
;
}
...
...
test/e2e.cc
View file @
4738e257
...
...
@@ -937,6 +937,7 @@ TEST_F(Raft_e2e, smove) {
ASSERT_REPLY
(
tunnel
(
leaderID
)
->
exec
(
"smembers"
,
"set2"
),
make_vec
(
"i1"
,
"t1"
,
"t2"
,
"t3"
,
"t4"
,
"t5"
));
ASSERT_REPLY
(
tunnel
(
leaderID
)
->
exec
(
"quarkdb-manual-compaction"
),
"OK"
);
qdb_info
(
qclient
::
describeRedisReply
(
tunnel
(
leaderID
)
->
exec
(
"quarkdb-level-stats"
).
get
()));
qdb_info
(
qclient
::
describeRedisReply
(
tunnel
(
leaderID
)
->
exec
(
"quarkdb-compression-stats"
).
get
()));
}
TEST_F
(
Raft_e2e
,
sscan
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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