Skip to content
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

Add support of the command MOVEX #2225

Merged
merged 13 commits into from
Apr 7, 2024
Merged

Add support of the command MOVEX #2225

merged 13 commits into from
Apr 7, 2024

Conversation

Chiro11
Copy link
Contributor

@Chiro11 Chiro11 commented Apr 5, 2024

Close #1950
Some desc:

  • MOVE key db is treated as dummy command, to be compatible with Redis.
  • MOVEX key ns_token moves a key to new namespace.
    1. When namespace does not correspond to token, report an error.
    2. Do not support when requirepass is empty, report an error.
    3. When the source key does not exist or the target key already exists, return 0, otherwise, return 1.

@jihuayu
Copy link
Member

jihuayu commented Apr 6, 2024

Hi @Chiro11, thanks for your PR.
In the issues, we think we need to add a new command. Can you move the code to a new command?
#1950 (comment)

@Chiro11
Copy link
Contributor Author

Chiro11 commented Apr 6, 2024

Hi @Chiro11, thanks for your PR. In the issues, we think we need to add a new command. Can you move the code to a new command? #1950 (comment)

You mean to use a new name? Do you have any idea?

@jihuayu
Copy link
Member

jihuayu commented Apr 6, 2024

Hi @Chiro11, thanks for your PR. In the issues, we think we need to add a new command. Can you move the code to a new command? #1950 (comment)

You mean to use a new name? Do you have any idea?

Yes. @git-hulk @PragmaTwice @mapleFU @enjoy-binbin Do you have some idea about new command name?

@git-hulk
Copy link
Member

git-hulk commented Apr 6, 2024

Hi @Chiro11, thanks for your PR. In the issues, we think we need to add a new command. Can you move the code to a new command? #1950 (comment)

You mean to use a new name? Do you have any idea?

Yes. @git-hulk @PragmaTwice @mapleFU @enjoy-binbin Do you have some idea about new command name?

Perhaps MOVEX is a good name for aligning with the CLUSTERX command.

@Chiro11
Copy link
Contributor Author

Chiro11 commented Apr 6, 2024

Hi @Chiro11, thanks for your PR. In the issues, we think we need to add a new command. Can you move the code to a new command? #1950 (comment)

You mean to use a new name? Do you have any idea?

Yes. @git-hulk @PragmaTwice @mapleFU @enjoy-binbin Do you have some idea about new command name?

Perhaps MOVEX is a good name for aligning with the CLUSTERX command.

@jihuayu @git-hulk Modified as suggested.

@Chiro11 Chiro11 changed the title Add support of the command MOVE Add support of the command MOVEX Apr 6, 2024
src/storage/redis_db.cc Outdated Show resolved Hide resolved
src/commands/cmd_key.cc Show resolved Hide resolved
@git-hulk
Copy link
Member

git-hulk commented Apr 6, 2024

@Chiro11 Thanks for your efforts and quick response.

Copy link
Member

@jihuayu jihuayu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your code. @Chiro11
This PR contains a lot of refactoring unrelated to the movex command. Could you please move it to a new PR?

src/storage/redis_db.h Outdated Show resolved Hide resolved
@git-hulk
Copy link
Member

git-hulk commented Apr 7, 2024

Rest are good to me, one comment inline.

@PragmaTwice
Copy link
Member

MOVEX key ns_name ns_token

I think here the ns_name is useless.

@Chiro11
Copy link
Contributor Author

Chiro11 commented Apr 7, 2024

MOVEX key ns_name ns_token

I think here the ns_name is useless.

Theoretically it is. But I think this is more clear. @git-hulk @jihuayu What are the opinions of you two?

@Chiro11
Copy link
Contributor Author

Chiro11 commented Apr 7, 2024

Thank you for your code. @Chiro11 This PR contains a lot of refactoring unrelated to the movex command. Could you please move it to a new PR?

@jihuayu I think it's basically ok. Just some typos and best practices.

@git-hulk
Copy link
Member

git-hulk commented Apr 7, 2024

MOVEX key ns_name ns_token
I think here the ns_name is useless.

Theoretically it is. But I think this is more clear. @git-hulk @jihuayu What are the opinions of you two?

The point of @PragmaTwice is we can find the ns by the token, so it's unnecessary to pass the namespace in the command arguments.

@Chiro11
Copy link
Contributor Author

Chiro11 commented Apr 7, 2024

MOVEX key ns_name ns_token
I think here the ns_name is useless.

Theoretically it is. But I think this is more clear. @git-hulk @jihuayu What are the opinions of you two?

The point of @PragmaTwice is we can find the ns by the token, so it's unnecessary to pass the namespace in the command arguments.

I know. But I think MOVEX key token is a bit strange. I think it's reasonable to have a clear namespace. But I'm actually okay with both. Depends on you.

@git-hulk
Copy link
Member

git-hulk commented Apr 7, 2024

@Chiro11 So let's remove it if you feel good about this.

@Chiro11 Chiro11 requested review from git-hulk and jihuayu April 7, 2024 12:01
Copy link

sonarcloud bot commented Apr 7, 2024

@git-hulk git-hulk merged commit b60ccb3 into apache:unstable Apr 7, 2024
31 checks passed
@Chiro11 Chiro11 deleted the move branch April 7, 2024 14:30
@jihuayu
Copy link
Member

jihuayu commented Apr 7, 2024

Thanks @Chiro11. Good job! Can you add this command to our website?
https://kvrocks.apache.org/docs/supported-commands#key-commands

If you're willing, can you work for #2229?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support of the command MOVE
4 participants