Repository: redis/redis

Issue:
[BUG] DEBUG POPULATE is not replicated
**Describe the bug**

Keys created using `DEBUG POPULATE` are not propagated to replicas.

**To reproduce**

Set up a master and a replica. Call e.g. `DEBUG POPULATE 10` on the master. Check the keys on the replica using DBSIZE, KEYS or SCAN 0.

**Expected behavior**

I expect the same content on the replica as on the master (given the replica isn't writable, slow, offline or defect).

**Additional information**

I guess that the reason is that `server.dirty++` is not done in the implementation of DEBUG POPULATE.

**Other fun facts**

* The DEBUG command is not flagged as a write command (although DEBUG POPULATE is doing writes)
* DEBUG POPULATE doesn't care about cluster slots, so when called on a cluster node, keys not belonging to this node can be created.
* DEBUG POPULATE is documented in the output of DEBUG HELP, but not on redis.io


Discussion:
Fun fact number 4:
* DEBUG POPULATE is not meant to be consistent with other parts of Redis (IMHO). 

it's not a real command, just a testing hack.. 
Other sub-commands of DEBUG are also not consistent, like not supporting COMMAND GETKEYS and cluster MOVED response. 

IMHO It is perfectly fine that it is documented in DEBUG HELP but not in Redis.io. other DEBUG subcommands should not be in Redis.io, and soon they'll be gone from there. 
I suppose it'll also be missing from COMMAND output too. 

See #9687, #9656, #9684
All in some way partially related. 
OK, then at least some of these limitations could be mentioned in the DEBUG HELP output. It'd be helpful. (Today I tried to use debug populate in a test case involving replication...)
Meh.. You won't make that mistake again... 8-)
Feel free to add warnings.. 
In theory we can also fix things, but I think that incrementing the dirty counter and propagating it would be a mistake, and may also cause some tests to break. 

Patch:
diff --git a/src/debug.c b/src/debug.c
index 52e39d2f631..8776de38f1f 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -434,7 +434,9 @@ void debugCommand(client *c) {
 "    Crash the server simulating a panic.",
 "POPULATE <count> [<prefix>] [<size>]",
 "    Create <count> string keys named key:<num>. If <prefix> is specified then",
-"    it is used instead of the 'key' prefix.",
+"    it is used instead of the 'key' prefix. These are not propagated to",
+"    replicas. Cluster slots are not respected so keys not belonging to the",
+"    current node can be created in cluster mode.",
 "PROTOCOL <type>",
 "    Reply with a test value of the specified type. <type> can be: string,",
 "    integer, double, bignum, null, array, set, map, attrib, push, verbatim,",
@@ -476,7 +478,7 @@ void debugCommand(client *c) {
 "LISTPACK <key>",
 "    Show low level info about the listpack encoding of <key>.",
 "QUICKLIST <key> [<0|1>]",
-"    Show low level info about the quicklist encoding of <key>."
+"    Show low level info about the quicklist encoding of <key>.",
 "    The optional argument (0 by default) sets the level of detail",
 "CLIENT-EVICTION",
 "    Show low level client eviction pools info (maxmemory-clients).",