Discussion:
[leveldb] [using leveldb problem] what is the different between db->get (key) and db->NewIterator(), iter->seek(key) ?
p***@gmail.com
2018-03-20 13:37:05 UTC
Permalink
Ceph(https://github.com/ceph/ceph) Project using leveldb to store monitor
data.

Recently I have found that my store db is getting larger and larger to be
60GB size.

After I send command "compactrange(NULL, NULL)", the size of the store db
is only 100MB.

In the ceph documents, it has claims that the monitor store can be getting
large but do not explain why.

I then review the ceph code ,and find that ceph monitor write keys
increasing one at a time. After increasing 750 keys, it reclaims 250 older
keys and

send a compactrange(from, to) command asynchronously.

In ceph monitor code ,when it get one key, it use db->NewIterator ,
iter->seek(key) method, not db->get(key) function. I can not understand why
not using db->get(key), it is simple and easy to understand.

I tried to replace db->NewIterator with db->get(key) but sometimes I got a
deleted value. It's just surprising!

Can anyone explain the different between db->NewIterator and db->get(key)
when getting a key value?
--
You received this message because you are subscribed to the Google Groups "leveldb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leveldb+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
p***@gmail.com
2018-03-21 00:50:29 UTC
Permalink
I forget to say that My leveldb version is 1.7.0.
Post by p***@gmail.com
Ceph(https://github.com/ceph/ceph) Project using leveldb to store
monitor data.
Recently I have found that my store db is getting larger and larger to be
60GB size.
After I send command "compactrange(NULL, NULL)", the size of the store db
is only 100MB.
In the ceph documents, it has claims that the monitor store can be getting
large but do not explain why.
I then review the ceph code ,and find that ceph monitor write keys
increasing one at a time. After increasing 750 keys, it reclaims 250 older
keys and
send a compactrange(from, to) command asynchronously.
In ceph monitor code ,when it get one key, it use db->NewIterator ,
iter->seek(key) method, not db->get(key) function. I can not understand why
not using db->get(key), it is simple and easy to understand.
I tried to replace db->NewIterator with db->get(key) but sometimes I got a
deleted value. It's just surprising!
Can anyone explain the different between db->NewIterator and db->get(key)
when getting a key value?
--
You received this message because you are subscribed to the Google Groups "leveldb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leveldb+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...