#include <afsconfig.h>
#include <afs/param.h>
+#include <roken.h>
#include <sys/types.h>
#include <string.h>
#include <rx/xdr.h>
#include <rx/rx.h>
#include <afs/afsutil.h>
+#include <afs/cellconfig.h>
#define UBIK_INTERNALS
#include "ubik.h"
* \brief sync site
*
* routine called when a non-sync site server goes down; restarts recovery
- * process to send missing server the new db when it comes back up.
+ * process to send missing server the new db when it comes back up for
+ * non-sync site servers.
*
* \note This routine should not do anything with variables used by non-sync site servers.
*/
int
-urecovery_LostServer(void)
+urecovery_LostServer(struct ubik_server *ts)
{
+ ubeacon_ReinitServer(ts);
#if !defined(AFS_PTHREAD_ENV)
/* No corresponding LWP_WaitProcess found anywhere for this -- klm */
LWP_NoYieldSignal(&urecovery_state);
} else if (opcode == LOGABORT)
panic("log abort\n");
else if (opcode == LOGEND) {
+ struct ubik_version version;
tpos += 4;
code =
(*adbase->read) (adbase, LOGFILE, (char *)buffer, tpos,
2 * sizeof(afs_int32));
if (code != 2 * sizeof(afs_int32))
return UBADLOG;
- code = (*adbase->setlabel) (adbase, 0, (ubik_version *)buffer);
+ version.epoch = ntohl(buffer[0]);
+ version.counter = ntohl(buffer[1]);
+ code = (*adbase->setlabel) (adbase, 0, &version);
if (code)
return code;
+ ubik_print("Successfully replayed log for interrupted "
+ "transaction; db version is now %ld.%ld\n",
+ (long) version.epoch, (long) version.counter);
logIsGood = 1;
break; /* all done now */
} else if (opcode == LOGTRUNCATE) {
struct ubik_server *bestServer = NULL;
struct ubik_server *ts;
int dbok, doingRPC, now;
- afs_int32 lastProbeTime, lastDBVCheck;
+ afs_int32 lastProbeTime;
/* if we're the sync site, the best db version we've found yet */
static struct ubik_version bestDBVersion;
struct ubik_version tversion;
char hoststr[16];
#ifndef OLD_URECOVERY
char pbuffer[1028];
- int flen, fd = -1;
+ int fd = -1;
afs_int32 pass;
#endif
/* otherwise, begin interaction */
urecovery_state = 0;
lastProbeTime = 0;
- lastDBVCheck = 0;
while (1) {
/* Run through this loop every 4 seconds */
tv.tv_sec = 4;
*/
urecovery_state &= ~UBIK_RECHAVEDB;
}
- lastDBVCheck = FT_ApproxTime();
urecovery_state |= UBIK_RECFOUNDDB;
urecovery_state &= ~UBIK_RECSENTDB;
}
goto FetchEndCall;
}
#ifndef OLD_URECOVERY
- flen = length;
afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.TMP", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file);
fd = open(pbuffer, O_CREAT | O_RDWR | O_TRUNC, 0600);
if (fd < 0) {