db_upgrade.h
上传用户:tsgydb
上传日期:2007-04-14
资源大小:10674k
文件大小:6k
源码类别:

MySQL数据库

开发平台:

Visual C++

  1. /*-
  2.  * See the file LICENSE for redistribution information.
  3.  *
  4.  * Copyright (c) 1996, 1997, 1998, 1999, 2000
  5.  * Sleepycat Software.  All rights reserved.
  6.  *
  7.  * $Id: db_upgrade.h,v 1.5 2000/11/16 23:40:56 ubell Exp $
  8.  */
  9. #ifndef _DB_UPGRADE_H_
  10. #define _DB_UPGRADE_H_
  11. /*
  12.  * This file defines the metadata pages from the previous release.
  13.  * These structures are only used to upgrade old versions of databases.
  14.  */
  15. /* Structures from the 3.1 release */
  16. /*
  17.  * QAM Meta data page structure
  18.  *
  19.  */
  20. typedef struct _qmeta31 {
  21. DBMETA    dbmeta; /* 00-71: Generic meta-data header. */
  22. u_int32_t start; /* 72-75: Start offset. */
  23. u_int32_t first_recno; /* 76-79: First not deleted record. */
  24. u_int32_t cur_recno; /* 80-83: Last recno allocated. */
  25. u_int32_t re_len; /* 84-87: Fixed-length record length. */
  26. u_int32_t re_pad; /* 88-91: Fixed-length record pad. */
  27. u_int32_t rec_page; /* 92-95: Records Per Page. */
  28. /*
  29.  * Minimum page size is 128.
  30.  */
  31. } QMETA31;
  32. /* Structures from the 3.0 release */
  33. typedef struct _dbmeta30 {
  34. DB_LSN   lsn; /* 00-07: LSN. */
  35. db_pgno_t pgno; /* 08-11: Current page number. */
  36. u_int32_t magic; /* 12-15: Magic number. */
  37. u_int32_t version; /* 16-19: Version. */
  38. u_int32_t pagesize; /* 20-23: Pagesize. */
  39. u_int8_t  unused1[1]; /*    24: Unused. */
  40. u_int8_t  type; /*    25: Page type. */
  41. u_int8_t  unused2[2]; /* 26-27: Unused. */
  42. u_int32_t free; /* 28-31: Free list page number. */
  43. u_int32_t flags; /* 32-35: Flags: unique to each AM. */
  44. /* 36-55: Unique file ID. */
  45. u_int8_t  uid[DB_FILE_ID_LEN];
  46. } DBMETA30;
  47. /************************************************************************
  48.  BTREE METADATA PAGE LAYOUT
  49.  ************************************************************************/
  50. typedef struct _btmeta30 {
  51. DBMETA30 dbmeta; /* 00-55: Generic meta-data header. */
  52. u_int32_t maxkey; /* 56-59: Btree: Maxkey. */
  53. u_int32_t minkey; /* 60-63: Btree: Minkey. */
  54. u_int32_t re_len; /* 64-67: Recno: fixed-length record length. */
  55. u_int32_t re_pad; /* 68-71: Recno: fixed-length record pad. */
  56. u_int32_t root; /* 72-75: Root page. */
  57. /*
  58.  * Minimum page size is 128.
  59.  */
  60. } BTMETA30;
  61. /************************************************************************
  62.  HASH METADATA PAGE LAYOUT
  63.  ************************************************************************/
  64. typedef struct _hashmeta30 {
  65. DBMETA30 dbmeta; /* 00-55: Generic meta-data page header. */
  66. u_int32_t max_bucket; /* 56-59: ID of Maximum bucket in use */
  67. u_int32_t high_mask; /* 60-63: Modulo mask into table */
  68. u_int32_t low_mask; /* 64-67: Modulo mask into table lower half */
  69. u_int32_t ffactor; /* 68-71: Fill factor */
  70. u_int32_t nelem; /* 72-75: Number of keys in hash table */
  71. u_int32_t h_charkey; /* 76-79: Value of hash(CHARKEY) */
  72. #define NCACHED30 32 /* number of spare points */
  73. /* 80-207: Spare pages for overflow */
  74. u_int32_t spares[NCACHED30];
  75. /*
  76.  * Minimum page size is 256.
  77.  */
  78. } HMETA30;
  79. /************************************************************************
  80.  QUEUE METADATA PAGE LAYOUT
  81.  ************************************************************************/
  82. /*
  83.  * QAM Meta data page structure
  84.  *
  85.  */
  86. typedef struct _qmeta30 {
  87. DBMETA30    dbmeta; /* 00-55: Generic meta-data header. */
  88. u_int32_t start; /* 56-59: Start offset. */
  89. u_int32_t first_recno; /* 60-63: First not deleted record. */
  90. u_int32_t cur_recno; /* 64-67: Last recno allocated. */
  91. u_int32_t re_len; /* 68-71: Fixed-length record length. */
  92. u_int32_t re_pad; /* 72-75: Fixed-length record pad. */
  93. u_int32_t rec_page; /* 76-79: Records Per Page. */
  94. /*
  95.  * Minimum page size is 128.
  96.  */
  97. } QMETA30;
  98. /* Structures from Release 2.x */
  99. /************************************************************************
  100.  BTREE METADATA PAGE LAYOUT
  101.  ************************************************************************/
  102. /*
  103.  * Btree metadata page layout:
  104.  */
  105. typedef struct _btmeta2X {
  106. DB_LSN   lsn; /* 00-07: LSN. */
  107. db_pgno_t pgno; /* 08-11: Current page number. */
  108. u_int32_t magic; /* 12-15: Magic number. */
  109. u_int32_t version; /* 16-19: Version. */
  110. u_int32_t pagesize; /* 20-23: Pagesize. */
  111. u_int32_t maxkey; /* 24-27: Btree: Maxkey. */
  112. u_int32_t minkey; /* 28-31: Btree: Minkey. */
  113. u_int32_t free; /* 32-35: Free list page number. */
  114. u_int32_t flags; /* 36-39: Flags. */
  115. u_int32_t re_len; /* 40-43: Recno: fixed-length record length. */
  116. u_int32_t re_pad; /* 44-47: Recno: fixed-length record pad. */
  117. /* 48-67: Unique file ID. */
  118. u_int8_t  uid[DB_FILE_ID_LEN];
  119. } BTMETA2X;
  120. /************************************************************************
  121.  HASH METADATA PAGE LAYOUT
  122.  ************************************************************************/
  123. /*
  124.  * Hash metadata page layout:
  125.  */
  126. /* Hash Table Information */
  127. typedef struct hashhdr { /* Disk resident portion */
  128. DB_LSN lsn; /* 00-07: LSN of the header page */
  129. db_pgno_t pgno; /* 08-11: Page number (btree compatibility). */
  130. u_int32_t magic; /* 12-15: Magic NO for hash tables */
  131. u_int32_t version; /* 16-19: Version ID */
  132. u_int32_t pagesize; /* 20-23: Bucket/Page Size */
  133. u_int32_t ovfl_point; /* 24-27: Overflow page allocation location */
  134. u_int32_t last_freed; /* 28-31: Last freed overflow page pgno */
  135. u_int32_t max_bucket; /* 32-35: ID of Maximum bucket in use */
  136. u_int32_t high_mask; /* 36-39: Modulo mask into table */
  137. u_int32_t low_mask; /* 40-43: Modulo mask into table lower half */
  138. u_int32_t ffactor; /* 44-47: Fill factor */
  139. u_int32_t nelem; /* 48-51: Number of keys in hash table */
  140. u_int32_t h_charkey; /* 52-55: Value of hash(CHARKEY) */
  141. u_int32_t flags; /* 56-59: Allow duplicates. */
  142. #define NCACHED2X 32 /* number of spare points */
  143. /* 60-187: Spare pages for overflow */
  144. u_int32_t spares[NCACHED2X];
  145. /* 188-207: Unique file ID. */
  146. u_int8_t  uid[DB_FILE_ID_LEN];
  147. /*
  148.  * Minimum page size is 256.
  149.  */
  150. } HASHHDR;
  151. #endif