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

For the expired key, the TYPE command returns dirty data #1278

Closed
2 tasks done
jjz921024 opened this issue Feb 24, 2023 · 3 comments · Fixed by #1286
Closed
2 tasks done

For the expired key, the TYPE command returns dirty data #1278

jjz921024 opened this issue Feb 24, 2023 · 3 comments · Fixed by #1286
Assignees
Labels
bug type bug good first issue Good for newcomers

Comments

@jjz921024
Copy link
Contributor

jjz921024 commented Feb 24, 2023

Search before asking

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

Version

kvrocks v2.3.0

Minimal reproduce step

127.0.0.1:31001> set k v ex 10
OK
127.0.0.1:31001> type k
"string"
127.0.0.1:31001> ttl k
(integer) 3
127.0.0.1:31001> ttl k
(integer) -2
127.0.0.1:31001> type k
"string"
127.0.0.1:31001> get k
(nil)
127.0.0.1:31001> type k
"string"

What did you expect to see?

None should been returned for the expired key

What did you see instead?

For the expired key, the TYPE command returns dirty data

Anything Else?

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!
@jjz921024 jjz921024 added the bug type bug label Feb 24, 2023
@git-hulk
Copy link
Member

@jjz921024 Thanks for your good catch.

@git-hulk git-hulk added the good first issue Good for newcomers label Feb 24, 2023
@ghost
Copy link

ghost commented Feb 26, 2023

rocksdb has a feature whereby an expired key is not removed immediately but during compaction. If the size of a specific level is not large enough to trigger compaction, the old data remains. Compacting manually is one possible solution, but it may cause write stalls

@git-hulk
Copy link
Member

Hi @Lericaro

This bug was caused by the type command didn't check the expiry time, and it's OK to recycle those expired items later by compaction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug type bug good first issue Good for newcomers
Projects
None yet
2 participants