]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
MonitorDBStore, LevelDBStore, RocksDBStore: make sure the provided bl is empty 7052/head
authorPiotr Dałek <piotr.dalek@ts.fujitsu.com>
Thu, 24 Dec 2015 14:51:14 +0000 (15:51 +0100)
committerPiotr Dałek <piotr.dalek@ts.fujitsu.com>
Sat, 26 Dec 2015 23:29:51 +0000 (00:29 +0100)
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>
src/kv/LevelDBStore.cc
src/kv/RocksDBStore.cc
src/mon/MonitorDBStore.h

index 0056c4aa13c90b56a55ca9cbf3305700dd04ce2c..9c325b18ebe9c6dc43d6bda77a0fa3b6a4b531f5 100644 (file)
@@ -267,6 +267,7 @@ int LevelDBStore::get(const string &prefix,
                  const string &key,
                  bufferlist *value)
 {
+  assert(value && (value->length() == 0));
   utime_t start = ceph_clock_now(g_ceph_context);
   int r = 0;
   KeyValueDB::Iterator it = get_iterator(prefix);
index b4b9253153454a0e8f6358a235f35869b904c259..9aad45282ea48ba120b26ddb0ddc0fdc45123654 100644 (file)
@@ -366,6 +366,7 @@ int RocksDBStore::get(
     const string &key,
     bufferlist *out)
 {
+  assert(out && (out->length() == 0));
   utime_t start = ceph_clock_now(g_ceph_context);
   int r = 0;
   KeyValueDB::Iterator it = get_iterator(prefix);
index 6bb35e4e11e854c4029d4c671a6e41201d04da67..6e9038e368501d1e3e9365cc17020162b63df58f 100644 (file)
@@ -507,6 +507,7 @@ class MonitorDBStore
   }
 
   int get(const string& prefix, const string& key, bufferlist& bl) {
+    assert(bl.length() == 0);
     return db->get(prefix, key, &bl);
   }