kvrocks icon indicating copy to clipboard operation
kvrocks copied to clipboard

Add support of the command COPY

Open PragmaTwice opened this issue 1 year ago • 9 comments

Refer to https://redis.io/commands/copy/

PragmaTwice avatar Dec 18 '23 15:12 PragmaTwice

I want to try. Can you assign this to me?

Qiaolin-Yu avatar Dec 18 '23 19:12 Qiaolin-Yu

Sure! Assigned.

PragmaTwice avatar Dec 19 '23 13:12 PragmaTwice

May I know where I should write my unit tests?

Qiaolin-Yu avatar Dec 20 '23 01:12 Qiaolin-Yu

@Qiaolin-Yu It's good to add Go tests only.

git-hulk avatar Dec 20 '23 01:12 git-hulk

By the way, for the optional part [DB destination-db], what should I do to write the KV to the destination-db? Should I use RedisWriter::selectDB to implement?

Qiaolin-Yu avatar Dec 20 '23 03:12 Qiaolin-Yu

Hi @Qiaolin-Yu , according to my observation KVROCKS doesn't have DB instead you can use namespace concept. Please verify with @git-hulk and @PragmaTwice

MaheshMadushan avatar Jan 28 '24 10:01 MaheshMadushan

@MaheshMadushan You're right. The RENAME command also has similar issue, so we can use the namespace in those commands.

git-hulk avatar Jan 28 '24 12:01 git-hulk

@MaheshMadushan You're right. The RENAME command also has similar issue, so we can use the namespace in those commands.

@git-hulk Maybe not the RENAME command, but the MOVE command

jihuayu avatar Jan 28 '24 23:01 jihuayu

@jihuayu Sorry for the wrong information. Yes, that's MOVE command instead of RENAME.

git-hulk avatar Jan 29 '24 01:01 git-hulk

By the way, for the optional part [DB destination-db], what should I do to write the KV to the destination-db? Should I use RedisWriter::selectDB to implement?

@Qiaolin-Yu Hi, are you still working on this issue?

Chiro11 avatar Apr 08 '24 08:04 Chiro11

@git-hulk I think you can assign it to me now 'cause he hasn't responded for two months. This cmd is similar to MOVE and RENAME, suitable for me.

Chiro11 avatar Apr 09 '24 12:04 Chiro11

@Chiro11 Thank you!

git-hulk avatar Apr 09 '24 12:04 git-hulk

@git-hulk To adapt to kvrocks, it may need to make minor modifications. redis ver: COPY source destination [DB destination-db] [REPLACE] I think we can replace 'DB' with 'NS'/'NAMESPACE'/'TO', or keep it, and replace destination-db to token. What do you think?

Chiro11 avatar Apr 09 '24 12:04 Chiro11

@Chiro11 Perhaps we can support the [DB](DB must be 0) first and copy between namespaces should be implemented as COPYX.

git-hulk avatar Apr 09 '24 13:04 git-hulk