version = *((unsigned short *)(buffer+size));
size += sizeof(unsigned short);
threadid = *((unsigned int *)(buffer+size));
+ printf("Calling threadNotify\n");
threadNotify(oid,version,threadid);
free(buffer);
break;
#endif
#ifdef RECOVERY
- if(header->isBackup != 0)
+ printf("%s -> to notifyAll\n",__func__);
+ if(header->isBackup == 0) {
+ printf("%s -> called notifyAll\n",__func__);
notifyAll(&header->notifylist, OID(header), header->version);
+ }
else
clearNotifyList(OID(header));
#else
checkversion:
if (write_trylock(STATUSPTR(header))) { // Can acquire write lock
newversion = header->version;
+
+ // printf("%s -> newversion : %d versionarray : %d i : %d\n",__func__,newversion,*(versionarry + i),i);
if(newversion == *(versionarry + i)) {
//Add to the notify list
return;
} else {
//Send Update notification
+ printf("%s -> Call frm here\n",__func__);
msg[0] = THREAD_NOTIFY_RESPONSE;
*((unsigned int *)&msg[1]) = oid;
size = sizeof(unsigned int);
/* go through oid's notifylist and clear them */
void clearNotifyList(unsigned int oid)
{
-#ifdef DEBUG
+#ifndef DEBUG
printf("%s -> Entering\n",__func__);
#endif
}
else { // if i am the leader
updateLiveHosts();
- duplicateLostObjects(deadHost);
+
+ if(numLiveHostsInSystem == 1)
+ setReLocateObjHosts(deadHost);
+ else
+ duplicateLostObjects(deadHost);
if(updateLiveHostsCommit() != 0) {
printf("%s -> error updateLiveHostsCommit()\n",__func__);
header->version += 1;
if(header->notifylist != NULL) {
#ifdef RECOVERY
- if(header->isBackup != 0) // if it is primary obj, notify
+ printf("%s -> to notifyAll\n",__func__);
+ if(header->isBackup == 0) { // if it is primary obj, notify
+ printf("%s -> Called notifyAll\n",__func__);
notifyAll(&header->notifylist, OID(header), header->version);
+ }
else // if not, just clear the notification list
clearNotifyList(OID(header));
#else
+ printf("no way!\n");
notifyAll(&header->notifylist, OID(header), header->version);
#endif
}
/* Read response from the Participant */
char control;
recv_data(sd, &control, sizeof(char));
-
if (control==OBJECT_NOT_FOUND) {
printf("Error: in %s() THIS SHOULD NOT HAPPEN.....EXIT PROGRAM\n", __func__);
fflush(stdout);
return -1;
} else {
-#ifdef DEBUG
+#ifndef DEBUG
printf("%s -> Pmid = %s\n",__func__,midtoIPString(pmid));
#ifdef RECOVERY
printf("%s -> Bmid = %s\n",__func__,midtoIPString(bmid));
for(i = 0;i < numoid; i++) {
oid = oidarry[i];
-#ifdef DEBUG
+#ifndef DEBUG
printf("%s -> oid[%d] = %d\n",__func__,i,oidarry[i]);
#endif
*((unsigned int *)(&msg[1] + size)) = oid;
int objIsFound = 0, index = -1;
unsigned int i;
void *ptr;
-#ifdef DEBUG
+#ifndef DEBUG
printf("%s -> oid = %d vesion = %d tid = %d\n",__func__,oid,version,tid);
#endif
printf("threadnotify(): No such threadid is present %s, %d\n", __FILE__, __LINE__);
return;
} else {
+ printf("%s -> Get to this point1\n",__func__);
+ printf("%s -> ndata : %d\n",__func__,ndata);
+ printf("%s -> ndata->numoid : %d\n",__func__,ndata->numoid);
for(i = 0; i < (ndata->numoid); i++) {
if(ndata->oidarry[i] == oid) {
objIsFound = 1;
index = i;
}
}
+ printf("%s -> Get to this point2\n",__func__);
if(objIsFound == 0) {
printf("threadNotify(): Oid not found %s, %d\n", __FILE__, __LINE__);
return;
}
else {
+ printf("%s -> Get to this point3\n",__func__);
if(version <= ndata->versionarry[index]) {
printf("threadNotify(): New version %d has not changed since last version for oid = %d, %s, %d\n", version, oid, __FILE__, __LINE__);
return;
prehashRemove(oid);
}
#endif
+
+ printf("%s -> Get to this point4\n",__func__);
pthread_mutex_lock(&(ndata->threadnotify));
pthread_cond_signal(&(ndata->threadcond));
pthread_mutex_unlock(&(ndata->threadnotify));
status = -1;
} else {
bzero(msg, (1+sizeof(unsigned short) + 2*sizeof(unsigned int)));
+ printf("%s -> Calling THREAD_NOTIFY_RESPONSE\n",__func__);
msg[0] = THREAD_NOTIFY_RESPONSE;
*((unsigned int *)&msg[1]) = oid;
size = sizeof(unsigned int);