Skip to content

Commit eedb8b1

Browse files
fadidaoranagra
andauthored
Fix missing sections for INFO ALL with module (redis#11291)
When using `INFO ALL <section>`, when `section` is a specific module section. Redis will not print the additional section(s). The fix in this case, will search the modules info sections if the user provided additional sections to `ALL`. Co-authored-by: Oran Agra <[email protected]>
1 parent c2b0c13 commit eedb8b1

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/server.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6010,9 +6010,13 @@ sds genRedisInfoString(dict *section_dict, int all_sections, int everything) {
60106010
}
60116011

60126012
/* Get info from modules.
6013-
* if user asked for "everything" or "modules", or a specific section
6014-
* that's not found yet. */
6015-
if (everything || dictFind(section_dict, "modules") != NULL || sections < (int)dictSize(section_dict)) {
6013+
* Returned when the user asked for "everything", "modules", or a specific module section.
6014+
* We're not aware of the module section names here, and we rather avoid the search when we can.
6015+
* so we proceed if there's a requested section name that's not found yet, or when the user asked
6016+
* for "all" with any additional section names. */
6017+
if (everything || dictFind(section_dict, "modules") != NULL || sections < (int)dictSize(section_dict) ||
6018+
(all_sections && dictSize(section_dict)))
6019+
{
60166020

60176021
info = modulesCollectInfo(info,
60186022
everything || dictFind(section_dict, "modules") != NULL ? NULL: section_dict,

tests/unit/moduleapi/infotest.tcl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ start_server {tags {"modules"}} {
4444
assert { [string match "*used_memory*" $info] }
4545
}
4646

47+
test {module info all infotest} {
48+
set info [r info all infotest]
49+
# info all infotest should contain both ALL and the module information
50+
assert { [string match "*Spanish*" $info] }
51+
assert { [string match "*infotest_*" $info] }
52+
assert { [string match "*used_memory*" $info] }
53+
}
54+
4755
test {module info everything} {
4856
set info [r info everything]
4957
# info everything contains all default sections, but not ones for crash report

0 commit comments

Comments
 (0)