home *** CD-ROM | disk | FTP | other *** search
- /*
- * $RCSfile: closeLog.c,v $
- * $Revision: 1.1.1.1 $
- * $Date: 1996/05/04 21:55:50 $
- */
- /**********************************************************************
- * EXODUS Database Toolkit Software
- * Copyright (c) 1991 Computer Sciences Department, University of
- * Wisconsin -- Madison
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * THE COMPUTER SCIENCES DEPARTMENT OF THE UNIVERSITY OF WISCONSIN --
- * MADISON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION.
- * THE DEPARTMENT DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES
- * WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * The EXODUS Project Group requests users of this software to return
- * any improvements or extensions that they make to:
- *
- * EXODUS Project Group
- * c/o David J. DeWitt and Michael J. Carey
- * Computer Sciences Department
- * University of Wisconsin -- Madison
- * Madison, WI 53706
- *
- * or exodus@cs.wisc.edu
- *
- * In addition, the EXODUS Project Group requests that users grant the
- * Computer Sciences Department rights to redistribute these changes.
- **********************************************************************/
-
- #include "sysdefs.h"
- #include "ess.h"
- #include "checking.h"
- #include "trace.h"
- #include "error.h"
- #include "list.h"
- #include "pool.h"
- #include "tid.h"
- #include "io.h"
- #include "lock.h"
- #include "object.h"
- #include "msgdefs.h"
- #include "thread.h"
- #include "semaphore.h"
- #include "latch.h"
- #include "link.h"
- #include "lsn.h"
- #include "bf.h"
- #include "volume.h"
- #include "openlog.h"
- #include "logrecs.h"
- #include "trans.h"
- #include "threadstate.h"
- #include "log_intfuncs.h"
- #include "log_extfuncs.h"
- #include "bf_extfuncs.h"
- #include "thread_globals.h"
- #include "thread_funcs.h"
- #include "trans_globals.h"
-
-
- void
- closeLog (
-
- register OPENLOG *openLog
- )
- {
- TRACE(TR_LOG, TR_LEVEL_1);
-
- /*
- * check the openlog magic
- */
- CHECK_OPENLOG_MAGIC(openLog);
-
- /*
- * mark the log as quiesced
- */
- TransInfo.logState = L_QUIESCE;
-
- /*
- * check to see if there are any
- * transactions using the log
- */
- if (LIST_NOT_EMPTY( &(openLog->activeList) )) {
-
- /*
- * Wait on the close
- */
- if (waitList( &(openLog->closeList), THREAD_LOG_CLOSE_WAIT )) {
-
- SM_ERROR(TYPE_FATAL, Active->errno);
- }
- }
-
- /*
- * assert that the log is closed
- */
- SM_ASSERT(LEVEL_1, (LIST_EMPTY( &(openLog->activeList) )));
-
- /* force a new checkpoint to start and wait for it to complete */
- activateCheckpoint(TRUE, TRUE, TRUE);
-
-
- /*
- * force all of the buffers to disk
- */
- forceLog(openLog->logRecordCount);
-
- /*
- * unfix the checkpoint info
- */
- bf_UnfixPage(openLog->controlBuffer, BF_DEFAULT, FALSE);
-
- /*
- * close the write partition
- */
- if (bf_CloseGroup(openLog->writeGroup)) {
-
- SM_ERROR(TYPE_FATAL, Active->errno);
- }
-
- /*
- * close the read partition
- */
- if (bf_CloseGroup(openLog->readGroup)) {
-
- SM_ERROR(TYPE_FATAL, Active->errno);
- }
-
- /*
- * mark the log as offline
- */
- TransInfo.logState = L_OFFLINE;
- }
-