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

[BUG] dbsize return wrong value #275

Closed
hellower opened this issue May 26, 2021 · 3 comments
Closed

[BUG] dbsize return wrong value #275

hellower opened this issue May 26, 2021 · 3 comments

Comments

@hellower
Copy link

hellower commented May 26, 2021

##################

redis

##################
127.0.0.1:6379> keys *

  1. "a"
  2. "tntchecker"
  3. "b"
    127.0.0.1:6379> dbsize <========== keys count
    (integer) 3
    127.0.0.1:6379> info keyspace
    -# Keyspace
    db0:keys=3,expires=0,avg_ttl=0 <======== keys=3

##################

kvrocks

##################
127.0.0.1:6666> keys *

  1. "a"
  2. "tntchecker"
  3. "b"
    127.0.0.1:6666> dbsize <========== keys count
    (integer) 0 <======= always return 0!!
    127.0.0.1:6666> info keyspace
    -# Keyspace
    -# Last scan db time: Thu Jan 1 00:00:00 1970
    db0:keys=0,expires=0,avg_ttl=0,expired=0 <===== keys 0
    sequence:38283437
    used_db_size:603247462
    max_db_size:0
    used_percent: 0%
    disk_capacity:322110992384
    used_disk_size:161157144576
    used_disk_percent: 50%
@hellower hellower changed the title [BUG] dbsize return wrong values [BUG] dbsize return wrong value May 26, 2021
@git-hulk
Copy link
Member

git-hulk commented May 26, 2021

Thanks for your report, it's not a bug actually, the kvrocks key-values were stored in disk, and find out expired keys was impossible unless we can scan it. So we MUST execute the dbsize scan command to async scan the DB for finding out the key number.

@hellower
Copy link
Author

Thanks!
and Thank you for nice KVROCKS open source.

@ShooterIT
Copy link
Member

Also welcome you to join in improving kvrocks 😄

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

No branches or pull requests

3 participants