@@ -146,12 +146,11 @@ GetValue RocksDBKVStore::get(const DocKey& key, uint16_t vb, bool fetchDelete) {
146146 return getWithHeader (nullptr , key, vb, GetMetaOnly::No, fetchDelete);
147147}
148148
149- GetValue RocksDBKVStore::getWithHeader (
150- void * dbHandle,
151- const DocKey& key,
152- uint16_t vb,
153- GetMetaOnly getMetaOnly, // TODO RDB: get meta only
154- bool fetchDelete) {
149+ GetValue RocksDBKVStore::getWithHeader (void * dbHandle,
150+ const DocKey& key,
151+ uint16_t vb,
152+ GetMetaOnly getMetaOnly,
153+ bool fetchDelete) {
155154 std::string k (mkKeyStr (vb, key));
156155 std::string value;
157156
@@ -160,7 +159,7 @@ GetValue RocksDBKVStore::getWithHeader(
160159 if (!s.ok ()) {
161160 return GetValue{NULL , ENGINE_KEY_ENOENT};
162161 }
163- return makeGetValue (vb, key, value);
162+ return makeGetValue (vb, key, value, getMetaOnly );
164163}
165164
166165void RocksDBKVStore::getMulti (uint16_t vb, vb_bgfetch_queue_t & itms) {
@@ -171,7 +170,8 @@ void RocksDBKVStore::getMulti(uint16_t vb, vb_bgfetch_queue_t& itms) {
171170 std::string value;
172171 rocksdb::Status s = db->Get (rocksdb::ReadOptions (), vbAndKey, &value);
173172 if (s.ok ()) {
174- it.second .value = makeGetValue (vb, key, value);
173+ it.second .value =
174+ makeGetValue (vb, key, value, it.second .isMetaOnly );
175175 GetValue* rv = &it.second .value ;
176176 for (auto & fetch : it.second .bgfetched_list ) {
177177 fetch->value = rv;
@@ -312,7 +312,8 @@ rocksdb::Slice RocksDBKVStore::mkValSlice(const Item& item) {
312312
313313std::unique_ptr<Item> RocksDBKVStore::grokValSlice (uint16_t vb,
314314 const DocKey& key,
315- const rocksdb::Slice& s) {
315+ const rocksdb::Slice& s,
316+ GetMetaOnly getMetaOnly) {
316317 // Reverse of mkValSlice - deserialize back into an Item.
317318
318319 assert (s.size () >= sizeof (ItemMetaData) + sizeof (uint64_t ) +
@@ -342,11 +343,13 @@ std::unique_ptr<Item> RocksDBKVStore::grokValSlice(uint16_t vb,
342343 uint8_t extMeta[EXT_META_LEN];
343344 extMeta[0 ] = datatype;
344345
346+ bool includeValue = getMetaOnly == GetMetaOnly::No && valueLen;
347+
345348 auto item = std::make_unique<Item>(key,
346349 meta.flags ,
347350 meta.exptime ,
348- src,
349- valueLen,
351+ includeValue ? src : nullptr ,
352+ includeValue ? valueLen : 0 ,
350353 extMeta,
351354 EXT_META_LEN,
352355 meta.cas ,
@@ -363,9 +366,11 @@ std::unique_ptr<Item> RocksDBKVStore::grokValSlice(uint16_t vb,
363366
364367GetValue RocksDBKVStore::makeGetValue (uint16_t vb,
365368 const DocKey& key,
366- const std::string& value) {
369+ const std::string& value,
370+ GetMetaOnly getMetaOnly) {
367371 rocksdb::Slice sval (value);
368- return GetValue (grokValSlice (vb, key, sval), ENGINE_SUCCESS, -1 , 0 );
372+ return GetValue (
373+ grokValSlice (vb, key, sval, getMetaOnly), ENGINE_SUCCESS, -1 , 0 );
369374}
370375
371376ScanContext* RocksDBKVStore::initScanContext (
0 commit comments