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

Allow to delete keys by the prefix #2628

Open
1 of 2 tasks
Taymindis opened this issue Oct 30, 2024 · 3 comments
Open
1 of 2 tasks

Allow to delete keys by the prefix #2628

Taymindis opened this issue Oct 30, 2024 · 3 comments
Labels
enhancement type enhancement good first issue Good for newcomers help wanted Good for newcomers

Comments

@Taymindis
Copy link

Taymindis commented Oct 30, 2024

Search before asking

  • I had searched in the issues and found no similar issues.

Motivation

  • Using Namespace in cluster mode to easily flush the keys .

Solution

  • As i knew namespace simply prepend the namespace prefix to the user key and remove it before retrieving. But it couldn't achieve with just simple key prefix.

we use the hash bracket like below, if our namespace is foo, and key is 1234, it will be successfully removed all the keys with same namespace.
{foo}:1234

Are you willing to submit a PR?

  • I'm willing to submit a PR!
@Taymindis Taymindis added the enhancement type enhancement label Oct 30, 2024
@git-hulk
Copy link
Member

@Taymindis Delete keys with the specified prefix would be easy in Kvrocks, but Redis now doesn't have a command for this and we need to invent one if we would like to support this. What do you think? @apache/kvrocks-committers

@git-hulk git-hulk changed the title Namespace for cluster mode. Allow to delete keys by the prefix Oct 30, 2024
@ShooterIT
Copy link
Member

As all keys are sorted by lexicographic order in kvrocks, maybe we can think of a set of commands about key prefix operation, of course, deleting keys by the prefix.
oh scan already supports key pattern, but kvrocks is faster than expected

@git-hulk
Copy link
Member

git-hulk commented Oct 30, 2024

oh scan already supports key pattern, but kvrocks is faster than expected

@ShooterIT Yes, another fast path is to use DeleteRange for the deletion command.

@PragmaTwice PragmaTwice added help wanted Good for newcomers good first issue Good for newcomers labels Nov 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement type enhancement good first issue Good for newcomers help wanted Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants