Details
-
Improvement
-
Resolution: Won't Do
-
Critical
-
None
-
3.0
-
Security Level: Public
-
None
-
All
Description
Currently we support per key call for getMetaData. As a result our verification requires per key fetch during verification phase. This request is to support for get bulk meta data call which can get us meta data per vbucket for all keys or in batches. This would help enhance our verification ability for meta data per documents over time or after operations like rebalance, as it will be faster. If there is a better alternative, please recommend.
Current Behavior
https://github.com/couchbase/ep-engine/blob/master/src/ep.cc
ENGINE_ERROR_CODE EventuallyPersistentStore::getMetaData(
|
const std::string &key,
|
uint16_t vbucket,
|
const void *cookie,
|
ItemMetaData &metadata,
|
uint32_t &deleted,
|
bool trackReferenced)
|
{
|
(void) cookie;
|
RCPtr<VBucket> vb = getVBucket(vbucket);
|
if (!vb || vb->getState() == vbucket_state_dead ||
|
vb->getState() == vbucket_state_replica) {
|
++stats.numNotMyVBuckets;
|
return ENGINE_NOT_MY_VBUCKET;
|
}
|
|
int bucket_num(0);
|
deleted = 0;
|
LockHolder lh = vb->ht.getLockedBucket(key, &bucket_num);
|
StoredValue *v = vb->ht.unlocked_find(key, bucket_num, true,
|
trackReferenced);
|
|
if (v) {
|
stats.numOpsGetMeta++;
|
|
if (v->isTempInitialItem()) { // Need bg meta fetch.
|
bgFetch(key, vbucket, -1, cookie, true);
|
return ENGINE_EWOULDBLOCK;
|
} else if (v->isTempNonExistentItem()) {
|
metadata.cas = v->getCas();
|
return ENGINE_KEY_ENOENT;
|
} else {
|
if (v->isTempDeletedItem() || v->isDeleted() ||
|
v->isExpired(ep_real_time())) {
|
deleted |= GET_META_ITEM_DELETED_FLAG;
|
}
|
metadata.cas = v->getCas();
|
metadata.flags = v->getFlags();
|
metadata.exptime = v->getExptime();
|
metadata.revSeqno = v->getRevSeqno();
|
return ENGINE_SUCCESS;
|
}
|
} else {
|
// The key wasn't found. However, this may be because it was previously
|
// deleted or evicted with the full eviction strategy.
|
// So, add a temporary item corresponding to the key to the hash table
|
// and schedule a background fetch for its metadata from the persistent
|
// store. The item's state will be updated after the fetch completes.
|
return addTempItemForBgFetch(lh, bucket_num, key, vb, cookie, true);
|
}
|
}
|