- 
                Notifications
    You must be signed in to change notification settings 
- Fork 579
feat: Add support of the command Migrate #2863
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: unstable
Are you sure you want to change the base?
Conversation
45680b6    to
    c862ea1      
    Compare
  
            
          
                src/commands/cmd_server.cc
              
                Outdated
          
        
      | static Status DumpKey(engine::Context &ctx, Server *srv, Connection *conn, std::string &key, | ||
| std::string &dump_result) { | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| static Status DumpKey(engine::Context &ctx, Server *srv, Connection *conn, std::string &key, | |
| std::string &dump_result) { | |
| static StatusOr<std::string> DumpKey(engine::Context &ctx, Server *srv, Connection *conn, std::string &key) { | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when I run ./x.py format, it automatically becomes two lines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean we can use StatusOr here instead of Status.
        
          
                src/commands/cmd_server.cc
              
                Outdated
          
        
      | MakeCmdAttr<CommandDump>("dump", 2, "read-only", 1, 1, 1), | ||
| MakeCmdAttr<CommandPollUpdates>("pollupdates", -2, "read-only admin", NO_KEY), ) | ||
| MakeCmdAttr<CommandPollUpdates>("pollupdates", -2, "read-only admin", NO_KEY), | ||
| MakeCmdAttr<CommandMigrate>("migrate", -6, "write", 1, 1, 1)) | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| MakeCmdAttr<CommandMigrate>("migrate", -6, "write", 1, 1, 1)) | |
| MakeCmdAttr<CommandMigrate>("migrate", 6, "write", 1, 1, 1)) | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also the key position spec is wrong (1,1,1).
c862ea1    to
    62dfd77      
    Compare
  
    | MakeCmdAttr<CommandDump>("dump", 2, "read-only", 1, 1, 1), | ||
| MakeCmdAttr<CommandPollUpdates>("pollupdates", -2, "read-only admin", NO_KEY), ) | ||
| MakeCmdAttr<CommandPollUpdates>("pollupdates", -2, "read-only admin", NO_KEY), | ||
| MakeCmdAttr<CommandMigrate>("migrate", -6, "write", 1, -1, 1)) | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1, -1, 1 means that all arguments are keys, which is obviously not correct here.
You can refer to here for how to generate dynamic key ranges: https://github.com/apache/kvrocks/blob/unstable/src/commands/cmd_zset.cc#L1552
Close #1949
Command Desc:
Redis doc: https://redis.io/docs/latest/commands/migrate/