Permalink
Browse files

MB-100: fix ep_engine compilation errors/warnings (master branch)

Change-Id: I296fd1937e33588d8b862b421a2ec0ad2d532f06
Reviewed-on: http://review.couchbase.org/24582
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
  • Loading branch information...
1 parent 66eb94d commit 845a1e4cb75d5c6bc16d99a6feed928a7881901d Junyi Xie committed with mikewied Feb 13, 2013
Showing with 21 additions and 34 deletions.
  1. +0 −2 src/common.h
  2. +5 −14 src/couch-kvstore/couch-kvstore.cc
  3. +2 −3 src/couch-kvstore/couch-kvstore.h
  4. +1 −2 src/ep.cc
  5. +13 −12 src/ep_engine.cc
  6. +0 −1 tools/gencode.cc
View
@@ -117,8 +117,6 @@ extern void LOG(EXTENSION_LOG_LEVEL severity, const char *fmt, ...);
extern ALLOCATOR_HOOKS_API *getHooksApi(void);
-static SERVER_LOG_API *loggerApi;
-
// Time handling functions
inline void advance_tv(struct timeval &tv, const double secs) {
double ip, fp;
@@ -254,14 +254,14 @@ CouchRequest::CouchRequest(const Item &it, uint64_t rev, CouchRequestCallback &c
uint64_t cas = htonll(it.getCas());
uint32_t flags = it.getFlags();
uint32_t exptime = htonl(it.getExptime());
- uint32_t valuelen = it.getNBytes();
+ uint32_t vlen = it.getNBytes();
dbDoc.id.buf = const_cast<char *>(key.c_str());
dbDoc.id.size = it.getNKey();
- if (valuelen) {
+ if (vlen) {
isjson = isJSON(value);
dbDoc.data.buf = const_cast<char *>(value->getData());
- dbDoc.data.size = valuelen;
+ dbDoc.data.size = vlen;
} else {
dbDoc.data.buf = NULL;
dbDoc.data.size = 0;
@@ -641,7 +641,7 @@ bool CouchKVStore::snapshotVBuckets(const vbucket_map_t &vbstates)
cachedVBStates[vbucketId] = vbstate;
}
- success = setVBucketState(vbucketId, vbstate, vb_change_type, false);
+ success = setVBucketState(vbucketId, vbstate, vb_change_type);
if (!success) {
LOG(EXTENSION_LOG_WARNING,
"Warning: failed to set new state, %s, for vbucket %d\n",
@@ -717,8 +717,7 @@ bool CouchKVStore::snapshotStats(const std::map<std::string, std::string> &stats
}
bool CouchKVStore::setVBucketState(uint16_t vbucketId, vbucket_state &vbstate,
- uint32_t vb_change_type, bool newfile,
- bool notify)
+ uint32_t vb_change_type, bool notify)
{
Db *db = NULL;
uint64_t fileRev, newFileRev;
@@ -1097,17 +1096,9 @@ void CouchKVStore::updateDbFileMap(uint16_t vbucketId, uint64_t newFileRev)
return;
}
- uint64_t rev = dbFileRevMap[vbucketId];
dbFileRevMap[vbucketId] = newFileRev;
}
-static std::string getDBFileName(const std::string &dbname, uint16_t vbid)
-{
- std::stringstream ss;
- ss << dbname << "/" << vbid << ".couch";
- return ss.str();
-}
-
static std::string getDBFileName(const std::string &dbname,
uint16_t vbid,
uint64_t rev)
@@ -515,10 +515,9 @@ class CouchKVStore : public KVStore
std::vector<uint16_t> *vbids,
couchstore_docinfos_options options=COUCHSTORE_NO_OPTIONS);
bool setVBucketState(uint16_t vbucketId, vbucket_state &vbstate,
- uint32_t vb_change_type, bool newfile = false,
- bool notify = true);
+ uint32_t vb_change_type, bool notify = true);
bool resetVBucket(uint16_t vbucketId, vbucket_state &vbstate) {
- return setVBucketState(vbucketId, vbstate, VB_STATE_CHANGED, true, true);
+ return setVBucketState(vbucketId, vbstate, VB_STATE_CHANGED, true);
}
template <typename T>
View
@@ -1916,7 +1916,6 @@ int EventuallyPersistentStore::flushVBucket(uint16_t vbid) {
rel_time_t flush_start = ep_current_time();
RCPtr<VBucket> vb = vbuckets.getBucket(vbid);
if (vb && !vbuckets.isBucketCreation(vbid)) {
- size_t num_items = 0;
std::vector<queued_item> items;
uint64_t chkid = vb->checkpointManager.getPersistenceCursorPreChkId();
@@ -2033,7 +2032,7 @@ EventuallyPersistentStore::flushOneDelOrSet(const queued_item &qi,
int64_t rowid = found ? v->getId() : -1;
bool deleted = found && v->isDeleted();
bool isDirty = found && v->isDirty();
- rel_time_t queued(qi->getQueuedTime()), dirtied(0);
+ rel_time_t queued(qi->getQueuedTime());
Item itm(qi->getKey(),
found ? v->getFlags() : 0,
View
@@ -44,6 +44,7 @@
#include "warmup.h"
static ALLOCATOR_HOOKS_API *hooksApi;
+static SERVER_LOG_API *loggerApi;
static size_t percentOf(size_t val, double percent) {
return static_cast<size_t>(static_cast<double>(val) * percent);
@@ -1763,11 +1764,11 @@ bool EventuallyPersistentEngine::createTapQueue(const void *cookie,
return false;
}
- std::string name = "eq_tapq:";
+ std::string tq_name = "eq_tapq:";
if (client.length() == 0) {
- name.assign(TapConnection::getAnonName());
+ tq_name.assign(TapConnection::getAnonName());
} else {
- name.append(client);
+ tq_name.append(client);
}
// Decoding the userdata section of the packet and update the filters
@@ -1780,7 +1781,7 @@ bool EventuallyPersistentEngine::createTapQueue(const void *cookie,
if (nuserdata < sizeof(backfillAge)) {
LOG(EXTENSION_LOG_WARNING,
"Backfill age is missing. Reject connection request from %s\n",
- name.c_str());
+ tq_name.c_str());
return false;
}
// use memcpy to avoid alignemt issues
@@ -1795,7 +1796,7 @@ bool EventuallyPersistentEngine::createTapQueue(const void *cookie,
if (nuserdata < sizeof(nvbuckets)) {
LOG(EXTENSION_LOG_WARNING,
"Number of vbuckets is missing. Reject connection request from %s\n",
- name.c_str());
+ tq_name.c_str());
return false;
}
memcpy(&nvbuckets, ptr, sizeof(nvbuckets));
@@ -1806,7 +1807,7 @@ bool EventuallyPersistentEngine::createTapQueue(const void *cookie,
if (nuserdata < (sizeof(uint16_t) * nvbuckets)) {
LOG(EXTENSION_LOG_WARNING,
"# of vbuckets not matched. Reject connection request from %s\n",
- name.c_str());
+ tq_name.c_str());
return false;
}
for (uint16_t ii = 0; ii < nvbuckets; ++ii) {
@@ -1830,7 +1831,7 @@ bool EventuallyPersistentEngine::createTapQueue(const void *cookie,
if (nCheckpoints > 0) {
if (nuserdata < ((sizeof(uint16_t) + sizeof(uint64_t)) * nCheckpoints)) {
LOG(EXTENSION_LOG_WARNING, "# of checkpoint Ids not matched. "
- "Reject connection request from %s\n", name.c_str());
+ "Reject connection request from %s\n", tq_name.c_str());
return false;
}
for (uint16_t j = 0; j < nCheckpoints; ++j) {
@@ -1859,12 +1860,12 @@ bool EventuallyPersistentEngine::createTapQueue(const void *cookie,
isClosedCheckpointOnly = closedCheckpointOnly > 0 ? true : false;
}
- TapProducer *tp = dynamic_cast<TapProducer*>(tapConnMap->findByName(name));
+ TapProducer *tp = dynamic_cast<TapProducer*>(tapConnMap->findByName(tq_name));
if (tp && tp->isConnected() && !tp->doDisconnect() && isRegisteredClient) {
return false;
}
- tapConnMap->newProducer(cookie, name, flags,
+ tapConnMap->newProducer(cookie, tq_name, flags,
backfillAge,
static_cast<int>(configuration.getTapKeepalive()),
isRegisteredClient,
@@ -3104,7 +3105,7 @@ ENGINE_ERROR_CODE EventuallyPersistentEngine::doKeyStats(const void *cookie,
Item *it = NULL;
shared_ptr<Item> diskItem;
struct key_stats kstats;
- rel_time_t now = ep_current_time();
+
if (fetchLookupResult(cookie, &it)) {
diskItem.reset(it); // Will be null if the key was not found
if (!validate) {
@@ -3595,9 +3596,9 @@ ENGINE_ERROR_CODE EventuallyPersistentEngine::deregisterTapClient(const void *co
ADD_RESPONSE response)
{
std::string tap_name = "eq_tapq:";
- std::string name((const char*)request->bytes + sizeof(request->bytes) +
+ std::string tq_name((const char*)request->bytes + sizeof(request->bytes) +
request->request.extlen, ntohs(request->request.keylen));
- tap_name.append(name);
+ tap_name.append(tq_name);
// Close the tap connection for the registered TAP client and remove its checkpoint cursors.
bool rv = tapConnMap->closeTapConnectionByName(tap_name);
View
@@ -130,7 +130,6 @@ int main(int argc, char **argv) {
exit(EXIT_FAILURE);
}
- time_t t = time(NULL);
ofstream headerfile(hfile);
char* macro = strdup(hfile);
str_replace_char(macro, '/', '_');

0 comments on commit 845a1e4

Please sign in to comment.