From 068c61978e3a81836d52b8caf11e044290159ad1 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Tue, 26 Mar 2013 00:03:13 +0200 Subject: Temporary commit of 10.0-merge --- storage/innobase/dict/dict0boot.cc | 49 +++++++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 16 deletions(-) (limited to 'storage/innobase/dict/dict0boot.cc') diff --git a/storage/innobase/dict/dict0boot.cc b/storage/innobase/dict/dict0boot.cc index 8e305364ac8..eea10759fcd 100644 --- a/storage/innobase/dict/dict0boot.cc +++ b/storage/innobase/dict/dict0boot.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -241,9 +241,10 @@ dict_hdr_create( /*****************************************************************//** Initializes the data dictionary memory structures when the database is -started. This function is also called when the data dictionary is created. */ +started. This function is also called when the data dictionary is created. +@return DB_SUCCESS or error code. */ UNIV_INTERN -void +dberr_t dict_boot(void) /*===========*/ { @@ -252,7 +253,7 @@ dict_boot(void) dict_hdr_t* dict_hdr; mem_heap_t* heap; mtr_t mtr; - ulint error; + dberr_t error; /* Be sure these constants do not ever change. To avoid bloat, only check the *NUM_FIELDS* in each table */ @@ -307,9 +308,7 @@ dict_boot(void) dict_mem_table_add_col(table, heap, "ID", DATA_BINARY, 0, 0); /* ROW_FORMAT = (N_COLS >> 31) ? COMPACT : REDUNDANT */ dict_mem_table_add_col(table, heap, "N_COLS", DATA_INT, 0, 4); - /* If the format is UNIV_FORMAT_A, table->flags == 0, and - TYPE == 1, which is defined as SYS_TABLE_TYPE_ANTELOPE. - The low order bit of TYPE is always set to 1. If the format + /* The low order bit of TYPE is always set to 1. If the format is UNIV_FORMAT_B or higher, this field matches table->flags. */ dict_mem_table_add_col(table, heap, "TYPE", DATA_INT, 0, 4); dict_mem_table_add_col(table, heap, "MIX_ID", DATA_BINARY, 0, 0); @@ -454,14 +453,27 @@ dict_boot(void) ibuf_init_at_db_start(); - /* Load definitions of other indexes on system tables */ + dberr_t err = DB_SUCCESS; + + if (srv_read_only_mode && !ibuf_is_empty()) { + + ib_logf(IB_LOG_LEVEL_ERROR, + "Change buffer must be empty when --innodb-read-only " + "is set!"); - dict_load_sys_table(dict_sys->sys_tables); - dict_load_sys_table(dict_sys->sys_columns); - dict_load_sys_table(dict_sys->sys_indexes); - dict_load_sys_table(dict_sys->sys_fields); + err = DB_ERROR; + } else { + /* Load definitions of other indexes on system tables */ + + dict_load_sys_table(dict_sys->sys_tables); + dict_load_sys_table(dict_sys->sys_columns); + dict_load_sys_table(dict_sys->sys_indexes); + dict_load_sys_table(dict_sys->sys_fields); + } mutex_exit(&(dict_sys->mutex)); + + return(err); } /*****************************************************************//** @@ -476,9 +488,10 @@ dict_insert_initial_data(void) } /*****************************************************************//** -Creates and initializes the data dictionary at the database creation. */ +Creates and initializes the data dictionary at the server bootstrap. +@return DB_SUCCESS or error code. */ UNIV_INTERN -void +dberr_t dict_create(void) /*=============*/ { @@ -490,7 +503,11 @@ dict_create(void) mtr_commit(&mtr); - dict_boot(); + dberr_t err = dict_boot(); + + if (err == DB_SUCCESS) { + dict_insert_initial_data(); + } - dict_insert_initial_data(); + return(err); } -- cgit v1.2.1