summaryrefslogtreecommitdiff
path: root/innobase/dict/dict0boot.c
diff options
context:
space:
mode:
Diffstat (limited to 'innobase/dict/dict0boot.c')
-rw-r--r--innobase/dict/dict0boot.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/innobase/dict/dict0boot.c b/innobase/dict/dict0boot.c
index 35fdfce16a6..206fbe32940 100644
--- a/innobase/dict/dict0boot.c
+++ b/innobase/dict/dict0boot.c
@@ -24,6 +24,65 @@ Created 4/18/1996 Heikki Tuuri
#include "os0file.h"
/**************************************************************************
+Gets a pointer to the dictionary header and x-latches its page. */
+
+dict_hdr_t*
+dict_hdr_get(
+/*=========*/
+ /* out: pointer to the dictionary header,
+ page x-latched */
+ mtr_t* mtr) /* in: mtr */
+{
+ dict_hdr_t* header;
+
+ ut_ad(mtr);
+
+ header = DICT_HDR + buf_page_get(DICT_HDR_SPACE, DICT_HDR_PAGE_NO,
+ RW_X_LATCH, mtr);
+ buf_page_dbg_add_level(header, SYNC_DICT_HEADER);
+
+ return(header);
+}
+
+/**************************************************************************
+Returns a new table, index, or tree id. */
+
+dulint
+dict_hdr_get_new_id(
+/*================*/
+ /* out: the new id */
+ ulint type) /* in: DICT_HDR_ROW_ID, ... */
+{
+ dict_hdr_t* dict_hdr;
+ dulint id;
+ mtr_t mtr;
+
+ ut_ad((type == DICT_HDR_TABLE_ID) || (type == DICT_HDR_INDEX_ID)
+ || (type == DICT_HDR_MIX_ID));
+
+ mtr_start(&mtr);
+
+ dict_hdr = dict_hdr_get(&mtr);
+
+ id = mtr_read_dulint(dict_hdr + type, MLOG_8BYTES, &mtr);
+
+ /* Add some dummy code here because otherwise pgcc seems to
+ compile wrong */
+
+ if (0 == ut_dulint_cmp(id, ut_dulint_max)) {
+ printf("Max id\n");
+ }
+
+ id = ut_dulint_add(id, 1);
+
+ mlog_write_dulint(dict_hdr + type, id, MLOG_8BYTES, &mtr);
+
+ mtr_commit(&mtr);
+
+ return(id);
+}
+
+/**************************************************************************
Writes the current value of the row id counter to the dictionary header file
page. */