db_upgrade.h

Go to the documentation of this file.
00001 /*-
00002  * See the file LICENSE for redistribution information.
00003  *
00004  * Copyright (c) 1996, 1997, 1998, 1999, 2000
00005  *      Sleepycat Software.  All rights reserved.
00006  *
00007  * $Id: db__upgrade_8h-source.html,v 1.1 2008/06/08 10:18:22 sebdiaz Exp $
00008  */
00009 
00010 #ifndef _DB_UPGRADE_H_
00011 #define _DB_UPGRADE_H_
00012 
00013 /*
00014  * This file defines the metadata pages from the previous release.
00015  * These structures are only used to upgrade old versions of databases.
00016  */
00017 
00018 /* Structures from the 3.0 release */
00019 
00020 typedef struct _dbmeta30 {
00021         DB_LSN    lsn;          /* 00-07: LSN. */
00022         db_pgno_t pgno;         /* 08-11: Current page number. */
00023         u_int32_t magic;        /* 12-15: Magic number. */
00024         u_int32_t version;      /* 16-19: Version. */
00025         u_int32_t pagesize;     /* 20-23: Pagesize. */
00026         u_int8_t  unused1[1];   /*    24: Unused. */
00027         u_int8_t  type;         /*    25: Page type. */
00028         u_int8_t  unused2[2];   /* 26-27: Unused. */
00029         u_int32_t free;         /* 28-31: Free list page number. */
00030         u_int32_t flags;        /* 32-35: Flags: unique to each AM. */
00031                                 /* 36-55: Unique file ID. */
00032         u_int8_t  uid[DB_FILE_ID_LEN];
00033 } DBMETA30;
00034 
00035 /************************************************************************
00036  BTREE METADATA PAGE LAYOUT
00037  ************************************************************************/
00038 typedef struct _btmeta30 {
00039         DBMETA30        dbmeta; /* 00-55: Generic meta-data header. */
00040 
00041         u_int32_t maxkey;       /* 56-59: Btree: Maxkey. */
00042         u_int32_t minkey;       /* 60-63: Btree: Minkey. */
00043         u_int32_t re_len;       /* 64-67: Recno: fixed-length record length. */
00044         u_int32_t re_pad;       /* 68-71: Recno: fixed-length record pad. */
00045         u_int32_t root;         /* 72-75: Root page. */
00046 
00047         /*
00048          * Minimum page size is 128.
00049          */
00050 } BTMETA30;
00051 
00052 /************************************************************************
00053  HASH METADATA PAGE LAYOUT
00054  ************************************************************************/
00055 typedef struct _hashmeta30 {
00056         DBMETA30 dbmeta;        /* 00-55: Generic meta-data page header. */
00057 
00058         u_int32_t max_bucket;   /* 56-59: ID of Maximum bucket in use */
00059         u_int32_t high_mask;    /* 60-63: Modulo mask into table */
00060         u_int32_t low_mask;     /* 64-67: Modulo mask into table lower half */
00061         u_int32_t ffactor;      /* 68-71: Fill factor */
00062         u_int32_t nelem;        /* 72-75: Number of keys in hash table */
00063         u_int32_t h_charkey;    /* 76-79: Value of hash(CHARKEY) */
00064 #define NCACHED30       32              /* number of spare points */
00065                                 /* 80-207: Spare pages for overflow */
00066         u_int32_t spares[NCACHED30];
00067 
00068         /*
00069          * Minimum page size is 256.
00070          */
00071 } HMETA30;
00072 
00073 /************************************************************************
00074  QUEUE METADATA PAGE LAYOUT
00075  ************************************************************************/
00076 /*
00077  * QAM Meta data page structure
00078  *
00079  */
00080 typedef struct _qmeta30 {
00081         DBMETA30    dbmeta;     /* 00-55: Generic meta-data header. */
00082 
00083         u_int32_t start;        /* 56-59: Start offset. */
00084         u_int32_t first_recno;  /* 60-63: First not deleted record. */
00085         u_int32_t cur_recno;    /* 64-67: Last recno allocated. */
00086         u_int32_t re_len;       /* 68-71: Fixed-length record length. */
00087         u_int32_t re_pad;       /* 72-75: Fixed-length record pad. */
00088         u_int32_t rec_page;     /* 76-79: Records Per Page. */
00089 
00090         /*
00091          * Minimum page size is 128.
00092          */
00093 } QMETA30;
00094 
00095 /* Structures from Release 2.x */
00096 
00097 /************************************************************************
00098  BTREE METADATA PAGE LAYOUT
00099  ************************************************************************/
00100 
00101 /*
00102  * Btree metadata page layout:
00103  */
00104 typedef struct _btmeta2X {
00105         DB_LSN    lsn;          /* 00-07: LSN. */
00106         db_pgno_t pgno;         /* 08-11: Current page number. */
00107         u_int32_t magic;        /* 12-15: Magic number. */
00108         u_int32_t version;      /* 16-19: Version. */
00109         u_int32_t pagesize;     /* 20-23: Pagesize. */
00110         u_int32_t maxkey;       /* 24-27: Btree: Maxkey. */
00111         u_int32_t minkey;       /* 28-31: Btree: Minkey. */
00112         u_int32_t free;         /* 32-35: Free list page number. */
00113         u_int32_t flags;        /* 36-39: Flags. */
00114         u_int32_t re_len;       /* 40-43: Recno: fixed-length record length. */
00115         u_int32_t re_pad;       /* 44-47: Recno: fixed-length record pad. */
00116                                 /* 48-67: Unique file ID. */
00117         u_int8_t  uid[DB_FILE_ID_LEN];
00118 } BTMETA2X;
00119 
00120 /************************************************************************
00121  HASH METADATA PAGE LAYOUT
00122  ************************************************************************/
00123 
00124 /*
00125  * Hash metadata page layout:
00126  */
00127 /* Hash Table Information */
00128 typedef struct hashhdr {        /* Disk resident portion */
00129         DB_LSN  lsn;            /* 00-07: LSN of the header page */
00130         db_pgno_t pgno;         /* 08-11: Page number (btree compatibility). */
00131         u_int32_t magic;        /* 12-15: Magic NO for hash tables */
00132         u_int32_t version;      /* 16-19: Version ID */
00133         u_int32_t pagesize;     /* 20-23: Bucket/Page Size */
00134         u_int32_t ovfl_point;   /* 24-27: Overflow page allocation location */
00135         u_int32_t last_freed;   /* 28-31: Last freed overflow page pgno */
00136         u_int32_t max_bucket;   /* 32-35: ID of Maximum bucket in use */
00137         u_int32_t high_mask;    /* 36-39: Modulo mask into table */
00138         u_int32_t low_mask;     /* 40-43: Modulo mask into table lower half */
00139         u_int32_t ffactor;      /* 44-47: Fill factor */
00140         u_int32_t nelem;        /* 48-51: Number of keys in hash table */
00141         u_int32_t h_charkey;    /* 52-55: Value of hash(CHARKEY) */
00142         u_int32_t flags;        /* 56-59: Allow duplicates. */
00143 #define NCACHED2X       32              /* number of spare points */
00144                                 /* 60-187: Spare pages for overflow */
00145         u_int32_t spares[NCACHED2X];
00146                                 /* 188-207: Unique file ID. */
00147         u_int8_t  uid[DB_FILE_ID_LEN];
00148 
00149         /*
00150          * Minimum page size is 256.
00151          */
00152 } HASHHDR;
00153 
00154 #endif

Generated on Sun Jun 8 10:56:37 2008 for GNUmifluz by  doxygen 1.5.5