Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
c1ea6175
Unverified
Commit
c1ea6175
authored
Sep 26, 2019
by
Salvatore Sanfilippo
Committed by
GitHub
Sep 26, 2019
Browse files
Merge pull request #6024 from itamarhaber/info_modules
Adds a "Modules" section to `INFO`
parents
959fb5cf
52686f48
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/module.c
View file @
c1ea6175
...
...
@@ -5363,6 +5363,25 @@ void addReplyLoadedModules(client *c) {
dictReleaseIterator
(
di
);
}
/* Helper function for the INFO command: adds loaded modules as to info's
* output.
*
* After the call, the passed sds info string is no longer valid and all the
* references must be substituted with the new pointer returned by the call. */
sds
genModulesInfoString
(
sds
info
)
{
dictIterator
*
di
=
dictGetIterator
(
modules
);
dictEntry
*
de
;
while
((
de
=
dictNext
(
di
))
!=
NULL
)
{
sds
name
=
dictGetKey
(
de
);
struct
RedisModule
*
module
=
dictGetVal
(
de
);
info
=
sdscatprintf
(
info
,
"module:name=%s,ver=%d
\r\n
"
,
name
,
module
->
ver
);
}
dictReleaseIterator
(
di
);
return
info
;
}
/* Redis MODULE command.
*
* MODULE LOAD <path> [args...] */
...
...
src/server.c
View file @
c1ea6175
...
...
@@ -4340,6 +4340,13 @@ sds genRedisInfoString(char *section) {
(
long
)
c_ru
.
ru_utime
.
tv_sec
,
(
long
)
c_ru
.
ru_utime
.
tv_usec
);
}
/* Modules */
if
(
allsections
||
defsections
||
!
strcasecmp
(
section
,
"modules"
))
{
if
(
sections
++
)
info
=
sdscat
(
info
,
"
\r\n
"
);
info
=
sdscatprintf
(
info
,
"# Modules
\r\n
"
);
info
=
genModulesInfoString
(
info
);
}
/* Command statistics */
if
(
allsections
||
!
strcasecmp
(
section
,
"commandstats"
))
{
if
(
sections
++
)
info
=
sdscat
(
info
,
"
\r\n
"
);
...
...
src/server.h
View file @
c1ea6175
...
...
@@ -2335,6 +2335,7 @@ void bugReportStart(void);
void
serverLogObjectDebugInfo
(
const
robj
*
o
);
void
sigsegvHandler
(
int
sig
,
siginfo_t
*
info
,
void
*
secret
);
sds
genRedisInfoString
(
char
*
section
);
sds
genModulesInfoString
(
sds
info
);
void
enableWatchdog
(
int
period
);
void
disableWatchdog
(
void
);
void
watchdogScheduleSignal
(
int
period
);
...
...
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