diff --git a/inc/Utils.h b/inc/Utils.h index 6c552a1c4365e79dc0e09c18780fcb8911384899..1b0029570a00aeefbc593302f0c32f78316e4359 100644 --- a/inc/Utils.h +++ b/inc/Utils.h @@ -26,8 +26,8 @@ using std::get; using std::tuple_element; using std::tuple; -static pthread_mutex_t thread_counter_lock = PTHREAD_MUTEX_INITIALIZER; -static int thread_counter = 0; +//static pthread_mutex_t thread_counter_lock = PTHREAD_MUTEX_INITIALIZER; +//static int thread_counter = 0; vector<string> splitString(string s, string delimiter); string getIP(); diff --git a/src/Node.cpp b/src/Node.cpp index e06d49741515a7a9ef386f55a0784e38ebd63ee6..b514b32cff9fbc489b9821b9bd8b617ae61ae102 100644 --- a/src/Node.cpp +++ b/src/Node.cpp @@ -826,6 +826,7 @@ void Node::handleTcpMessage() if (inMsg.size() >= 4){ string mapleExe = inMsg[0], num_maples = inMsg[1], sdfsPre = inMsg[2], sdfs_dir = inMsg[3] + "-"; int workers = stoi(num_maples); + if (hashRing->nodePositions.size() == 1){ cout << "[ERROR] Not enough nodes for Maple" << endl; break;} if (workers > hashRing->nodePositions.size()-2) workers = hashRing->nodePositions.size()-2; int total_lines = 0; vector<tuple<string,int>> directory; @@ -841,7 +842,7 @@ void Node::handleTcpMessage() } cout << "[MAPLE] need to process " << to_string(total_lines) << endl; vector<tuple<string,string,string>> aliveNodes; - for (auto &e : membershipList) if (e.first.compare(nodeInformation.ip)) aliveNodes.push_back(e.first); + for (auto &e : membershipList) if (get<0>(e.first).compare(nodeInformation.ip)) aliveNodes.push_back(e.first); vector<tuple<string,string,string>> mapleNodes = randItems(workers, aliveNodes); string includedDebug = ""; for (auto &e : mapleNodes) { diff --git a/src/Utils.cpp b/src/Utils.cpp index 702d3b99a69c61c83d85d2bb8a407f02e441ef89..ee9c39c335b7bfd60ae9afc4399bf4ec435dbeec 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -31,7 +31,7 @@ string getIP(const char * host){ } return inet_ntoa(*(struct in_addr*)hp->h_addr_list[0]); } - +/* int new_thread_id() { int rv; pthread_mutex_lock(&thread_counter_lock); @@ -39,6 +39,7 @@ int new_thread_id() { pthread_mutex_unlock(&thread_counter_lock); return rv; } +*/ bool isInVector(vector<int> v, int i){ for(int element: v){