valkey-io / valkey

A flexible distributed key-value datastore that is optimized for caching and other realtime workloads.
https://valkey.io
Other
17.08k stars 641 forks source link

[NEW] New Commands for Module: Module Set-Argument <name> [ARGS1, ARGS2...] and Module Reset-Argument <name> #912

Closed hwware closed 2 weeks ago

hwware commented 2 months ago

The problem/use-case that the feature addresses

Since Valkey 7, config rewrite command supports rewrite module in config file. However, during runtime, if the clients update the module arguments, the new arguments can not be written to config file successfully.

Description of the feature

For this case, I would like to create 2 more new commands for module: Command names are tentative:

  1. Module Set-Argument name [ARGS1, ARGS2...]

  2. Module Reset-Argument name -- it allows client to reset the module argument to original value

Additional information

For module list command, the output as below:

172.0.0.1:6379> module list 1) 1 "name" 2 "myhello" 3 "ver" 4 (integer) 1 5 "path" 6 "/home/ubuntu/valkey/modules/hello/myhello.so" 7 "args" 8 1) "1" ---- Here, to keep the backwards compatible, runtime arguments shown here, not loaded argument 2) "2" 3) "3" 4) "4"

madolson commented 2 months ago

Is this really all that important now that modules can natively integrate with the config system now?

hwware commented 2 months ago

it is related to business. If we can not save the updated module arguments in config file, once the server restart, client need to set these arguments again. For the module loadex command, the CONFIG name value, the value can be updated through config get/set.