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

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: btree.src,v 10.26 2000/12/12 17:40:23 bostic Exp $
  8.  */
  9. PREFIX bam
  10. INCLUDE #include "db_config.h"
  11. INCLUDE
  12. INCLUDE #ifndef NO_SYSTEM_INCLUDES
  13. INCLUDE #include <sys/types.h>
  14. INCLUDE
  15. INCLUDE #include <ctype.h>
  16. INCLUDE #include <errno.h>
  17. INCLUDE #include <string.h>
  18. INCLUDE #endif
  19. INCLUDE
  20. INCLUDE #include "db_int.h"
  21. INCLUDE #include "db_page.h"
  22. INCLUDE #include "db_dispatch.h"
  23. INCLUDE #include "db_am.h"
  24. INCLUDE #include "btree.h"
  25. INCLUDE #include "txn.h"
  26. INCLUDE
  27. /*
  28.  * BTREE-pg_alloc: used to record allocating a new page.
  29.  *
  30.  * meta_lsn: the meta-data page's original lsn.
  31.  * page_lsn: the allocated page's original lsn.
  32.  * pgno: the page allocated.
  33.  * next: the next page on the free list.
  34.  */
  35. BEGIN pg_alloc 51
  36. ARG fileid int32_t ld
  37. POINTER meta_lsn DB_LSN * lu
  38. POINTER page_lsn DB_LSN * lu
  39. ARG pgno db_pgno_t lu
  40. ARG ptype u_int32_t lu
  41. ARG next db_pgno_t lu
  42. END
  43. DEPRECATED pg_alloc1 60
  44. ARG fileid int32_t ld
  45. POINTER meta_lsn DB_LSN * lu
  46. POINTER alloc_lsn DB_LSN * lu
  47. POINTER page_lsn DB_LSN * lu
  48. ARG pgno db_pgno_t lu
  49. ARG ptype u_int32_t lu
  50. ARG next db_pgno_t lu
  51. END
  52. /*
  53.  * BTREE-pg_free: used to record freeing a page.
  54.  *
  55.  * pgno: the page being freed.
  56.  * meta_lsn: the meta-data page's original lsn.
  57.  * header: the header from the free'd page.
  58.  * next: the previous next pointer on the metadata page.
  59.  */
  60. BEGIN pg_free 52
  61. ARG fileid int32_t ld
  62. ARG pgno db_pgno_t lu
  63. POINTER meta_lsn DB_LSN * lu
  64. DBT header DBT s
  65. ARG next db_pgno_t lu
  66. END
  67. DEPRECATED pg_free1 61
  68. ARG fileid int32_t ld
  69. ARG pgno db_pgno_t lu
  70. POINTER meta_lsn DB_LSN * lu
  71. POINTER alloc_lsn DB_LSN * lu
  72. DBT header DBT s
  73. ARG next db_pgno_t lu
  74. END
  75. /*
  76.  * BTREE-split: used to log a page split.
  77.  *
  78.  * left: the page number for the low-order contents.
  79.  * llsn: the left page's original LSN.
  80.  * right: the page number for the high-order contents.
  81.  * rlsn: the right page's original LSN.
  82.  * indx: the number of entries that went to the left page.
  83.  * npgno: the next page number
  84.  * nlsn: the next page's original LSN (or 0 if no next page).
  85.  * pg: the split page's contents before the split.
  86.  */
  87. DEPRECATED split1 53
  88. ARG fileid int32_t ld
  89. ARG left db_pgno_t lu
  90. POINTER llsn DB_LSN * lu
  91. ARG right db_pgno_t lu
  92. POINTER rlsn DB_LSN * lu
  93. ARG indx u_int32_t lu
  94. ARG npgno db_pgno_t lu
  95. POINTER nlsn DB_LSN * lu
  96. DBT pg DBT s
  97. END
  98. /*
  99.  * BTREE-split: used to log a page split.
  100.  *
  101.  * left: the page number for the low-order contents.
  102.  * llsn: the left page's original LSN.
  103.  * right: the page number for the high-order contents.
  104.  * rlsn: the right page's original LSN.
  105.  * indx: the number of entries that went to the left page.
  106.  * npgno: the next page number
  107.  * npgno: the next page number
  108.  * nlsn: the next page's original LSN (or 0 if no next page).
  109.  * root_pgno: the root page number
  110.  * pg: the split page's contents before the split.
  111.  * opflags: SPL_NRECS: if splitting a tree that maintains a record count.
  112.  */
  113. BEGIN split 62
  114. ARG fileid int32_t ld
  115. ARG left db_pgno_t lu
  116. POINTER llsn DB_LSN * lu
  117. ARG right db_pgno_t lu
  118. POINTER rlsn DB_LSN * lu
  119. ARG indx u_int32_t lu
  120. ARG npgno db_pgno_t lu
  121. POINTER nlsn DB_LSN * lu
  122. ARG root_pgno db_pgno_t lu
  123. DBT pg DBT s
  124. ARG opflags u_int32_t lu
  125. END
  126. /*
  127.  * BTREE-rsplit: used to log a reverse-split
  128.  *
  129.  * pgno: the page number of the page copied over the root.
  130.  * pgdbt: the page being copied on the root page.
  131.  * nrec: the tree's record count.
  132.  * rootent: last entry on the root page.
  133.  * rootlsn: the root page's original lsn.
  134.  */
  135. DEPRECATED rsplit1 54
  136. ARG fileid int32_t ld
  137. ARG pgno db_pgno_t lu
  138. DBT pgdbt DBT s
  139. ARG nrec db_pgno_t lu
  140. DBT rootent DBT s
  141. POINTER rootlsn DB_LSN * lu
  142. END
  143. /*
  144.  * BTREE-rsplit: used to log a reverse-split
  145.  *
  146.  * pgno: the page number of the page copied over the root.
  147.  * pgdbt: the page being copied on the root page.
  148.  * root_pgno: the root page number.
  149.  * nrec: the tree's record count.
  150.  * rootent: last entry on the root page.
  151.  * rootlsn: the root page's original lsn.
  152.  */
  153. BEGIN rsplit 63
  154. ARG fileid int32_t ld
  155. ARG pgno db_pgno_t lu
  156. DBT pgdbt DBT s
  157. ARG root_pgno db_pgno_t lu
  158. ARG nrec db_pgno_t lu
  159. DBT rootent DBT s
  160. POINTER rootlsn DB_LSN * lu
  161. END
  162. /*
  163.  * BTREE-adj: used to log the adjustment of an index.
  164.  *
  165.  * pgno: the page modified.
  166.  * lsn: the page's original lsn.
  167.  * indx: the index adjusted.
  168.  * indx_copy: the index to copy if inserting.
  169.  * is_insert: 0 if a delete, 1 if an insert.
  170.  */
  171. BEGIN adj 55
  172. ARG fileid int32_t ld
  173. ARG pgno db_pgno_t lu
  174. POINTER lsn DB_LSN * lu
  175. ARG indx u_int32_t lu
  176. ARG indx_copy u_int32_t lu
  177. ARG is_insert u_int32_t lu
  178. END
  179. /*
  180.  * BTREE-cadjust: used to adjust the count change in an internal page.
  181.  *
  182.  * pgno: the page modified.
  183.  * lsn: the page's original lsn.
  184.  * indx: the index to be adjusted.
  185.  * adjust: the signed adjustment.
  186.  * opflags: CAD_UPDATEROOT: if root page count was adjusted.
  187.  */
  188. BEGIN cadjust 56
  189. ARG fileid int32_t ld
  190. ARG pgno db_pgno_t lu
  191. POINTER lsn DB_LSN * lu
  192. ARG indx u_int32_t lu
  193. ARG adjust int32_t ld
  194. ARG opflags u_int32_t lu
  195. END
  196. /*
  197.  * BTREE-cdel: used to log the intent-to-delete of a cursor record.
  198.  *
  199.  * pgno: the page modified.
  200.  * lsn: the page's original lsn.
  201.  * indx: the index to be deleted.
  202.  */
  203. BEGIN cdel 57
  204. ARG fileid int32_t ld
  205. ARG pgno db_pgno_t lu
  206. POINTER lsn DB_LSN * lu
  207. ARG indx u_int32_t lu
  208. END
  209. /*
  210.  * BTREE-repl: used to log the replacement of an item.
  211.  *
  212.  * pgno: the page modified.
  213.  * lsn: the page's original lsn.
  214.  * orig: the original data.
  215.  * new: the replacement data.
  216.  * duplicate: the prefix of the replacement that matches the original.
  217.  */
  218. BEGIN repl 58
  219. ARG fileid int32_t ld
  220. ARG pgno db_pgno_t lu
  221. POINTER lsn DB_LSN * lu
  222. ARG indx u_int32_t lu
  223. ARG isdeleted u_int32_t lu
  224. DBT orig DBT s
  225. DBT repl DBT s
  226. ARG prefix u_int32_t lu
  227. ARG suffix u_int32_t lu
  228. END
  229. /*
  230.  * BTREE-root: log the assignment of a root btree page.
  231.  */
  232. BEGIN root 59
  233. ARG fileid int32_t ld
  234. ARG meta_pgno db_pgno_t lu
  235. ARG root_pgno db_pgno_t lu
  236. POINTER meta_lsn DB_LSN * lu
  237. END
  238. /*
  239.  * BTREE-curadj: undo cursor adjustments on txn abort.
  240.  *     Should only be processed during DB_TXN_ABORT.
  241.  * NOTE: the first_indx field gets used to hold
  242.  * signed index adjustment in one case.
  243.  * care should be taken if its size is changed.
  244.  */
  245. BEGIN curadj 64
  246. /* Fileid of db affected. */
  247. ARG fileid int32_t ld
  248. /* Which adjustment. */
  249. ARG mode db_ca_mode ld
  250. /* Page entry is from. */
  251. ARG from_pgno db_pgno_t lu
  252. /* Page entry  went to. */
  253. ARG to_pgno db_pgno_t lu
  254. /* Left page of root split. */
  255. ARG left_pgno db_pgno_t lu
  256. /* First index of dup set. Also used as adjustment. */
  257. ARG first_indx u_int32_t lu
  258. /* Index entry is from. */
  259. ARG from_indx u_int32_t lu
  260. /* Index where entry went. */
  261. ARG to_indx u_int32_t lu
  262. END
  263. /*
  264.  * BTREE-rcuradj: undo cursor adjustments on txn abort in
  265.  *     renumbering recno trees.
  266.  *     Should only be processed during DB_TXN_ABORT.
  267.  */
  268. BEGIN rcuradj 65
  269. /* Fileid of db affected. */
  270. ARG fileid int32_t ld
  271. /* Which adjustment. */
  272. ARG mode ca_recno_arg ld
  273. /* Root page number. */
  274. ARG root db_pgno_t ld
  275. /* Recno of the adjustment. */
  276. ARG recno db_recno_t ld
  277. /* Order number of the adjustment. */
  278. ARG order u_int32_t ld
  279. END