Skip to content

Commit 57816a4

Browse files
committed
override INFO & FUNCITON_STATS request policy for cluster to DEFAULT
1 parent af1899f commit 57816a4

2 files changed

Lines changed: 26 additions & 5 deletions

File tree

src/main/java/redis/clients/jedis/StaticCommandFlagsRegistryInitializer.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
* <ul>
1515
* <li>Version: 8.6.1</li>
1616
* <li>Mode: standalone</li>
17-
* <li>Loaded Modules: timeseries, search, bf, vectorset, ReJSON</li>
18-
* <li>Generated at: 2026-03-02 16:18:50 CET</li>
17+
* <li>Loaded Modules: timeseries, search, vectorset, bf, ReJSON</li>
18+
* <li>Generated at: 2026-03-20 13:22:33 EET</li>
1919
* </ul>
2020
*/
2121
final class StaticCommandFlagsRegistryInitializer {
@@ -77,7 +77,7 @@ static void initialize(StaticCommandFlagsRegistry.Builder builder) {
7777
EnumSet.of(CommandFlag.DENYOOM, CommandFlag.NOSCRIPT, CommandFlag.WRITE),
7878
RequestPolicy.ALL_SHARDS, ResponsePolicy.ALL_SUCCEEDED);
7979
builder.register("FUNCTION", "STATS", EnumSet.of(CommandFlag.ALLOW_BUSY, CommandFlag.NOSCRIPT),
80-
RequestPolicy.ALL_SHARDS, ResponsePolicy.SPECIAL);
80+
RequestPolicy.DEFAULT, ResponsePolicy.SPECIAL);
8181
builder.register("CLIENT", EMPTY_FLAGS);
8282
// CLIENT subcommands
8383
builder.register("CLIENT", "CACHING",
@@ -498,9 +498,9 @@ static void initialize(StaticCommandFlagsRegistry.Builder builder) {
498498
builder.register("ZPOPMIN", EnumSet.of(CommandFlag.FAST, CommandFlag.WRITE));
499499
builder.register("ZREM", EnumSet.of(CommandFlag.FAST, CommandFlag.WRITE));
500500

501-
// 1 command(s) with: loading, stale; request_policy=all_shards; response_policy=special
501+
// 1 command(s) with: loading, stale; request_policy=default; response_policy=special
502502
builder.register("INFO", EnumSet.of(CommandFlag.LOADING, CommandFlag.STALE),
503-
RequestPolicy.ALL_SHARDS, ResponsePolicy.SPECIAL);
503+
RequestPolicy.DEFAULT, ResponsePolicy.SPECIAL);
504504

505505
// 56 command(s) with: module, readonly
506506
builder.register("CMS.INFO", EnumSet.of(CommandFlag.MODULE, CommandFlag.READONLY));

src/test/java/redis/clients/jedis/codegen/CommandFlagsRegistryGenerator.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,27 @@ public class CommandFlagsRegistryGenerator {
8585
* To add a new override, add an entry to this map in the static initializer block.
8686
*/
8787
private static final Map<String, CommandMetadata> MANUAL_OVERRIDES = new LinkedHashMap<>();
88+
static {
89+
// Override INFO: change request policy from ALL_SHARDS to DEFAULT
90+
// Reason: SPECIAL Response not yet supported in the library and defaults to return single
91+
// result INFO should be executed on a single node, not broadcast to all shards
92+
MANUAL_OVERRIDES.put("INFO", new CommandMetadata(Arrays.asList("loading", "stale"), "default", // request_policy:
93+
// DEFAULT
94+
// instead
95+
// of
96+
// ALL_SHARDS
97+
"special")); // response_policy: SPECIAL (preserve from server metadata)
98+
99+
// Override FUNCTION STATS: change request policy from ALL_SHARDS to DEFAULT
100+
// Reason: FUNCTION STATS should be executed on a single node, not broadcast to all shards
101+
// Note: response_policy is SPECIAL (for custom aggregation of function stats from single node)
102+
MANUAL_OVERRIDES.put("FUNCTION STATS",
103+
new CommandMetadata(Arrays.asList("noscript", "allow_busy"), "default", // request_policy:
104+
// DEFAULT
105+
// instead of
106+
// ALL_SHARDS
107+
"special")); // response_policy: SPECIAL (preserve from server metadata)
108+
}
88109

89110
/**
90111
* Known parent commands that have subcommands. When the generator encounters a command name

0 commit comments

Comments
 (0)