Main Page | Class Hierarchy | Data Structures | Directories | File List | Data Fields | Related Pages

db_upgrade.h

00001 /*-
00002  * See the file LICENSE for redistribution information.
00003  *
00004  * Copyright (c) 1996-2005
00005  *      Sleepycat Software.  All rights reserved.
00006  *
00007  * $Id: db_upgrade.h,v 12.1 2005/06/16 20:21:47 bostic 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.1 release */
00019 typedef struct _dbmeta31 {
00020         DB_LSN    lsn;          /* 00-07: LSN. */
00021         db_pgno_t pgno;         /* 08-11: Current page number. */
00022         u_int32_t magic;        /* 12-15: Magic number. */
00023         u_int32_t version;      /* 16-19: Version. */
00024         u_int32_t pagesize;     /* 20-23: Pagesize. */
00025         u_int8_t  unused1[1];   /*    24: Unused. */
00026         u_int8_t  type;         /*    25: Page type. */
00027         u_int8_t  unused2[2];   /* 26-27: Unused. */
00028         u_int32_t free;         /* 28-31: Free list page number. */
00029         DB_LSN    unused3;      /* 36-39: Unused. */
00030         u_int32_t key_count;    /* 40-43: Cached key count. */
00031         u_int32_t record_count; /* 44-47: Cached record count. */
00032         u_int32_t flags;        /* 48-51: Flags: unique to each AM. */
00033                                 /* 52-71: Unique file ID. */
00034         u_int8_t  uid[DB_FILE_ID_LEN];
00035 } DBMETA31;
00036 
00037 typedef struct _btmeta31 {
00038         DBMETA31  dbmeta;               /* 00-71: Generic meta-data header. */
00039 
00040         u_int32_t maxkey;       /* 72-75: Btree: Maxkey. */
00041         u_int32_t minkey;       /* 76-79: Btree: Minkey. */
00042         u_int32_t re_len;       /* 80-83: Recno: fixed-length record length. */
00043         u_int32_t re_pad;       /* 84-87: Recno: fixed-length record pad. */
00044         u_int32_t root;         /* 88-92: Root page. */
00045 
00046         /*
00047          * Minimum page size is 128.
00048          */
00049 } BTMETA31;
00050 
00051 /************************************************************************
00052  HASH METADATA PAGE LAYOUT
00053  ************************************************************************/
00054 typedef struct _hashmeta31 {
00055         DBMETA31 dbmeta;        /* 00-71: Generic meta-data page header. */
00056 
00057         u_int32_t max_bucket;   /* 72-75: ID of Maximum bucket in use */
00058         u_int32_t high_mask;    /* 76-79: Modulo mask into table */
00059         u_int32_t low_mask;     /* 80-83: Modulo mask into table lower half */
00060         u_int32_t ffactor;      /* 84-87: Fill factor */
00061         u_int32_t nelem;        /* 88-91: Number of keys in hash table */
00062         u_int32_t h_charkey;    /* 92-95: Value of hash(CHARKEY) */
00063 #define NCACHED 32              /* number of spare points */
00064                                 /* 96-223: Spare pages for overflow */
00065         u_int32_t spares[NCACHED];
00066 
00067         /*
00068          * Minimum page size is 256.
00069          */
00070 } HMETA31;
00071 
00072 /*
00073  * QAM Meta data page structure
00074  *
00075  */
00076 typedef struct _qmeta31 {
00077         DBMETA31 dbmeta;        /* 00-71: Generic meta-data header. */
00078 
00079         u_int32_t start;        /* 72-75: Start offset. */
00080         u_int32_t first_recno;  /* 76-79: First not deleted record. */
00081         u_int32_t cur_recno;    /* 80-83: Last recno allocated. */
00082         u_int32_t re_len;       /* 84-87: Fixed-length record length. */
00083         u_int32_t re_pad;       /* 88-91: Fixed-length record pad. */
00084         u_int32_t rec_page;     /* 92-95: Records Per Page. */
00085 
00086         /*
00087          * Minimum page size is 128.
00088          */
00089 } QMETA31;
00090 /* Structures from the 3.2 release */
00091 typedef struct _qmeta32 {
00092         DBMETA31 dbmeta;        /* 00-71: Generic meta-data header. */
00093 
00094         u_int32_t first_recno;  /* 72-75: First not deleted record. */
00095         u_int32_t cur_recno;    /* 76-79: Last recno allocated. */
00096         u_int32_t re_len;       /* 80-83: Fixed-length record length. */
00097         u_int32_t re_pad;       /* 84-87: Fixed-length record pad. */
00098         u_int32_t rec_page;     /* 88-91: Records Per Page. */
00099         u_int32_t page_ext;     /* 92-95: Pages per extent */
00100 
00101         /*
00102          * Minimum page size is 128.
00103          */
00104 } QMETA32;
00105 
00106 /* Structures from the 3.0 release */
00107 
00108 typedef struct _dbmeta30 {
00109         DB_LSN    lsn;          /* 00-07: LSN. */
00110         db_pgno_t pgno;         /* 08-11: Current page number. */
00111         u_int32_t magic;        /* 12-15: Magic number. */
00112         u_int32_t version;      /* 16-19: Version. */
00113         u_int32_t pagesize;     /* 20-23: Pagesize. */
00114         u_int8_t  unused1[1];   /*    24: Unused. */
00115         u_int8_t  type;         /*    25: Page type. */
00116         u_int8_t  unused2[2];   /* 26-27: Unused. */
00117         u_int32_t free;         /* 28-31: Free list page number. */
00118         u_int32_t flags;        /* 32-35: Flags: unique to each AM. */
00119                                 /* 36-55: Unique file ID. */
00120         u_int8_t  uid[DB_FILE_ID_LEN];
00121 } DBMETA30;
00122 
00123 /************************************************************************
00124  BTREE METADATA PAGE LAYOUT
00125  ************************************************************************/
00126 typedef struct _btmeta30 {
00127         DBMETA30        dbmeta; /* 00-55: Generic meta-data header. */
00128 
00129         u_int32_t maxkey;       /* 56-59: Btree: Maxkey. */
00130         u_int32_t minkey;       /* 60-63: Btree: Minkey. */
00131         u_int32_t re_len;       /* 64-67: Recno: fixed-length record length. */
00132         u_int32_t re_pad;       /* 68-71: Recno: fixed-length record pad. */
00133         u_int32_t root;         /* 72-75: Root page. */
00134 
00135         /*
00136          * Minimum page size is 128.
00137          */
00138 } BTMETA30;
00139 
00140 /************************************************************************
00141  HASH METADATA PAGE LAYOUT
00142  ************************************************************************/
00143 typedef struct _hashmeta30 {
00144         DBMETA30 dbmeta;        /* 00-55: Generic meta-data page header. */
00145 
00146         u_int32_t max_bucket;   /* 56-59: ID of Maximum bucket in use */
00147         u_int32_t high_mask;    /* 60-63: Modulo mask into table */
00148         u_int32_t low_mask;     /* 64-67: Modulo mask into table lower half */
00149         u_int32_t ffactor;      /* 68-71: Fill factor */
00150         u_int32_t nelem;        /* 72-75: Number of keys in hash table */
00151         u_int32_t h_charkey;    /* 76-79: Value of hash(CHARKEY) */
00152 #define NCACHED30       32              /* number of spare points */
00153                                 /* 80-207: Spare pages for overflow */
00154         u_int32_t spares[NCACHED30];
00155 
00156         /*
00157          * Minimum page size is 256.
00158          */
00159 } HMETA30;
00160 
00161 /************************************************************************
00162  QUEUE METADATA PAGE LAYOUT
00163  ************************************************************************/
00164 /*
00165  * QAM Meta data page structure
00166  *
00167  */
00168 typedef struct _qmeta30 {
00169         DBMETA30    dbmeta;     /* 00-55: Generic meta-data header. */
00170 
00171         u_int32_t start;        /* 56-59: Start offset. */
00172         u_int32_t first_recno;  /* 60-63: First not deleted record. */
00173         u_int32_t cur_recno;    /* 64-67: Last recno allocated. */
00174         u_int32_t re_len;       /* 68-71: Fixed-length record length. */
00175         u_int32_t re_pad;       /* 72-75: Fixed-length record pad. */
00176         u_int32_t rec_page;     /* 76-79: Records Per Page. */
00177 
00178         /*
00179          * Minimum page size is 128.
00180          */
00181 } QMETA30;
00182 
00183 /* Structures from Release 2.x */
00184 
00185 /************************************************************************
00186  BTREE METADATA PAGE LAYOUT
00187  ************************************************************************/
00188 
00189 /*
00190  * Btree metadata page layout:
00191  */
00192 typedef struct _btmeta2X {
00193         DB_LSN    lsn;          /* 00-07: LSN. */
00194         db_pgno_t pgno;         /* 08-11: Current page number. */
00195         u_int32_t magic;        /* 12-15: Magic number. */
00196         u_int32_t version;      /* 16-19: Version. */
00197         u_int32_t pagesize;     /* 20-23: Pagesize. */
00198         u_int32_t maxkey;       /* 24-27: Btree: Maxkey. */
00199         u_int32_t minkey;       /* 28-31: Btree: Minkey. */
00200         u_int32_t free;         /* 32-35: Free list page number. */
00201         u_int32_t flags;        /* 36-39: Flags. */
00202         u_int32_t re_len;       /* 40-43: Recno: fixed-length record length. */
00203         u_int32_t re_pad;       /* 44-47: Recno: fixed-length record pad. */
00204                                 /* 48-67: Unique file ID. */
00205         u_int8_t  uid[DB_FILE_ID_LEN];
00206 } BTMETA2X;
00207 
00208 /************************************************************************
00209  HASH METADATA PAGE LAYOUT
00210  ************************************************************************/
00211 
00212 /*
00213  * Hash metadata page layout:
00214  */
00215 /* Hash Table Information */
00216 typedef struct hashhdr {        /* Disk resident portion */
00217         DB_LSN  lsn;            /* 00-07: LSN of the header page */
00218         db_pgno_t pgno;         /* 08-11: Page number (btree compatibility). */
00219         u_int32_t magic;        /* 12-15: Magic NO for hash tables */
00220         u_int32_t version;      /* 16-19: Version ID */
00221         u_int32_t pagesize;     /* 20-23: Bucket/Page Size */
00222         u_int32_t ovfl_point;   /* 24-27: Overflow page allocation location */
00223         u_int32_t last_freed;   /* 28-31: Last freed overflow page pgno */
00224         u_int32_t max_bucket;   /* 32-35: ID of Maximum bucket in use */
00225         u_int32_t high_mask;    /* 36-39: Modulo mask into table */
00226         u_int32_t low_mask;     /* 40-43: Modulo mask into table lower half */
00227         u_int32_t ffactor;      /* 44-47: Fill factor */
00228         u_int32_t nelem;        /* 48-51: Number of keys in hash table */
00229         u_int32_t h_charkey;    /* 52-55: Value of hash(CHARKEY) */
00230         u_int32_t flags;        /* 56-59: Allow duplicates. */
00231 #define NCACHED2X       32              /* number of spare points */
00232                                 /* 60-187: Spare pages for overflow */
00233         u_int32_t spares[NCACHED2X];
00234                                 /* 188-207: Unique file ID. */
00235         u_int8_t  uid[DB_FILE_ID_LEN];
00236 
00237         /*
00238          * Minimum page size is 256.
00239          */
00240 } HASHHDR;
00241 
00242 #endif /* !_DB_UPGRADE_H_ */

Generated on Sun Dec 25 12:14:22 2005 for Berkeley DB 4.4.16 by  doxygen 1.4.2