Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix build errors with gcc 4.6.

With gcc 4.6 there were plenty of warnings (treated as errors) related to name
shadowing (mostly variables named 'item' shadowing memcached's type
'item'). Renamed those conflicting definitions trying to use the names
already present in the project.

Conflicts:
	ep_engine.cc
	ep_engine.h

Change-Id: Icd6fca933a6018f0b1b98e5efe6b7076b33fc48c
Reviewed-on: http://review.couchbase.org/8352
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Chiyoung Seo <chiyoung.seo@gmail.com>
  • Loading branch information...
commit d0ade99edb5474e73ded7bc1443f2645f31c3181 1 parent 901d1e4
@aartamonau aartamonau authored chiyoung committed
View
20 checkpoint.cc
@@ -23,13 +23,13 @@ uint64_t Checkpoint::getCasForKey(const std::string &key) {
return cas;
}
-queue_dirty_t Checkpoint::queueDirty(const queued_item &item, CheckpointManager *checkpointManager) {
+queue_dirty_t Checkpoint::queueDirty(const queued_item &qi, CheckpointManager *checkpointManager) {
assert (checkpointState == opened);
uint64_t newMutationId = checkpointManager->nextMutationId();
queue_dirty_t rv;
- checkpoint_index::iterator it = keyIndex.find(item->getKey());
+ checkpoint_index::iterator it = keyIndex.find(qi->getKey());
// Check if this checkpoint already had an item for the same key.
if (it != keyIndex.end()) {
std::list<queued_item>::iterator currPos = it->second.position;
@@ -73,27 +73,27 @@ queue_dirty_t Checkpoint::queueDirty(const queued_item &item, CheckpointManager
}
}
// Copy the queued time of the existing item to the new one.
- item->setQueuedTime((*currPos)->getQueuedTime());
+ qi->setQueuedTime((*currPos)->getQueuedTime());
// Remove the existing item for the same key from the list.
toWrite.erase(currPos);
rv = EXISTING_ITEM;
} else {
- if (item->getKey().size() > 0) {
+ if (qi->getKey().size() > 0) {
++numItems;
}
rv = NEW_ITEM;
}
// Push the new item into the list
- toWrite.push_back(item);
+ toWrite.push_back(qi);
- if (item->getKey().size() > 0) {
+ if (qi->getKey().size() > 0) {
std::list<queued_item>::iterator last = toWrite.end();
// --last is okay as the list is not empty now.
index_entry entry = {--last, newMutationId};
// Set the index of the key to the new item that is pushed back into the list.
- keyIndex[item->getKey()] = entry;
+ keyIndex[qi->getKey()] = entry;
if (rv == NEW_ITEM) {
- size_t newEntrySize = item->getKey().size() + sizeof(index_entry);
+ size_t newEntrySize = qi->getKey().size() + sizeof(index_entry);
indexMemOverhead += newEntrySize;
stats.memOverhead.incr(newEntrySize);
assert(stats.memOverhead.get() < GIGANTOR);
@@ -481,7 +481,7 @@ size_t CheckpointManager::removeClosedUnrefCheckpoints(const RCPtr<VBucket> &vbu
return numUnrefItems;
}
-bool CheckpointManager::queueDirty(const queued_item &item, const RCPtr<VBucket> &vbucket) {
+bool CheckpointManager::queueDirty(const queued_item &qi, const RCPtr<VBucket> &vbucket) {
LockHolder lh(queueLock);
if (vbucket->getState() != vbucket_state_active &&
checkpointList.back()->getState() == closed) {
@@ -494,7 +494,7 @@ bool CheckpointManager::queueDirty(const queued_item &item, const RCPtr<VBucket>
// The current open checkpoint should be always the last one in the checkpoint list.
assert(checkpointList.back()->getState() == opened);
size_t numItemsBefore = getNumItemsForPersistence_UNLOCKED();
- if (checkpointList.back()->queueDirty(item, this) == NEW_ITEM) {
+ if (checkpointList.back()->queueDirty(qi, this) == NEW_ITEM) {
++numItems;
}
size_t numItemsAfter = getNumItemsForPersistence_UNLOCKED();
View
56 ep.cc
@@ -296,7 +296,7 @@ class VBucketDeletionCallback : public DispatcherCallback {
bool callback(Dispatcher &d, TaskId t) {
bool rv = false, isLastChunk = false;
- chunk_range range;
+ chunk_range_t range;
if (current_range == range_list.end()) {
range.first = -1;
range.second = -1;
@@ -386,7 +386,7 @@ class VBucketDeletionCallback : public DispatcherCallback {
hrtime_t execution_time;
hrtime_t start_wall_time;
VBDeletionChunkRangeList range_list;
- chunk_range_iterator current_range;
+ chunk_range_iterator_t current_range;
};
EventuallyPersistentStore::EventuallyPersistentStore(EventuallyPersistentEngine &theEngine,
@@ -764,11 +764,11 @@ protocol_binary_response_status EventuallyPersistentStore::evictKey(const std::s
return rv;
}
-ENGINE_ERROR_CODE EventuallyPersistentStore::set(const Item &item,
+ENGINE_ERROR_CODE EventuallyPersistentStore::set(const Item &itm,
const void *cookie,
bool force) {
- RCPtr<VBucket> vb = getVBucket(item.getVBucketId());
+ RCPtr<VBucket> vb = getVBucket(itm.getVBucketId());
if (!vb || vb->getState() == vbucket_state_dead) {
++stats.numNotMyVBuckets;
return ENGINE_NOT_MY_VBUCKET;
@@ -787,10 +787,10 @@ ENGINE_ERROR_CODE EventuallyPersistentStore::set(const Item &item,
}
}
- bool cas_op = (item.getCas() != 0);
+ bool cas_op = (itm.getCas() != 0);
int64_t row_id = -1;
- mutation_type_t mtype = vb->ht.set(item, row_id);
+ mutation_type_t mtype = vb->ht.set(itm, row_id);
ENGINE_ERROR_CODE ret = ENGINE_SUCCESS;
switch (mtype) {
@@ -810,8 +810,8 @@ ENGINE_ERROR_CODE EventuallyPersistentStore::set(const Item &item,
case WAS_DIRTY:
// Even if the item was dirty, push it into the vbucket's open checkpoint.
case WAS_CLEAN:
- queueDirty(item.getKey(), item.getVBucketId(), queue_op_set, item.getValue(),
- item.getFlags(), item.getExptime(), item.getCas(), row_id);
+ queueDirty(itm.getKey(), itm.getVBucketId(), queue_op_set, itm.getValue(),
+ itm.getFlags(), itm.getExptime(), itm.getCas(), row_id);
break;
case INVALID_VBUCKET:
ret = ENGINE_NOT_MY_VBUCKET;
@@ -821,10 +821,10 @@ ENGINE_ERROR_CODE EventuallyPersistentStore::set(const Item &item,
return ret;
}
-ENGINE_ERROR_CODE EventuallyPersistentStore::add(const Item &item,
+ENGINE_ERROR_CODE EventuallyPersistentStore::add(const Item &itm,
const void *cookie)
{
- RCPtr<VBucket> vb = getVBucket(item.getVBucketId());
+ RCPtr<VBucket> vb = getVBucket(itm.getVBucketId());
if (!vb || vb->getState() == vbucket_state_dead || vb->getState() == vbucket_state_replica) {
++stats.numNotMyVBuckets;
return ENGINE_NOT_MY_VBUCKET;
@@ -840,36 +840,36 @@ ENGINE_ERROR_CODE EventuallyPersistentStore::add(const Item &item,
}
}
- if (item.getCas() != 0) {
+ if (itm.getCas() != 0) {
// Adding with a cas value doesn't make sense..
return ENGINE_NOT_STORED;
}
- switch (vb->ht.add(item)) {
+ switch (vb->ht.add(itm)) {
case ADD_NOMEM:
return ENGINE_ENOMEM;
case ADD_EXISTS:
return ENGINE_NOT_STORED;
case ADD_SUCCESS:
case ADD_UNDEL:
- queueDirty(item.getKey(), item.getVBucketId(), queue_op_set, item.getValue(),
- item.getFlags(), item.getExptime(), item.getCas(), -1);
+ queueDirty(itm.getKey(), itm.getVBucketId(), queue_op_set, itm.getValue(),
+ itm.getFlags(), itm.getExptime(), itm.getCas(), -1);
}
return ENGINE_SUCCESS;
}
-ENGINE_ERROR_CODE EventuallyPersistentStore::addTAPBackfillItem(const Item &item) {
+ENGINE_ERROR_CODE EventuallyPersistentStore::addTAPBackfillItem(const Item &itm) {
- RCPtr<VBucket> vb = getVBucket(item.getVBucketId());
+ RCPtr<VBucket> vb = getVBucket(itm.getVBucketId());
if (!vb || vb->getState() == vbucket_state_dead || vb->getState() == vbucket_state_active) {
++stats.numNotMyVBuckets;
return ENGINE_NOT_MY_VBUCKET;
}
- bool cas_op = (item.getCas() != 0);
+ bool cas_op = (itm.getCas() != 0);
int64_t row_id = -1;
- mutation_type_t mtype = vb->ht.set(item, row_id);
+ mutation_type_t mtype = vb->ht.set(itm, row_id);
ENGINE_ERROR_CODE ret = ENGINE_SUCCESS;
switch (mtype) {
@@ -890,8 +890,8 @@ ENGINE_ERROR_CODE EventuallyPersistentStore::addTAPBackfillItem(const Item &item
}
// FALLTHROUGH
case WAS_CLEAN:
- queueDirty(item.getKey(), item.getVBucketId(), queue_op_set, item.getValue(),
- item.getFlags(), item.getExptime(), item.getCas(), row_id, true);
+ queueDirty(itm.getKey(), itm.getVBucketId(), queue_op_set, itm.getValue(),
+ itm.getFlags(), itm.getExptime(), itm.getCas(), row_id, true);
break;
case INVALID_VBUCKET:
ret = ENGINE_NOT_MY_VBUCKET;
@@ -1834,11 +1834,11 @@ protocol_binary_response_status EventuallyPersistentStore::revertOnlineUpdate(RC
// For this, traverse the array from the last element.
uint64_t total = 0;
for(; reverse_it != item_list.rend(); ++reverse_it, ++total) {
- queued_item item = *reverse_it;
+ queued_item qi = *reverse_it;
- ret = item_set.insert(item);
+ ret = item_set.insert(qi);
- vb->doStatsForFlushing(*item, item->size());
+ vb->doStatsForFlushing(*qi, qi->size());
}
item_list.assign(item_set.begin(), item_set.end());
@@ -2212,13 +2212,13 @@ void EventuallyPersistentStore::queueDirty(const std::string &key,
exptime, cas);
}
- queued_item item(qi);
+ queued_item itm(qi);
bool rv = tapBackfill ?
- vb->queueBackfillItem(item) : vb->checkpointManager.queueDirty(item, vb);
+ vb->queueBackfillItem(itm) : vb->checkpointManager.queueDirty(itm, vb);
if (rv) {
++stats.queue_size;
++stats.totalEnqueued;
- vb->doStatsForQueueing(*item, item->size());
+ vb->doStatsForQueueing(*itm, itm->size());
}
}
}
@@ -2438,8 +2438,8 @@ void TransactionContext::commit() {
numUncommittedItems = 0;
}
-void TransactionContext::addUncommittedItem(const queued_item &item) {
- uncommittedItems.push_back(item);
+void TransactionContext::addUncommittedItem(const queued_item &qi) {
+ uncommittedItems.push_back(qi);
++numUncommittedItems;
}
View
38 ep.hh
@@ -93,8 +93,8 @@ protected:
RCPtr<VBucket> currentBucket;
};
-typedef std::pair<int64_t, int64_t> chunk_range;
-typedef std::list<chunk_range>::iterator chunk_range_iterator;
+typedef std::pair<int64_t, int64_t> chunk_range_t;
+typedef std::list<chunk_range_t>::iterator chunk_range_iterator_t;
/**
* Collection class that maintains the sorted list of row ID chunk ranges
@@ -105,31 +105,31 @@ public:
VBDeletionChunkRangeList() { }
- chunk_range_iterator begin() {
+ chunk_range_iterator_t begin() {
return range_list.begin();
}
- chunk_range_iterator end() {
+ chunk_range_iterator_t end() {
return range_list.end();
}
void add(int64_t start_id, int64_t end_id) {
- chunk_range r(start_id, end_id);
+ chunk_range_t r(start_id, end_id);
add(r);
}
- void add(chunk_range range) {
+ void add(chunk_range_t range) {
if (range.first > range.second || (size() > 0 && back().second > range.first)) {
return;
}
range_list.push_back(range);
}
- const chunk_range& front() {
+ const chunk_range_t& front() {
return range_list.front();
}
- const chunk_range& back() {
+ const chunk_range_t& back() {
return range_list.back();
}
@@ -142,14 +142,14 @@ public:
* @param it pointer to a chunk range to be split
* @param range_size range size used for chunk split
*/
- void splitChunkRange(chunk_range_iterator it, int64_t range_size) {
+ void splitChunkRange(chunk_range_iterator_t it, int64_t range_size) {
if (it == end() || (it->second - it->first) <= range_size) {
return;
}
int64_t range_end = it->second;
it->second = it->first + range_size;
- chunk_range r(it->second + 1, range_end);
+ chunk_range_t r(it->second + 1, range_end);
range_list.insert(++it, r);
}
@@ -158,13 +158,13 @@ public:
* @param start the pointer to the start chunk range for the merge operation
* @param range_size the new range size used for merging chunk ranges
*/
- void mergeChunkRanges(chunk_range_iterator start, int64_t range_size) {
+ void mergeChunkRanges(chunk_range_iterator_t start, int64_t range_size) {
if (start == end() || (start->second - start->first) >= range_size) {
return;
}
// Find the closest chunk C1 whose end point is greater than the point advanced by
// the new range size from the start chunk range's start point.
- chunk_range_iterator p = findClosestChunkByRangeSize(start, range_size);
+ chunk_range_iterator_t p = findClosestChunkByRangeSize(start, range_size);
if (p != end()) {
int64_t endpoint = start->first + range_size;
if (p->first <= endpoint && endpoint <= p->second) {
@@ -172,7 +172,7 @@ public:
start->second = endpoint;
p->first = endpoint + 1;
} else {
- chunk_range_iterator iter = p;
+ chunk_range_iterator_t iter = p;
start->second = (--iter)->second;
}
} else { // Reached to the end of the range list
@@ -191,7 +191,7 @@ private:
* @param first iterator that points to the first chunk range in the sub list
* @param last iterator that points to the last chunk range in the sub list
*/
- void removeChunkRanges(chunk_range_iterator first, chunk_range_iterator last) {
+ void removeChunkRanges(chunk_range_iterator_t first, chunk_range_iterator_t last) {
if (first == last || first == end() ||
(first != end() && last != end() && first->second > last->first)) {
return;
@@ -206,16 +206,16 @@ private:
* @param range_size range size to be advanced
* @return the iterator that points to the chunk range found
*/
- chunk_range_iterator findClosestChunkByRangeSize(chunk_range_iterator it,
- int64_t range_size) {
- chunk_range_iterator p = it;
+ chunk_range_iterator_t findClosestChunkByRangeSize(chunk_range_iterator_t it,
+ int64_t range_size) {
+ chunk_range_iterator_t p = it;
while (p != end() && p->second <= (it->first + range_size)) {
++p;
}
return p;
}
- std::list<chunk_range> range_list;
+ std::list<chunk_range_t> range_list;
};
/**
@@ -260,7 +260,7 @@ public:
}
if (counter == chunk_size || iter == --(row_ids->end())) {
end_row_id = *iter;
- chunk_range r(start_row_id, end_row_id);
+ chunk_range_t r(start_row_id, end_row_id);
range_list.add(r);
counter = 0;
}
View
136 ep_engine.cc
@@ -95,14 +95,14 @@ extern "C" {
static ENGINE_ERROR_CODE EvpItemAllocate(ENGINE_HANDLE* handle,
const void* cookie,
- item **item,
+ item **itm,
const void* key,
const size_t nkey,
const size_t nbytes,
const int flags,
const rel_time_t exptime)
{
- return getHandle(handle)->itemAllocate(cookie, item, key,
+ return getHandle(handle)->itemAllocate(cookie, itm, key,
nkey, nbytes, flags, exptime);
}
@@ -118,19 +118,19 @@ extern "C" {
static void EvpItemRelease(ENGINE_HANDLE* handle,
const void *cookie,
- item* item)
+ item* itm)
{
- getHandle(handle)->itemRelease(cookie, item);
+ getHandle(handle)->itemRelease(cookie, itm);
}
static ENGINE_ERROR_CODE EvpGet(ENGINE_HANDLE* handle,
const void* cookie,
- item** item,
+ item** itm,
const void* key,
const int nkey,
uint16_t vbucket)
{
- return getHandle(handle)->get(cookie, item, key, nkey, vbucket);
+ return getHandle(handle)->get(cookie, itm, key, nkey, vbucket);
}
static ENGINE_ERROR_CODE EvpGetStats(ENGINE_HANDLE* handle,
@@ -144,12 +144,12 @@ extern "C" {
static ENGINE_ERROR_CODE EvpStore(ENGINE_HANDLE* handle,
const void *cookie,
- item* item,
+ item* itm,
uint64_t *cas,
ENGINE_STORE_OPERATION operation,
uint16_t vbucket)
{
- return getHandle(handle)->store(cookie, item, cas, operation, vbucket);
+ return getHandle(handle)->store(cookie, itm, cas, operation, vbucket);
}
static ENGINE_ERROR_CODE EvpArithmetic(ENGINE_HANDLE* handle,
@@ -317,7 +317,7 @@ extern "C" {
ENGINE_ERROR_CODE getLocked(EventuallyPersistentEngine *e,
protocol_binary_request_header *req,
const void *cookie,
- Item **item,
+ Item **itm,
const char **msg,
size_t *,
protocol_binary_response_status *res) {
@@ -362,7 +362,7 @@ extern "C" {
ENGINE_ERROR_CODE rv = getCb.val.getStatus();
if (rv == ENGINE_SUCCESS) {
- *item = getCb.val.getValue();
+ *itm = getCb.val.getValue();
} else if (rv == ENGINE_EWOULDBLOCK) {
@@ -699,7 +699,7 @@ extern "C" {
PROTOCOL_BINARY_RESPONSE_UNKNOWN_COMMAND;
const char *msg = NULL;
size_t msg_size = 0;
- Item *item = NULL;
+ Item *itm = NULL;
EventuallyPersistentEngine *h = getHandle(handle);
EPStats &stats = h->getEpStats();
@@ -753,7 +753,7 @@ extern "C" {
res = evictKey(h, request, &msg, &msg_size);
break;
case CMD_GET_LOCKED:
- rv = getLocked(h, request, cookie, &item, &msg, &msg_size, &res);
+ rv = getLocked(h, request, cookie, &itm, &msg, &msg_size, &res);
if (rv == ENGINE_EWOULDBLOCK) {
// we dont have the value for the item yet
return rv;
@@ -775,28 +775,28 @@ extern "C" {
}
// Send a special response for getl since we don't want to send the key
- if (item && request->request.opcode == CMD_GET_LOCKED) {
- uint32_t flags = item->getFlags();
+ if (itm && request->request.opcode == CMD_GET_LOCKED) {
+ uint32_t flags = itm->getFlags();
response(NULL, 0, (const void *)&flags, sizeof(uint32_t),
- static_cast<const void *>(item->getData()),
- item->getNBytes(),
+ static_cast<const void *>(itm->getData()),
+ itm->getNBytes(),
PROTOCOL_BINARY_RAW_BYTES,
- static_cast<uint16_t>(res), item->getCas(),
+ static_cast<uint16_t>(res), itm->getCas(),
cookie);
- } else if (item) {
- std::string key = item->getKey();
- uint32_t flags = item->getFlags();
+ } else if (itm) {
+ std::string key = itm->getKey();
+ uint32_t flags = itm->getFlags();
response(static_cast<const void *>(key.data()),
- item->getNKey(),
+ itm->getNKey(),
(const void *)&flags, sizeof(uint32_t),
- static_cast<const void *>(item->getData()),
- item->getNBytes(),
+ static_cast<const void *>(itm->getData()),
+ itm->getNBytes(),
PROTOCOL_BINARY_RAW_BYTES,
- static_cast<uint16_t>(res), item->getCas(),
+ static_cast<uint16_t>(res), itm->getCas(),
cookie);
- delete item;
+ delete itm;
} else {
msg_size = (msg_size > 0 || msg == NULL) ? msg_size : strlen(msg);
@@ -810,8 +810,8 @@ extern "C" {
}
static void EvpItemSetCas(ENGINE_HANDLE* , const void *,
- item *item, uint64_t cas) {
- static_cast<Item*>(item)->setCas(cas);
+ item *itm, uint64_t cas) {
+ static_cast<Item*>(itm)->setCas(cas);
}
static ENGINE_ERROR_CODE EvpTapNotify(ENGINE_HANDLE* handle,
@@ -917,22 +917,22 @@ extern "C" {
}
static bool EvpGetItemInfo(ENGINE_HANDLE *, const void *,
- const item* item, item_info *item_info)
+ const item* itm, item_info *itm_info)
{
- const Item *it = reinterpret_cast<const Item*>(item);
- if (item_info->nvalue < 1) {
+ const Item *it = reinterpret_cast<const Item*>(itm);
+ if (itm_info->nvalue < 1) {
return false;
}
- item_info->cas = it->getCas();
- item_info->exptime = it->getExptime();
- item_info->nbytes = it->getNBytes();
- item_info->flags = it->getFlags();
- item_info->clsid = 0;
- item_info->nkey = static_cast<uint16_t>(it->getNKey());
- item_info->nvalue = 1;
- item_info->key = it->getKey().c_str();
- item_info->value[0].iov_base = const_cast<char*>(it->getData());
- item_info->value[0].iov_len = it->getNBytes();
+ itm_info->cas = it->getCas();
+ itm_info->exptime = it->getExptime();
+ itm_info->nbytes = it->getNBytes();
+ itm_info->flags = it->getFlags();
+ itm_info->clsid = 0;
+ itm_info->nkey = static_cast<uint16_t>(it->getNKey());
+ itm_info->nvalue = 1;
+ itm_info->key = it->getKey().c_str();
+ itm_info->value[0].iov_base = const_cast<char*>(it->getData());
+ itm_info->value[0].iov_len = it->getNBytes();
return true;
}
} // C linkage
@@ -1401,40 +1401,40 @@ inline tap_event_t EventuallyPersistentEngine::doWalkTapQueue(const void *cookie
abort();
}
*vbucket = checkpoint_msg->getVBucketId();
- Item *item = new Item(checkpoint_msg->getKey(), 0, 0, checkpoint_msg->getValue(),
- 0, -1, checkpoint_msg->getVBucketId());
- *itm = item;
+ Item *it = new Item(checkpoint_msg->getKey(), 0, 0, checkpoint_msg->getValue(),
+ 0, -1, checkpoint_msg->getVBucketId());
+ *itm = it;
return ret;
}
// Check if there are any items fetched from disk for backfill operations.
if (connection->hasItem()) {
ret = TAP_MUTATION;
- Item *item = connection->nextFetchedItem();
+ Item *it = connection->nextFetchedItem();
++stats.numTapBGFetched;
++connection->queueDrain;
// If there's a better version in memory, grab it, else go
// with what we pulled from disk.
- GetValue gv(epstore->get(item->getKey(), item->getVBucketId(),
+ GetValue gv(epstore->get(it->getKey(), it->getVBucketId(),
cookie, false));
if (gv.getStatus() == ENGINE_SUCCESS) {
- delete item;
- *itm = item = gv.getValue();
+ delete it;
+ *itm = it = gv.getValue();
} else {
- *itm = item;
+ *itm = it;
}
*vbucket = static_cast<Item*>(*itm)->getVBucketId();
if (!connection->supportsAck()) {
if (gv.getStoredValue() != NULL) {
gv.getStoredValue()->incrementNumReplicas();
- syncRegistry.itemReplicated(*item);
+ syncRegistry.itemReplicated(*it);
} else {
getLogger()->log(EXTENSION_LOG_WARNING, NULL,
"NULL StoredValue* for key %s, vbucket %d",
- item->getKey().c_str(), item->getVBucketId());
+ it->getKey().c_str(), it->getVBucketId());
}
}
@@ -1443,15 +1443,15 @@ inline tap_event_t EventuallyPersistentEngine::doWalkTapQueue(const void *cookie
// disk, but the filter says not to, so we need to get rid
// of it now.
if (gv.getStatus() != ENGINE_SUCCESS) {
- delete item;
+ delete it;
}
retry = true;
return TAP_NOOP;
}
- queued_item qi(new QueuedItem(item->getKey(), item->getValue(), item->getVBucketId(),
- queue_op_set, -1, item->getId(), item->getFlags(),
- item->getExptime(), item->getCas()));
+ queued_item qi(new QueuedItem(it->getKey(), it->getValue(), it->getVBucketId(),
+ queue_op_set, -1, it->getId(), it->getFlags(),
+ it->getExptime(), it->getCas()));
connection->addTapLogElement(qi);
} else if (connection->hasQueuedItem()) {
if (connection->waitForBackfill() || connection->waitForCheckpointMsgAck()) {
@@ -1521,17 +1521,17 @@ inline tap_event_t EventuallyPersistentEngine::doWalkTapQueue(const void *cookie
}
} else { // The item is from the checkpoint in the unified queue.
if (qi->getOperation() == queue_op_set) {
- Item *item = new Item(qi->getKey(), qi->getFlags(), qi->getExpiryTime(),
- qi->getValue(), qi->getCas(), qi->getRowId(), qi->getVBucketId());
- *itm = item;
+ Item *it = new Item(qi->getKey(), qi->getFlags(), qi->getExpiryTime(),
+ qi->getValue(), qi->getCas(), qi->getRowId(), qi->getVBucketId());
+ *itm = it;
ret = TAP_MUTATION;
StoredValue *sv = epstore->getStoredValue(qi->getKey(), qi->getVBucketId(), false);
if (!connection->supportsAck()) {
- if (sv && sv->getCas() == item->getCas()) {
+ if (sv && sv->getCas() == it->getCas()) {
sv->incrementNumReplicas();
- syncRegistry.itemReplicated(*item);
+ syncRegistry.itemReplicated(*it);
}
}
@@ -1869,18 +1869,18 @@ ENGINE_ERROR_CODE EventuallyPersistentEngine::tapNotify(const void *cookie,
BlockTimer timer(&stats.tapMutationHisto);
TapConsumer *tc = dynamic_cast<TapConsumer*>(connection);
RCPtr<Blob> vblob(Blob::New(static_cast<const char*>(data), ndata));
- Item *item = new Item(k, flags, exptime, vblob);
- item->setVBucketId(vbucket);
+ Item *itm = new Item(k, flags, exptime, vblob);
+ itm->setVBucketId(vbucket);
if (tc) {
ret = tc->isBackfillPhase(vbucket) ?
- epstore->addTAPBackfillItem(*item) : epstore->set(*item, cookie, true);
+ epstore->addTAPBackfillItem(*itm) : epstore->set(*itm, cookie, true);
} else {
ret = ENGINE_DISCONNECT;
}
if (ret == ENGINE_SUCCESS) {
- addMutationEvent(item);
+ addMutationEvent(itm);
} else if (ret == ENGINE_ENOMEM) {
if (connection->supportsAck()) {
ret = ENGINE_TMPFAIL;
@@ -1891,7 +1891,7 @@ ENGINE_ERROR_CODE EventuallyPersistentEngine::tapNotify(const void *cookie,
}
}
- delete item;
+ delete itm;
if (tc && !tc->supportsCheckpointSync()) {
tc->checkVBOpenCheckpoint(vbucket);
}
@@ -2924,15 +2924,15 @@ ENGINE_ERROR_CODE EventuallyPersistentEngine::doKeyStats(const void *cookie,
} else {
GetValue gv(epstore->get(key, vbid, cookie, serverApi->core));
if (gv.getStatus() == ENGINE_SUCCESS) {
- shared_ptr<Item> item(gv.getValue());
+ shared_ptr<Item> itm(gv.getValue());
if (diskItem.get()) {
// Both items exist
- if (diskItem->getNBytes() != item->getNBytes()) {
+ if (diskItem->getNBytes() != itm->getNBytes()) {
valid.assign("length_mismatch");
- } else if (memcmp(diskItem->getData(), item->getData(),
+ } else if (memcmp(diskItem->getData(), itm->getData(),
diskItem->getNBytes()) != 0) {
valid.assign("data_mismatch");
- } else if (diskItem->getFlags() != item->getFlags()) {
+ } else if (diskItem->getFlags() != itm->getFlags()) {
valid.assign("flags_mismatch");
} else {
valid.assign("valid");
View
44 ep_engine.h
@@ -166,7 +166,7 @@ class EventuallyPersistentEngine : public ENGINE_HANDLE_V1 {
void destroy(bool force);
ENGINE_ERROR_CODE itemAllocate(const void* cookie,
- item** item,
+ item** itm,
const void* key,
const size_t nkey,
const size_t nbytes,
@@ -180,8 +180,8 @@ class EventuallyPersistentEngine : public ENGINE_HANDLE_V1 {
time_t expiretime = (exptime == 0) ? 0 : ep_abs_time(ep_reltime(exptime));
- *item = new Item(key, nkey, nbytes, flags, expiretime);
- if (*item == NULL) {
+ *itm = new Item(key, nkey, nbytes, flags, expiretime);
+ if (*itm == NULL) {
return memoryCondition();
} else {
return ENGINE_SUCCESS;
@@ -212,14 +212,14 @@ class EventuallyPersistentEngine : public ENGINE_HANDLE_V1 {
}
- void itemRelease(const void* cookie, item *item)
+ void itemRelease(const void* cookie, item *itm)
{
(void)cookie;
- delete (Item*)item;
+ delete (Item*)itm;
}
ENGINE_ERROR_CODE get(const void* cookie,
- item** item,
+ item** itm,
const void* key,
const int nkey,
uint16_t vbucket)
@@ -230,7 +230,7 @@ class EventuallyPersistentEngine : public ENGINE_HANDLE_V1 {
GetValue gv(epstore->get(k, vbucket, cookie, serverApi->core));
if (gv.getStatus() == ENGINE_SUCCESS) {
- *item = gv.getValue();
+ *itm = gv.getValue();
} else if (gv.getStatus() == ENGINE_KEY_ENOENT && isDegradedMode()) {
return ENGINE_TMPFAIL;
}
@@ -272,17 +272,17 @@ class EventuallyPersistentEngine : public ENGINE_HANDLE_V1 {
ENGINE_ERROR_CODE ret = get(cookie, &it, key, nkey, vbucket);
if (ret == ENGINE_SUCCESS) {
- Item *item = static_cast<Item*>(it);
+ Item *itm = static_cast<Item*>(it);
char *endptr = NULL;
char data[24];
size_t len = std::min(static_cast<uint32_t>(sizeof(data) - 1),
- item->getNBytes());
+ itm->getNBytes());
data[len] = 0;
- memcpy(data, item->getData(), len);
+ memcpy(data, itm->getData(), len);
uint64_t val = strtoull(data, &endptr, 10);
- if (item->getCas() == (uint64_t) -1) {
+ if (itm->getCas() == (uint64_t) -1) {
// item is locked, can't perform arithmetic operation
- delete item;
+ delete itm;
return ENGINE_TMPFAIL;
}
if ((errno != ERANGE) && (isspace(*endptr)
@@ -301,16 +301,16 @@ class EventuallyPersistentEngine : public ENGINE_HANDLE_V1 {
vals << val;
size_t nb = vals.str().length();
*result = val;
- Item *nit = new Item(key, (uint16_t)nkey, item->getFlags(),
- item->getExptime(), vals.str().c_str(), nb);
- nit->setCas(item->getCas());
+ Item *nit = new Item(key, (uint16_t)nkey, itm->getFlags(),
+ itm->getExptime(), vals.str().c_str(), nb);
+ nit->setCas(itm->getCas());
ret = store(cookie, nit, cas, OPERATION_CAS, vbucket);
delete nit;
} else {
ret = ENGINE_EINVAL;
}
- delete item;
+ delete itm;
} else if (ret == ENGINE_NOT_MY_VBUCKET) {
return ret;
} else if (ret == ENGINE_KEY_ENOENT && create) {
@@ -320,10 +320,10 @@ class EventuallyPersistentEngine : public ENGINE_HANDLE_V1 {
size_t nb = vals.str().length();
*result = initial;
- Item *item = new Item(key, (uint16_t)nkey, 0, expiretime,
- vals.str().c_str(), nb);
- ret = store(cookie, item, cas, OPERATION_ADD, vbucket);
- delete item;
+ Item *itm = new Item(key, (uint16_t)nkey, 0, expiretime,
+ vals.str().c_str(), nb);
+ ret = store(cookie, itm, cas, OPERATION_ADD, vbucket);
+ delete itm;
}
/* We had a race condition.. just call ourself recursively to retry */
@@ -704,13 +704,13 @@ class EventuallyPersistentEngine : public ENGINE_HANDLE_V1 {
lookups[cookie] = result;
}
- bool fetchLookupResult(const void *cookie, Item **item) {
+ bool fetchLookupResult(const void *cookie, Item **itm) {
// This will return *and erase* the lookup result for a connection.
// You look it up, you own it.
LockHolder lh(lookupMutex);
std::map<const void*, Item*>::iterator it = lookups.find(cookie);
if (it != lookups.end()) {
- *item = it->second;
+ *itm = it->second;
lookups.erase(it);
return true;
} else {
View
16 ep_extension.cc
@@ -121,26 +121,26 @@ ENGINE_ERROR_CODE GetlExtension::executeGetl(int argc, token_t *argv,
serverApi->core->get_current_time(),
lockTimeout, response_cookie);
- Item *item = NULL;
+ Item *itm = NULL;
ENGINE_ERROR_CODE ret;
getCb.waitForValue();
ENGINE_ERROR_CODE rv = getCb.val.getStatus();
if (rv == ENGINE_SUCCESS) {
- item = getCb.val.getValue();
+ itm = getCb.val.getValue();
std::stringstream strm;
- strm << "VALUE " << item->getKey() << " " << ntohl(item->getFlags())
- << " " << item->getNBytes() << " " << item->getCas() << "\r\n";
+ strm << "VALUE " << itm->getKey() << " " << ntohl(itm->getFlags())
+ << " " << itm->getNBytes() << " " << itm->getCas() << "\r\n";
std::string strVal = strm.str();
size_t len = strVal.length();
if ((response_handler(response_cookie, static_cast<int>(len),
strVal.c_str()) == ENGINE_SUCCESS) &&
- (response_handler(response_cookie, item->getNBytes(),
- item->getData()) == ENGINE_SUCCESS) &&
+ (response_handler(response_cookie, itm->getNBytes(),
+ itm->getData()) == ENGINE_SUCCESS) &&
(response_handler(response_cookie, 7,
"\r\nEND\r\n") == ENGINE_SUCCESS)) {
ret = ENGINE_SUCCESS;
@@ -157,8 +157,8 @@ ENGINE_ERROR_CODE GetlExtension::executeGetl(int argc, token_t *argv,
sizeof("NOT_FOUND\r\n") - 1, "NOT_FOUND\r\n");
}
- if (item != NULL) {
- delete item;
+ if (itm != NULL) {
+ delete itm;
}
return ret;
View
10 ep_testsuite.cc
@@ -962,7 +962,7 @@ extern "C" {
check(iter != NULL, "Failed to create a tap iterator");
item *it;
- Item *item;
+ Item *itm;
void *engine_specific;
uint16_t nengine_specific;
uint8_t ttl;
@@ -989,13 +989,13 @@ extern "C" {
case TAP_OPAQUE:
break;
case TAP_MUTATION:
- item = reinterpret_cast<Item *>(it);
+ itm = reinterpret_cast<Item *>(it);
- check(vbuckets.find(item->getVBucketId()) != vbuckets.end(),
+ check(vbuckets.find(itm->getVBucketId()) != vbuckets.end(),
"Received an item for a vbucket we don't subscribe to");
- if (expectedKeys->find(*item) != expectedKeys->end()) {
- keysReceived.insert(*item);
+ if (expectedKeys->find(*itm) != expectedKeys->end()) {
+ keysReceived.insert(*itm);
}
if (keysReceived.size() == expectedKeys->size()) {
View
10 item.cc
@@ -18,9 +18,9 @@
Atomic<uint64_t> Item::casCounter(1);
-bool Item::append(const Item &item) {
+bool Item::append(const Item &itm) {
std::string newValue(value->getData(), value->length());
- newValue.append(item.getValue()->to_s());
+ newValue.append(itm.getValue()->to_s());
value.reset(Blob::New(newValue));
return true;
}
@@ -28,11 +28,11 @@ bool Item::append(const Item &item) {
/**
* Prepend another item to this item
*
- * @param item the item to prepend to this one
+ * @param itm the item to prepend to this one
* @return true if success
*/
-bool Item::prepend(const Item &item) {
- std::string newValue(item.getValue()->to_s());
+bool Item::prepend(const Item &itm) {
+ std::string newValue(itm.getValue()->to_s());
newValue.append(value->to_s());
value.reset(Blob::New(newValue));
return true;
View
14 item_pager.cc
@@ -144,8 +144,8 @@ bool ExpiredItemPager::callback(Dispatcher &d, TaskId t) {
return true;
}
-void InvalidItemDbPager::addInvalidItem(Item *item, uint16_t vbucket_version) {
- uint16_t vbucket_id = item->getVBucketId();
+void InvalidItemDbPager::addInvalidItem(Item *itm, uint16_t vbucket_version) {
+ uint16_t vbucket_id = itm->getVBucketId();
std::map<uint16_t, uint16_t>::iterator version_it = vb_versions.find(vbucket_id);
if (version_it == vb_versions.end() || version_it->second < vbucket_version) {
vb_versions[vbucket_id] = vbucket_version;
@@ -153,10 +153,10 @@ void InvalidItemDbPager::addInvalidItem(Item *item, uint16_t vbucket_version) {
std::map<uint16_t, std::vector<int64_t>* >::iterator item_it = vb_items.find(vbucket_id);
if (item_it != vb_items.end()) {
- item_it->second->push_back(item->getId());
+ item_it->second->push_back(itm->getId());
} else {
std::vector<int64_t> *item_list = new std::vector<int64_t>(chunk_size * 5);
- item_list->push_back(item->getId());
+ item_list->push_back(itm->getId());
vb_items[vbucket_id] = item_list;
}
}
@@ -165,7 +165,7 @@ void InvalidItemDbPager::createRangeList() {
std::map<uint16_t, std::vector<int64_t>* >::iterator vbit;
for (vbit = vb_items.begin(); vbit != vb_items.end(); vbit++) {
std::sort(vbit->second->begin(), vbit->second->end());
- std::list<row_range> row_range_list;
+ std::list<row_range_t> row_range_list;
createChunkListFromArray<int64_t>(vbit->second, chunk_size, row_range_list);
vb_row_ranges[vbit->first] = row_range_list;
delete vbit->second;
@@ -175,13 +175,13 @@ void InvalidItemDbPager::createRangeList() {
bool InvalidItemDbPager::callback(Dispatcher &d, TaskId t) {
BlockTimer timer(&stats.diskInvaidItemDelHisto);
- std::map<uint16_t, std::list<row_range> >::iterator it = vb_row_ranges.begin();
+ std::map<uint16_t, std::list<row_range_t> >::iterator it = vb_row_ranges.begin();
if (it == vb_row_ranges.end()) {
stats.dbCleanerComplete.set(true);
return false;
}
- std::list<row_range>::iterator rit = it->second.begin();
+ std::list<row_range_t>::iterator rit = it->second.begin();
uint16_t vbid = it->first;
uint16_t vb_version = vb_versions[vbid];
if (store->getRWUnderlying()->delVBucket(vbid, vb_version, *rit)) {
View
4 item_pager.hh
@@ -10,7 +10,7 @@
#include "dispatcher.hh"
#include "stats.hh"
-typedef std::pair<int64_t, int64_t> row_range;
+typedef std::pair<int64_t, int64_t> row_range_t;
// Forward declaration.
class EventuallyPersistentStore;
@@ -112,7 +112,7 @@ private:
size_t chunk_size;
std::map<uint16_t, uint16_t> vb_versions;
std::map<uint16_t, std::vector<int64_t>* > vb_items;
- std::map<uint16_t, std::list<row_range> > vb_row_ranges;
+ std::map<uint16_t, std::list<row_range_t> > vb_row_ranges;
};
#endif /* ITEM_PAGER_HH */
View
4 stored-value.cc
@@ -396,9 +396,9 @@ void StoredValue::reduceCurrentSize(EPStats &st, size_t by) {
/**
* Is there enough space for this thing?
*/
-bool StoredValue::hasAvailableSpace(EPStats &st, const Item &item) {
+bool StoredValue::hasAvailableSpace(EPStats &st, const Item &itm) {
double newSize = static_cast<double>(getCurrentSize(st) +
- sizeof(StoredValue) + item.getNKey());
+ sizeof(StoredValue) + itm.getNKey());
double maxSize= static_cast<double>(getMaxDataSize(st)) * mutation_mem_threshold;
return newSize <= maxSize;
}
View
4 sync_registry.cc
@@ -72,8 +72,8 @@ void SyncRegistry::removePersistenceListener(SyncListener *syncListener) {
}
-void SyncRegistry::itemPersisted(const queued_item &item) {
- key_spec_t keyspec(item);
+void SyncRegistry::itemPersisted(const queued_item &qi) {
+ key_spec_t keyspec(qi);
LockHolder lh(persistenceMutex);
notifyListeners(persistenceListeners, keyspec, false);
}
View
4 t/vb_del_chunk_list_test.cc
@@ -38,7 +38,7 @@ static void testSplitChunkRange() {
chunk_range_list.add(std::make_pair(21, 30));
assert(chunk_range_list.size() == 3);
- chunk_range_iterator it = chunk_range_list.begin();
+ chunk_range_iterator_t it = chunk_range_list.begin();
// Split the first chunk range by range size 11, which doesn't cause any splits
// because the first chunk range size 9 is less than the split range size 11.
chunk_range_list.splitChunkRange(it, 11);
@@ -70,7 +70,7 @@ static void testMergeChunkRanges() {
chunk_range_list.add(std::make_pair(120, 150));
assert(chunk_range_list.size() == 5);
- chunk_range_iterator it = chunk_range_list.begin();
+ chunk_range_iterator_t it = chunk_range_list.begin();
// Merge the current chunk range with its subsequent ranges by range size 7, which doesn't
// result in any merges because the current range's size 10 is greater than 7.
chunk_range_list.mergeChunkRanges(it, 7);
View
20 tapconnection.cc
@@ -1188,8 +1188,8 @@ queued_item TapProducer::next(bool &shouldPause) {
}
bool isLastItem = false;
- queued_item item = vb->checkpointManager.nextItem(name, isLastItem);
- switch(item->getOperation()) {
+ queued_item qi = vb->checkpointManager.nextItem(name, isLastItem);
+ switch(qi->getOperation()) {
case queue_op_set:
case queue_op_del:
if (supportCheckpointSync && isLastItem) {
@@ -1197,17 +1197,17 @@ queued_item TapProducer::next(bool &shouldPause) {
} else {
it->second.lastItem = false;
}
- addEvent_UNLOCKED(item);
+ addEvent_UNLOCKED(qi);
break;
case queue_op_checkpoint_start:
{
uint64_t checkpointId;
- memcpy(&checkpointId, item->getValue()->getData(), sizeof(checkpointId));
+ memcpy(&checkpointId, qi->getValue()->getData(), sizeof(checkpointId));
checkpointId = ntohll(checkpointId);
it->second.currentCheckpointId = checkpointId;
if (supportCheckpointSync) {
it->second.state = checkpoint_start;
- addCheckpointMessage_UNLOCKED(item);
+ addCheckpointMessage_UNLOCKED(qi);
}
}
break;
@@ -1221,7 +1221,7 @@ queued_item TapProducer::next(bool &shouldPause) {
seqnoAcked = isLastAckSucceed ? seqnoReceived : seqnoReceived - 1;
}
if (it->second.lastSeqNum <= seqnoAcked) {
- addCheckpointMessage_UNLOCKED(item);
+ addCheckpointMessage_UNLOCKED(qi);
} else {
vb->checkpointManager.decrTapCursorFromCheckpointEnd(name);
++wait_for_ack_count;
@@ -1230,21 +1230,21 @@ queued_item TapProducer::next(bool &shouldPause) {
break;
case queue_op_online_update_start:
{
- TapVBucketEvent ev(TAP_OPAQUE, item->getVBucketId(),
+ TapVBucketEvent ev(TAP_OPAQUE, qi->getVBucketId(),
(vbucket_state_t)htonl(TAP_OPAQUE_START_ONLINEUPDATE));
addVBucketHighPriority_UNLOCKED(ev);
}
break;
case queue_op_online_update_end:
{
- TapVBucketEvent ev(TAP_OPAQUE, item->getVBucketId(),
+ TapVBucketEvent ev(TAP_OPAQUE, qi->getVBucketId(),
(vbucket_state_t)htonl(TAP_OPAQUE_STOP_ONLINEUPDATE));
addVBucketHighPriority_UNLOCKED(ev);
}
break;
case queue_op_online_update_revert:
{
- TapVBucketEvent ev(TAP_OPAQUE, item->getVBucketId(),
+ TapVBucketEvent ev(TAP_OPAQUE, qi->getVBucketId(),
(vbucket_state_t)htonl(TAP_OPAQUE_REVERT_ONLINEUPDATE));
addVBucketHighPriority_UNLOCKED(ev);
}
@@ -1256,7 +1256,7 @@ queued_item TapProducer::next(bool &shouldPause) {
// If all the cursors are at the open checkpoints, send the OPAQUE message
// to the TAP client so that it can close the connection if necessary.
if (open_checkpoint_count == (tapCheckpointState.size() - invalid_count)) {
- TapVBucketEvent ev(TAP_OPAQUE, item->getVBucketId(),
+ TapVBucketEvent ev(TAP_OPAQUE, qi->getVBucketId(),
(vbucket_state_t)htonl(TAP_OPAQUE_OPEN_CHECKPOINT));
addVBucketHighPriority_UNLOCKED(ev);
}
View
18 tapconnection.hh
@@ -637,32 +637,32 @@ private:
return nextVBucketLowPriority_UNLOCKED();
}
- void addCheckpointMessage_UNLOCKED(const queued_item &item) {
- checkpointMsgs.push(item);
+ void addCheckpointMessage_UNLOCKED(const queued_item &qi) {
+ checkpointMsgs.push(qi);
}
/**
* Add a checkpoint start / end message to the checkpoint message queue. These messages
* are used for synchronizing checkpoints between tap producer and consumer.
*/
- void addCheckpointMessage(const queued_item &item) {
+ void addCheckpointMessage(const queued_item &qi) {
LockHolder lh(queueLock);
- addCheckpointMessage_UNLOCKED(item);
+ addCheckpointMessage_UNLOCKED(qi);
}
queued_item nextCheckpointMessage_UNLOCKED() {
- queued_item item(new QueuedItem("", 0xffff, queue_op_empty));
+ queued_item qi(new QueuedItem("", 0xffff, queue_op_empty));
if (!checkpointMsgs.empty()) {
- item = checkpointMsgs.front();
+ qi = checkpointMsgs.front();
checkpointMsgs.pop();
- if (!vbucketFilter(item->getVBucketId())) {
+ if (!vbucketFilter(qi->getVBucketId())) {
return nextCheckpointMessage_UNLOCKED();
}
++checkpointMsgCounter;
++recordsFetched;
- addTapLogElement_UNLOCKED(item);
+ addTapLogElement_UNLOCKED(qi);
}
- return item;
+ return qi;
}
queued_item nextCheckpointMessage() {
View
10 vbucket.cc
@@ -130,17 +130,17 @@ void VBucket::setState(vbucket_state_t to, SERVER_HANDLE_V1 *sapi) {
state = to;
}
-void VBucket::doStatsForQueueing(QueuedItem& item, size_t itemBytes)
+void VBucket::doStatsForQueueing(QueuedItem& qi, size_t itemBytes)
{
++dirtyQueueSize;
dirtyQueueMem.incr(sizeof(QueuedItem));
++dirtyQueueFill;
- dirtyQueueAge.incr(item.getQueuedTime());
+ dirtyQueueAge.incr(qi.getQueuedTime());
dirtyQueuePendingWrites.incr(itemBytes);
}
-void VBucket::doStatsForFlushing(QueuedItem& item, size_t itemBytes)
+void VBucket::doStatsForFlushing(QueuedItem& qi, size_t itemBytes)
{
if (dirtyQueueSize > 0) {
--dirtyQueueSize;
@@ -152,8 +152,8 @@ void VBucket::doStatsForFlushing(QueuedItem& item, size_t itemBytes)
}
++dirtyQueueDrain;
- if (dirtyQueueAge > item.getQueuedTime()) {
- dirtyQueueAge.decr(item.getQueuedTime());
+ if (dirtyQueueAge > qi.getQueuedTime()) {
+ dirtyQueueAge.decr(qi.getQueuedTime());
} else {
dirtyQueueAge.set(0);
}
Please sign in to comment.
Something went wrong with that request. Please try again.