close(sd);
return;
} else {
+
//Send Update notification
msg[0] = THREAD_NOTIFY_RESPONSE;
*((unsigned int *)&msg[1]) = oid;
int sd;
int flag=1;
if((sd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
- printf("%s() Error: In creating socket at %s, %d\n", __func__, __FILE__, __LINE__);
+ fprintf(stderr,"%s() Error: In creating socket at %s, %d\n", __func__, __FILE__, __LINE__);
return -1;
}
setsockopt(sd, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, sizeof(flag));
remoteAddr.sin_addr.s_addr = htonl(mid);
if(connect(sd, (struct sockaddr *)&remoteAddr, sizeof(remoteAddr)) < 0) {
perror("socket connect: ");
- printf("%s(): Error %d connecting to %s:%d\n", __func__, errno, inet_ntoa(remoteAddr.sin_addr), LISTEN_PORT);
+ fprintf(stderr,"%s(): Error %d connecting to %s:%d\n", __func__, errno, inet_ntoa(remoteAddr.sin_addr), LISTEN_PORT);
close(sd);
return -1;
}
unsigned int origleader;
unsigned int temp_v_a;
int paxosRound;
+
+#ifdef RECOVERYSTATS
+/**************************************
+ * Global variables for Recovery stats
+ **************************************/
+int numRecovery=0;
+unsigned int deadMachine[8]={0,0,0,0,0,0,0,0};
+unsigned double elapsedTime[8] ={0,0,0,0,0,0,0,0};
+#endif
+
#endif
void printhex(unsigned char *, int);
else { // if i am the leader
updateLiveHosts();
duplicateLostObjects(deadHost);
- printf("%s -> got to this point\n",__func__);
if(updateLiveHostsCommit() != 0) {
printf("%s -> error updateLiveHostsCommit()\n",__func__);
#ifdef RECOVERY
void duplicateLostObjects(unsigned int mid){
- printf("Recovery Start");
+
+#ifdef RECOVERYSTATS
+ printf("Recovery Start\n");
+ numRecovery++;
time_t st = time(NULL);
time_t fi;
+
+ deadMachine[numRecovery-1] = mid;
+#endif
+
#ifndef DEBUG
printf("%s-> Start, mid: [%s]\n", __func__, midtoIPString(mid));
#endif
+
+
//this needs to be changed.
unsigned int backupMid = getBackupMachine(mid); // get backup machine of dead machine
freeSockWithLock(transPrefetchSockPool, backupMid, sd);
}
+#ifdef RECOVERYSTATS
fi = time(NULL);
-
- printf("time elapse = %d",fi-st);
+ elapsedTime[numRecovery-1] = fi-st;
+#endif
#ifndef DEBUG
printf("%s-> End\n", __func__);
#ifdef RECOVERY
#include "DSTM/interface_recovery/dstm.h"
#include "DSTM/interface_recovery/prelookup.h"
+
+#ifdef RECOVERYSTATS
+ extern int numRecovery;
+ extern unsigned int deadMachine[8];
+ extern unsigned int sizeOfRedupedData[8];
+ extern double elapsedtime[8];
+#endif
+
#else
#include "DSTM/interface/dstm.h"
#include "DSTM/interface/altprelookup.h"
#endif
void CALL11(___System______exit____I,int ___status___, int ___status___) {
+#ifdef RECOVERYSTATS
+ for(int i=0; i < numRecovery; i++) {
+ printf("Dead Machine = %s\n",midtoIPString(deadThread[i]));
+ printf("sizeOfRedupedData = %u\n",sizeOfRedupedData[i]);
+ printf("Elapsed Time = %.2f\n",elapsedTime[i]);
+ }
+#endif
+
#ifdef TRANSSTATS
printf("numTransCommit = %d\n", numTransCommit);
printf("numTransAbort = %d\n", numTransAbort);