ttid.counter = ubik_dbase->writeTidCounter;
} else
ttid.counter = ubik_dbase->tidCounter + 1;
-#if defined(UBIK_PAUSE)
- ubik_dbase->flags |= DBVOTING;
-#endif /* UBIK_PAUSE */
/* now analyze return codes, counting up our votes */
yesVotes = 0; /* count how many to ensure we have quorum */
if (i < oldestYesVote)
oldestYesVote = i;
}
-#if defined(UBIK_PAUSE)
- ubik_dbase->flags &= ~DBVOTING;
-#endif /* UBIK_PAUSE */
/* now decide if we have enough votes to become sync site.
* Note that we can still get enough votes even if we didn't for ourself. */
{
struct ubik_dbase *dbase;
-#if defined(UBIK_PAUSE)
- /* Another thread is trying to lock this transaction.
- * That can only be an RPC doing SDISK_Lock.
- * Unlock the transaction, 'cause otherwise the other
- * thread will never wake up. Don't free it because
- * the caller will do that already.
- */
- if (atrans->flags & TRSETLOCK) {
- atrans->flags |= TRSTALE;
- ulock_relLock(atrans);
- return UINTERNAL;
- }
-#endif /* UBIK_PAUSE */
if (!(atrans->flags & TRDONE))
udisk_abort(atrans);
dbase = atrans->dbase;
}
/* Create new lock record and add to spec'd transaction:
- * #if defined(UBIK_PAUSE)
- * * locktype. Before doing that, set TRSETLOCK,
- * * to tell udisk_end that another thread (us) is waiting.
- * #else
- * * locktype. This field also tells us if the thread is
- * * waiting for a lock: It will be equal to LOCKWAIT.
- * #endif
+ * locktype. This field also tells us if the thread is
+ * waiting for a lock: It will be equal to LOCKWAIT.
*/
-#if defined(UBIK_PAUSE)
- if (atrans->flags & TRSETLOCK) {
- printf("Ubik: Internal Error: TRSETLOCK already set?\n");
- return EBUSY;
- }
- atrans->flags |= TRSETLOCK;
-#else
atrans->locktype = LOCKWAIT;
-#endif /* UBIK_PAUSE */
DBRELE(dbase);
if (atrans->flags & TRREADWRITE) {
/* noop; don't actually lock anything for TRREADWRITE */
}
DBHOLD(dbase);
atrans->locktype = atype;
-#if defined(UBIK_PAUSE)
- atrans->flags &= ~TRSETLOCK;
-#if 0
- /* We don't do this here, because this can only happen in SDISK_Lock,
- * and there's already code there to catch this condition.
- */
- if (atrans->flags & TRSTALE) {
- udisk_end(atrans);
- return UINTERNAL;
- }
-#endif
-#endif /* UBIK_PAUSE */
/*
*ubik_print("Ubik: DEBUG: Thread 0x%x took %s lock\n", lwp_cpptr,
|| atid->counter > ubik_currentTrans->tid.counter || abortalways) {
/* don't match, abort it */
/* If the thread is not waiting for lock - ok to end it */
-#if !defined(UBIK_PAUSE)
if (ubik_currentTrans->locktype != LOCKWAIT) {
-#endif /* UBIK_PAUSE */
udisk_end(ubik_currentTrans);
-#if !defined(UBIK_PAUSE)
}
-#endif /* UBIK_PAUSE */
ubik_currentTrans = (struct ubik_trans *)0;
}
}
urecovery_state |= UBIK_RECFOUNDDB;
urecovery_state &= ~UBIK_RECSENTDB;
}
-#if defined(UBIK_PAUSE)
- /* it's not possible for UBIK_RECFOUNDDB not to be set here.
- * However, we might have lost UBIK_RECSYNCSITE, and that
- * IS important.
- */
- if (!(urecovery_state & UBIK_RECSYNCSITE))
- continue; /* lost sync */
-#else
if (!(urecovery_state & UBIK_RECFOUNDDB))
continue; /* not ready */
-#endif /* UBIK_PAUSE */
/* If we, the sync site, do not have the best db version, then
* go and get it from the server that does.
#endif
DBRELE(ubik_dbase);
}
-#if defined(UBIK_PAUSE)
- if (!(urecovery_state & UBIK_RECSYNCSITE))
- continue; /* lost sync */
-#endif /* UBIK_PAUSE */
if (!(urecovery_state & UBIK_RECHAVEDB))
continue; /* not ready */
}
/* If the thread is not waiting for lock - ok to end it */
-#if !defined(UBIK_PAUSE)
if (ubik_currentTrans->locktype != LOCKWAIT) {
-#endif /* UBIK_PAUSE */
udisk_end(ubik_currentTrans);
-#if !defined(UBIK_PAUSE)
}
-#endif /* UBIK_PAUSE */
ubik_currentTrans = (struct ubik_trans *)0;
DBRELE(dbase);
return 0;
code = udisk_abort(ubik_currentTrans);
/* If the thread is not waiting for lock - ok to end it */
-#if !defined(UBIK_PAUSE)
if (ubik_currentTrans->locktype != LOCKWAIT) {
-#endif /* UBIK_PAUSE */
udisk_end(ubik_currentTrans);
-#if !defined(UBIK_PAUSE)
}
-#endif /* UBIK_PAUSE */
ubik_currentTrans = (struct ubik_trans *)0;
DBRELE(dbase);
return code;
struct ubik_trans *jt;
struct ubik_trans *tt;
afs_int32 code;
-#if defined(UBIK_PAUSE)
- int count;
-#endif /* UBIK_PAUSE */
if (readAny > 1 && ubik_SyncWriterCacheProc == NULL) {
/* it's not safe to use ubik_BeginTransReadAnyWrite without a
if ((transMode != UBIK_READTRANS) && readAny)
return UBADTYPE;
DBHOLD(dbase);
-#if defined(UBIK_PAUSE)
- /* if we're polling the slave sites, wait until the returns
- * are all in. Otherwise, the urecovery_CheckTid call may
- * glitch us.
- */
- if (transMode == UBIK_WRITETRANS)
- for (count = 75; dbase->flags & DBVOTING; --count) {
- DBRELE(dbase);
-#ifdef GRAND_PAUSE_DEBUGGING
- if (count == 75)
- fprintf(stderr,
- "%ld: myport=%d: BeginTrans is waiting 'cause of voting conflict\n",
- time(0), ntohs(ubik_callPortal));
- else
-#endif
- if (count <= 0) {
-#if 1
- fprintf(stderr,
- "%ld: myport=%d: BeginTrans failed because of voting conflict\n",
- time(0), ntohs(ubik_callPortal));
-#endif
- return UNOQUORUM; /* a white lie */
- }
-#ifdef AFS_PTHREAD_ENV
- sleep(2);
-#else
- IOMGR_Sleep(2);
-#endif
- DBHOLD(dbase);
- }
-#endif /* UBIK_PAUSE */
if (urecovery_AllBetter(dbase, readAny) == 0) {
DBRELE(dbase);
return UNOQUORUM;
/*! \name ubik_lock types */
#define LOCKREAD 1
#define LOCKWRITE 2
-#if !defined(UBIK_PAUSE)
#define LOCKWAIT 3
-#endif /* UBIK_PAUSE */
/*\}*/
/*! \name ubik client flags */
/*! \name ubik_dbase flags */
#define DBWRITING 1 /*!< are any write trans. in progress */
-#if defined(UBIK_PAUSE)
-#define DBVOTING 2 /*!< the beacon task is polling */
-#endif /* UBIK_PAUSE */
/*\}*/
/*!\name ubik trans flags */
#define TRDONE 1 /*!< commit or abort done */
#define TRABORT 2 /*!< if #TRDONE, tells if aborted */
#define TRREADANY 4 /*!< read any data available in trans */
-#if defined(UBIK_PAUSE)
-#define TRSETLOCK 8 /*!< SetLock is using trans */
-#define TRSTALE 16 /*!< udisk_end during getLock */
-#endif /* UBIK_PAUSE */
#define TRCACHELOCKED 32 /*!< this trans has locked dbase->cache_lock
* (meaning, this trans has called
* ubik_CheckCache at some point */