redis/src/commands/migrate.json
guybe7 10bbeb6837
Add command tips to COMMAND DOCS (#10104)
Adding command tips (see https://redis.io/topics/command-tips) to commands.

Breaking changes:
1. Removed the "random" and "sort_for_script" flags. They are now command tips.
(this isn't affecting redis behavior since #9812, but could affect some client applications
that's relying on COMMAND command flags)

Summary of changes:
1. add BLOCKING flag (new flag) for all commands that could block. The ACL category with
  the same name is now implicit.
2. move RANDOM flag to a `nondeterministic_output` tip
3. move SORT_FOR_SCRIPT flag to `nondeterministic_output_order` tip
3. add REQUEST_POLICY and RESPONSE_POLICY where appropriate as documented in the tips
4. deprecate (ignore) the `random` flag for RM_CreateCommand

Other notes:
1. Proxies need to send `RANDOMKEY` to all shards and then select one key randomly.
  The other option is to pick a random shard and transfer `RANDOMKEY `to it, but that scheme
  fails if this specific shard is empty
2. Remove CMD_RANDOM from `XACK` (i.e. XACK does not have RANDOM_OUTPUT)
   It was added in 9e4fb96ca1, I guess by mistake.
   Also from `(P)EXPIRETIME` (new command, was flagged "random" by mistake).
3. Add `nondeterministic_output` to `OBJECT ENCODING` (for the same reason `XTRIM` has it:
   the reply may differ depending on the internal representation in memory)
4. RANDOM on `HGETALL` was wrong (there due to a limitation of the old script sorting logic), now
  it's `nondeterministic_output_order`
5. Unrelated: Hide CMD_PROTECTED from COMMAND
2022-01-20 11:32:11 +02:00

163 lines
4.5 KiB
JSON

{
"MIGRATE": {
"summary": "Atomically transfer a key from a Redis instance to another one.",
"complexity": "This command actually executes a DUMP+DEL in the source instance, and a RESTORE in the target instance. See the pages of these commands for time complexity. Also an O(N) data transfer between the two instances is performed.",
"group": "generic",
"since": "2.6.0",
"arity": -6,
"function": "migrateCommand",
"get_keys_function": "migrateGetKeys",
"history": [
[
"3.0.0",
"Added the `COPY` and `REPLACE` options."
],
[
"3.0.6",
"Added the `KEYS` option."
],
[
"4.0.7",
"Added the `AUTH` option."
],
[
"6.0.0",
"Added the `AUTH2` option."
]
],
"command_flags": [
"WRITE"
],
"acl_categories": [
"KEYSPACE",
"DANGEROUS"
],
"command_tips": [
"NONDETERMINISTIC_OUTPUT"
],
"key_specs": [
{
"flags": [
"RW",
"ACCESS",
"DELETE"
],
"begin_search": {
"index": {
"pos": 3
}
},
"find_keys": {
"range": {
"lastkey": 0,
"step": 1,
"limit": 0
}
}
},
{
"flags": [
"RW",
"ACCESS",
"DELETE",
"INCOMPLETE"
],
"begin_search": {
"keyword": {
"keyword": "KEYS",
"startfrom": -2
}
},
"find_keys": {
"range": {
"lastkey": -1,
"step": 1,
"limit": 0
}
}
}
],
"arguments": [
{
"name": "host",
"type": "string"
},
{
"name": "port",
"type": "string"
},
{
"name": "key_or_empty_string",
"type": "oneof",
"arguments": [
{
"name": "key",
"type": "key",
"key_spec_index": 0
},
{
"name": "empty_string",
"type": "pure-token",
"token": "\"\""
}
]
},
{
"name": "destination-db",
"type": "integer"
},
{
"name": "timeout",
"type": "integer"
},
{
"name": "copy",
"token": "COPY",
"type": "pure-token",
"optional": true,
"since": "3.0.0"
},
{
"name": "replace",
"token": "REPLACE",
"type": "pure-token",
"optional": true,
"since": "3.0.0"
},
{
"token": "AUTH",
"name": "password",
"type": "string",
"optional": true,
"since": "4.0.7"
},
{
"token": "AUTH2",
"name": "username_password",
"type": "block",
"optional": true,
"since": "6.0.0",
"arguments": [
{
"name": "username",
"type": "string"
},
{
"name": "password",
"type": "string"
}
]
},
{
"token": "KEYS",
"name": "key",
"type": "key",
"key_spec_index": 1,
"optional": true,
"multiple": true,
"since": "3.0.6"
}
]
}
}