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

kv: implement value_as_ptr() and use it in .get() #7052

Merged
merged 2 commits into from Jan 6, 2016

Commits on Dec 24, 2015

  1. kv: implement value_as_ptr() and use it in .get()

    Current .get() methods return values as bufferlists, which are replacing
    bufferlists provided by caller. This is particularly inefficient with
    MonitorDBStore, because its get() method uses its own temporary bufferlist
    which is then appended to bufferlist provided by MonitorDBStore user.
    This changeset:
     - adds value_as_ptr() which returns just a bufferptr
     - modifies *DBStore.get() methods to append returned bufferptr to provided
       bufferlist instead of replacing it
     - modifies mondbstore to pass provided bufferlist as target for underlying
       .get() method, instead of providing its own and appending it to one given
       by caller.
    
    This reduces CPU usage of *DBStore.get() methods by up to 5% (particularly
    visible with MonitorDBStore, which doesn't use two temporary bufferlists
    anymore).
    
    Signed-off-by: Piotr Dałek <piotr.dalek@ts.fujitsu.com>
    Piotr Dałek committed Dec 24, 2015
    Copy the full SHA
    4efa214 View commit details
    Browse the repository at this point in the history

Commits on Dec 26, 2015

  1. MonitorDBStore, LevelDBStore, RocksDBStore: make sure the provided bl…

    … is empty
    
    If it's not, data will be appended to the end of bufferlist and difficult
    to spot bugs might arise, so fail hard in that case.
    
    Signed-off-by: Piotr Dałek <piotr.dalek@ts.fujitsu.com>
    Piotr Dałek committed Dec 26, 2015
    Copy the full SHA
    9b686c3 View commit details
    Browse the repository at this point in the history