00001 /*- 00002 * See the file LICENSE for redistribution information. 00003 * 00004 * Copyright (c) 1996-2005 00005 * Sleepycat Software. All rights reserved. 00006 */ 00007 /* 00008 * Copyright (c) 1995, 1996 00009 * The President and Fellows of Harvard University. All rights reserved. 00010 * 00011 * Redistribution and use in source and binary forms, with or without 00012 * modification, are permitted provided that the following conditions 00013 * are met: 00014 * 1. Redistributions of source code must retain the above copyright 00015 * notice, this list of conditions and the following disclaimer. 00016 * 2. Redistributions in binary form must reproduce the above copyright 00017 * notice, this list of conditions and the following disclaimer in the 00018 * documentation and/or other materials provided with the distribution. 00019 * 3. Neither the name of the University nor the names of its contributors 00020 * may be used to endorse or promote products derived from this software 00021 * without specific prior written permission. 00022 * 00023 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 00024 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00025 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00026 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 00027 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00028 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 00029 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00030 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00031 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00032 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00033 * SUCH DAMAGE. 00034 * 00035 * $Id: db_dispatch.h,v 12.5 2005/10/19 15:10:44 bostic Exp $ 00036 */ 00037 00038 #ifndef _DB_DISPATCH_H_ 00039 #define _DB_DISPATCH_H_ 00040 00041 /* 00042 * Declarations and typedefs for the list of transaction IDs used during 00043 * recovery. This is a generic list used to pass along whatever information 00044 * we need during recovery. 00045 */ 00046 typedef enum { 00047 TXNLIST_DELETE, 00048 TXNLIST_LSN, 00049 TXNLIST_PGNO, 00050 TXNLIST_TXNID 00051 } db_txnlist_type; 00052 00053 #define DB_TXNLIST_MASK(hp, n) (n % hp->nslots) 00054 struct __db_txnhead { 00055 u_int32_t maxid; /* Maximum transaction id. */ 00056 DB_LSN maxlsn; /* Maximum commit lsn. */ 00057 DB_LSN ckplsn; /* LSN of last retained checkpoint. */ 00058 DB_LSN trunc_lsn; /* Lsn to which we are going to truncate; 00059 * make sure we abort anyone after this. */ 00060 u_int32_t generation; /* Current generation number. */ 00061 u_int32_t gen_alloc; /* Number of generations allocated. */ 00062 struct { 00063 u_int32_t generation; 00064 u_int32_t txn_min; 00065 u_int32_t txn_max; 00066 } *gen_array; /* Array of txnids associated with a gen. */ 00067 u_int nslots; 00068 LIST_HEAD(__db_headlink, __db_txnlist) head[1]; 00069 }; 00070 00071 #define DB_LSN_STACK_SIZE 4 00072 struct __db_txnlist { 00073 db_txnlist_type type; 00074 LIST_ENTRY(__db_txnlist) links; 00075 union { 00076 struct { 00077 u_int32_t txnid; 00078 u_int32_t generation; 00079 u_int32_t status; 00080 } t; 00081 struct { 00082 u_int32_t stack_size; 00083 u_int32_t stack_indx; 00084 DB_LSN *lsn_stack; 00085 } l; 00086 struct { 00087 u_int32_t nentries; 00088 u_int32_t maxentry; 00089 int32_t locked; 00090 char *fname; 00091 int32_t fileid; 00092 db_pgno_t *pgno_array; 00093 u_int8_t uid[DB_FILE_ID_LEN]; 00094 } p; 00095 } u; 00096 }; 00097 00098 /* 00099 * States for limbo list processing. 00100 */ 00101 typedef enum { 00102 LIMBO_NORMAL, /* Normal processing. */ 00103 LIMBO_PREPARE, /* We are preparing a transaction. */ 00104 LIMBO_RECOVER, /* We are in recovery. */ 00105 LIMBO_TIMESTAMP, /* We are recovering to a timestamp. */ 00106 LIMBO_COMPENSATE /* After recover to ts, generate log records. */ 00107 } db_limbo_state; 00108 00109 #endif /* !_DB_DISPATCH_H_ */