~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/drizzle/ha_innodb.cc

  • Committer: Brian Aker
  • Date: 2009-01-06 09:02:30 UTC
  • mfrom: (758.1.5 devel)
  • Revision ID: brian@tangent.org-20090106090230-ov94my79hsiz4bes
Merge from Monty

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
#include <drizzled/server_includes.h>
25
25
#include <drizzled/error.h>
 
26
#include <drizzled/errmsg_print.h>
26
27
#include <mystrings/m_ctype.h>
27
28
#include <mysys/my_sys.h>
28
29
#include <mysys/hash.h>
1470
1471
        }
1471
1472
 
1472
1473
        if (trx->has_search_latch) {
1473
 
                sql_print_error("The calling thread is holding the adaptive "
1474
 
                                "search, latch though calling "
1475
 
                                "innobase_query_caching_of_table_permitted.");
 
1474
                errmsg_printf(ERRMSG_LVL_ERROR,
 
1475
                              "The calling thread is holding the adaptive "
 
1476
                              "search, latch though calling "
 
1477
                              "innobase_query_caching_of_table_permitted.");
1476
1478
 
1477
1479
                mutex_enter(&kernel_mutex);
1478
1480
                trx_print(stderr, trx, 1024);
1819
1821
 
1820
1822
#ifdef DRIZZLE_DYNAMIC_PLUGIN
1821
1823
        if (!innodb_plugin_init()) {
1822
 
                sql_print_error("InnoDB plugin init failed.");
 
1824
                errmsg_printf(ERRMSG_LVL_ERROR, "InnoDB plugin init failed.");
1823
1825
                return -1;
1824
1826
        }
1825
1827
 
1869
1871
                        || strcmp(test_tablename
1870
1872
                        + sizeof srv_mysql50_table_name_prefix,
1871
1873
                        test_filename)) {
1872
 
                sql_print_error("tablename encoding has been changed");
 
1874
                errmsg_printf(ERRMSG_LVL_ERROR, "tablename encoding has been changed");
1873
1875
                goto error;
1874
1876
        }
1875
1877
#endif /* UNIV_DEBUG */
1877
1879
        /* Check that values don't overflow on 32-bit systems. */
1878
1880
        if (sizeof(ulint) == 4) {
1879
1881
                if (innobase_buffer_pool_size > UINT32_MAX) {
1880
 
                        sql_print_error(
 
1882
                        errmsg_printf(ERRMSG_LVL_ERROR, 
1881
1883
                                "innobase_buffer_pool_size can't be over 4GB"
1882
1884
                                " on 32-bit systems");
1883
1885
 
1885
1887
                }
1886
1888
 
1887
1889
                if (innobase_log_file_size > UINT32_MAX) {
1888
 
                        sql_print_error(
 
1890
                        errmsg_printf(ERRMSG_LVL_ERROR, 
1889
1891
                                "innobase_log_file_size can't be over 4GB"
1890
1892
                                " on 32-bit systems");
1891
1893
 
1944
1946
                                &srv_auto_extend_last_data_file,
1945
1947
                                &srv_last_file_size_max);
1946
1948
        if (ret == FALSE) {
1947
 
                sql_print_error(
 
1949
                errmsg_printf(ERRMSG_LVL_ERROR, 
1948
1950
                        "InnoDB: syntax error in innodb_data_file_path");
1949
1951
                if (internal_innobase_data_file_path)
1950
1952
                  free(internal_innobase_data_file_path);
1974
1976
                                                &srv_log_group_home_dirs);
1975
1977
 
1976
1978
        if (ret == FALSE || innobase_mirrored_log_groups != 1) {
1977
 
          sql_print_error("syntax error in innodb_log_group_home_dir, or a "
 
1979
          errmsg_printf(ERRMSG_LVL_ERROR, "syntax error in innodb_log_group_home_dir, or a "
1978
1980
                          "wrong number of mirrored log groups");
1979
1981
 
1980
1982
                if (internal_innobase_data_file_path)
1990
1992
 
1991
1993
                if (format_id > DICT_TF_FORMAT_MAX) {
1992
1994
 
1993
 
                        sql_print_error("InnoDB: wrong innodb_file_format.");
 
1995
                        errmsg_printf(ERRMSG_LVL_ERROR, "InnoDB: wrong innodb_file_format.");
1994
1996
 
1995
1997
                        if (internal_innobase_data_file_path)
1996
1998
                          free(internal_innobase_data_file_path);
2025
2027
                if (!innobase_file_format_check_validate(
2026
2028
                        innobase_file_format_check)) {
2027
2029
 
2028
 
                        sql_print_error("InnoDB: invalid "
 
2030
                        errmsg_printf(ERRMSG_LVL_ERROR, "InnoDB: invalid "
2029
2031
                                        "innodb_file_format_check value: "
2030
2032
                                        "should be either 'on' or 'off' or "
2031
2033
                                        "any value up to %s or its "
2280
2282
        if (trx->active_trans == 0
2281
2283
                && trx->conc_state != TRX_NOT_STARTED) {
2282
2284
 
2283
 
                sql_print_error("trx->active_trans == 0, but"
 
2285
                errmsg_printf(ERRMSG_LVL_ERROR, "trx->active_trans == 0, but"
2284
2286
                        " trx->conc_state != TRX_NOT_STARTED");
2285
2287
        }
2286
2288
        if (all
2564
2566
        if (trx->active_trans == 0
2565
2567
                && trx->conc_state != TRX_NOT_STARTED) {
2566
2568
 
2567
 
                sql_print_error("trx->active_trans == 0, but"
 
2569
                errmsg_printf(ERRMSG_LVL_ERROR, "trx->active_trans == 0, but"
2568
2570
                        " trx->conc_state != TRX_NOT_STARTED");
2569
2571
        }
2570
2572
 
2571
2573
 
2572
2574
        if (trx->conc_state != TRX_NOT_STARTED &&
2573
2575
                global_system_variables.log_warnings) {
2574
 
                sql_print_warning(
 
2576
                errmsg_printf(ERRMSG_LVL_WARN, 
2575
2577
                        "MySQL is closing a connection that has an active "
2576
2578
                        "InnoDB transaction.  %lu row modifications will "
2577
2579
                        "roll back.",
2892
2894
                }
2893
2895
 
2894
2896
                if (is_part) {
2895
 
                        sql_print_error("Failed to open table %s after "
 
2897
                        errmsg_printf(ERRMSG_LVL_ERROR, "Failed to open table %s after "
2896
2898
                                        "%lu attemtps.\n", norm_name,
2897
2899
                                        retries);
2898
2900
                }
2899
2901
 
2900
 
                sql_print_error("Cannot find or open table %s from\n"
 
2902
                errmsg_printf(ERRMSG_LVL_ERROR, "Cannot find or open table %s from\n"
2901
2903
                                "the internal data dictionary of InnoDB "
2902
2904
                                "though the .frm file for the\n"
2903
2905
                                "table exists. Maybe you have deleted and "
2920
2922
        }
2921
2923
 
2922
2924
        if (ib_table->ibd_file_missing && !session_tablespace_op(session)) {
2923
 
                sql_print_error("MySQL is trying to open a table handle but "
 
2925
                errmsg_printf(ERRMSG_LVL_ERROR, "MySQL is trying to open a table handle but "
2924
2926
                                "the .ibd file for\ntable %s does not exist.\n"
2925
2927
                                "Have you deleted the .ibd file from the "
2926
2928
                                "database directory under\nthe MySQL datadir, "
2954
2956
 
2955
2957
        if (!row_table_got_default_clust_index(ib_table)) {
2956
2958
                if (primary_key >= MAX_KEY) {
2957
 
                  sql_print_error("Table %s has a primary key in InnoDB data "
 
2959
                  errmsg_printf(ERRMSG_LVL_ERROR, "Table %s has a primary key in InnoDB data "
2958
2960
                                  "dictionary, but not in MySQL!", name);
2959
2961
                }
2960
2962
 
2969
2971
                ref_length = table->key_info[primary_key].key_length;
2970
2972
        } else {
2971
2973
                if (primary_key != MAX_KEY) {
2972
 
                  sql_print_error("Table %s has no primary key in InnoDB data "
 
2974
                  errmsg_printf(ERRMSG_LVL_ERROR, "Table %s has no primary key in InnoDB data "
2973
2975
                                  "dictionary, but has one in MySQL! If you "
2974
2976
                                  "created the table with a MySQL version < "
2975
2977
                                  "3.23.54 and did not define a primary key, "
2993
2995
                and it will never be updated anyway. */
2994
2996
 
2995
2997
                if (key_used_on_scan != MAX_KEY) {
2996
 
                        sql_print_warning(
 
2998
                        errmsg_printf(ERRMSG_LVL_WARN, 
2997
2999
                                "Table %s key_used_on_scan is %lu even "
2998
3000
                                "though there is no primary key inside "
2999
3001
                                "InnoDB.", name, (ulong) key_used_on_scan);
3183
3185
                        charset = get_charset(charset_number, MYF(MY_WME));
3184
3186
 
3185
3187
                        if (charset == NULL) {
3186
 
                          sql_print_error("InnoDB needs charset %lu for doing "
 
3188
                          errmsg_printf(ERRMSG_LVL_ERROR, "InnoDB needs charset %lu for doing "
3187
3189
                                          "a comparison, but MySQL cannot "
3188
3190
                                          "find that charset.",
3189
3191
                                          (ulong) charset_number);
4003
4005
        trx_t*          trx = session_to_trx(user_session);
4004
4006
 
4005
4007
        if (prebuilt->trx != trx) {
4006
 
          sql_print_error("The transaction object for the table handle is at "
 
4008
          errmsg_printf(ERRMSG_LVL_ERROR, "The transaction object for the table handle is at "
4007
4009
                          "%p, but for the current thread it is at %p",
4008
4010
                          (const void*) prebuilt->trx, (const void*) trx);
4009
4011
 
4918
4920
        }
4919
4921
 
4920
4922
        if (!index) {
4921
 
                sql_print_error(
 
4923
                errmsg_printf(ERRMSG_LVL_ERROR, 
4922
4924
                        "Innodb could not find key n:o %u with name %s "
4923
4925
                        "from dict cache for table %s",
4924
4926
                        keynr, key ? key->name : "NULL",
4947
4949
        prebuilt->index = innobase_get_index(keynr);
4948
4950
 
4949
4951
        if (UNIV_UNLIKELY(!prebuilt->index)) {
4950
 
                sql_print_warning("InnoDB: change_active_index(%u) failed",
 
4952
                errmsg_printf(ERRMSG_LVL_WARN, "InnoDB: change_active_index(%u) failed",
4951
4953
                                  keynr);
4952
4954
                return(1);
4953
4955
        }
5302
5304
        table. */
5303
5305
 
5304
5306
        if (len != ref_length) {
5305
 
          sql_print_error("Stored ref len is %lu, but table ref len is %lu",
 
5307
          errmsg_printf(ERRMSG_LVL_ERROR, "Stored ref len is %lu, but table ref len is %lu",
5306
5308
                          (ulong) len, (ulong) ref_length);
5307
5309
        }
5308
5310
}
5510
5512
                                || col_type == DATA_FLOAT
5511
5513
                                || col_type == DATA_DOUBLE
5512
5514
                                || col_type == DATA_DECIMAL) {
5513
 
                                sql_print_error(
 
5515
                                errmsg_printf(ERRMSG_LVL_ERROR, 
5514
5516
                                        "MySQL is trying to create a column "
5515
5517
                                        "prefix index field, on an "
5516
5518
                                        "inappropriate data type. Table "
5796
5798
 
5797
5799
                if ((name[1] == ':')
5798
5800
                    || (name[0] == '\\' && name[1] == '\\')) {
5799
 
                        sql_print_error("Cannot create table %s\n", name);
 
5801
                        errmsg_printf(ERRMSG_LVL_ERROR, "Cannot create table %s\n", name);
5800
5802
                        DBUG_RETURN(HA_ERR_GENERIC);
5801
5803
                }
5802
5804
        }
6877
6879
 
6878
6880
                for (i = 0; i < table->s->keys; i++) {
6879
6881
                        if (index == NULL) {
6880
 
                                sql_print_error("Table %s contains fewer "
 
6882
                                errmsg_printf(ERRMSG_LVL_ERROR, "Table %s contains fewer "
6881
6883
                                                "indexes inside InnoDB than "
6882
6884
                                                "are defined in the MySQL "
6883
6885
                                                ".frm file. Have you mixed up "
6892
6894
                        for (j = 0; j < table->key_info[i].key_parts; j++) {
6893
6895
 
6894
6896
                                if (j + 1 > index->n_uniq) {
6895
 
                                        sql_print_error(
 
6897
                                        errmsg_printf(ERRMSG_LVL_ERROR, 
6896
6898
"Index %s of %s has %lu columns unique inside InnoDB, but MySQL is asking "
6897
6899
"statistics for %lu columns. Have you mixed up .frm files from different "
6898
6900
"installations? "
8707
8709
 
8708
8710
        if (trx->active_trans == 0 && trx->conc_state != TRX_NOT_STARTED) {
8709
8711
 
8710
 
          sql_print_error("trx->active_trans == 0, but trx->conc_state != "
8711
 
                          "TRX_NOT_STARTED");
 
8712
          errmsg_printf(ERRMSG_LVL_ERROR,
 
8713
                        "trx->active_trans == 0, but trx->conc_state != "
 
8714
                        "TRX_NOT_STARTED");
8712
8715
        }
8713
8716
 
8714
8717
        if (all
9098
9101
                message if they did so. */
9099
9102
 
9100
9103
                if (innobase_file_format_check_on_off(file_format_input)) {
9101
 
                        sql_print_warning(
 
9104
                        errmsg_printf(ERRMSG_LVL_WARN, 
9102
9105
                                "InnoDB: invalid innodb_file_format_check "
9103
9106
                                "value; on/off can only be set at startup or "
9104
9107
                                "in the configuration file");
9117
9120
                        return(0);
9118
9121
 
9119
9122
                } else {
9120
 
                        sql_print_warning(
 
9123
                        errmsg_printf(ERRMSG_LVL_WARN, 
9121
9124
                                "InnoDB: invalid innodb_file_format_check "
9122
9125
                                "value; can be any format up to %s "
9123
9126
                                "or its equivalent numeric id",