Skip to content
Snippets Groups Projects
Commit 0bfc0a4e authored by ajf5's avatar ajf5
Browse files

logging

parent 3c97cad0
No related branches found
No related tags found
No related merge requests found
......@@ -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();
......
......@@ -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) {
......
......@@ -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){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment