diff options
author | unknown <monty@hundin.mysql.fi> | 2002-02-11 13:48:59 +0200 |
---|---|---|
committer | unknown <monty@hundin.mysql.fi> | 2002-02-11 13:48:59 +0200 |
commit | e0ccdc17a208abb21cf15e7fbbbc3b88b969e0ec (patch) | |
tree | ada172b5dc5dccd546e301548aac618812e19814 /sql/ha_innodb.cc | |
parent | af932b5db200407cb250d6e398383e8db387e680 (diff) | |
parent | 501650c5b16a4c7cf7b673b19f9a2ae9c319e24f (diff) | |
download | mariadb-git-e0ccdc17a208abb21cf15e7fbbbc3b88b969e0ec.tar.gz |
merge with 3.23.48
BUILD/FINISH.sh:
Auto merged
BUILD/SETUP.sh:
Auto merged
BUILD/compile-alpha:
Auto merged
BUILD/compile-pentium-gcov:
Auto merged
BUILD/compile-pentium-gprof:
Auto merged
BUILD/compile-pentium:
Auto merged
BitKeeper/deleted/.del-my_new.cc:
Delete: mysys/my_new.cc
Build-tools/Do-compile:
Auto merged
acconfig.h:
Auto merged
acinclude.m4:
Auto merged
Docs/manual.texi:
Auto merged
bdb/dist/configure.in:
Auto merged
client/Makefile.am:
Auto merged
innobase/btr/btr0cur.c:
Auto merged
innobase/buf/buf0lru.c:
Auto merged
innobase/dict/dict0crea.c:
Auto merged
innobase/fil/fil0fil.c:
Auto merged
innobase/include/srv0srv.h:
Auto merged
innobase/rem/rem0cmp.c:
Auto merged
innobase/srv/srv0srv.c:
Auto merged
innobase/srv/srv0start.c:
Auto merged
innobase/trx/trx0purge.c:
Auto merged
myisam/myisampack.c:
Auto merged
mysql-test/mysql-test-run.sh:
Auto merged
mysql-test/t/join.test:
Auto merged
mysys/Makefile.am:
Auto merged
scripts/Makefile.am:
Auto merged
sql/ha_innodb.h:
Auto merged
sql/handler.cc:
Auto merged
sql/my_lock.c:
Auto merged
sql/mysqld.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_table.cc:
Auto merged
support-files/my-huge.cnf.sh:
Auto merged
support-files/my-large.cnf.sh:
Auto merged
support-files/my-medium.cnf.sh:
Auto merged
support-files/my-small.cnf.sh:
Auto merged
configure.in:
merge
innobase/row/row0mysql.c:
merge
innobase/trx/trx0trx.c:
merge
mysql-test/r/innodb.result:
merge
mysql-test/r/join.result:
merge
sql/ha_innodb.cc:
merge
sql/slave.cc:
merge
Diffstat (limited to 'sql/ha_innodb.cc')
-rw-r--r-- | sql/ha_innodb.cc | 168 |
1 files changed, 84 insertions, 84 deletions
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index f99e677913e..e2657e5cad7 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & InnoDB Oy +/* Copyright (C) 2000 MySQL AB & InnoDB Oy 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 @@ -85,8 +85,8 @@ long innobase_mirrored_log_groups, innobase_log_files_in_group, char *innobase_data_home_dir; char *innobase_log_group_home_dir, *innobase_log_arch_dir; char *innobase_unix_file_flush_method; -bool innobase_flush_log_at_trx_commit, innobase_log_archive, - innobase_use_native_aio, innobase_fast_shutdown; +my_bool innobase_flush_log_at_trx_commit, innobase_log_archive, + innobase_use_native_aio, innobase_fast_shutdown; /* Set default InnoDB size to 64M, to let users use InnoDB without having @@ -235,7 +235,7 @@ convert_error_code_to_mysql( extern "C" { /***************************************************************** Prints info of a THD object (== user session thread) to the -standatd output. NOTE that mysql/innobase/trx/trx0trx.c must contain +standard output. NOTE that mysql/innobase/trx/trx0trx.c must contain the prototype for this function! */ void @@ -304,6 +304,8 @@ check_trx_exists( thd->transaction.stmt.innobase_tid = (void*)&innodb_dummy_stmt_trx_handle; + } else { + ut_a(trx->magic_n == TRX_MAGIC_N); } return(trx); @@ -841,6 +843,7 @@ innobase_close_connection( whose transaction should be rolled back */ { if (NULL != thd->transaction.all.innobase_tid) { + trx_rollback_for_mysql((trx_t*) (thd->transaction.all.innobase_tid)); trx_free_for_mysql((trx_t*) @@ -2465,44 +2468,6 @@ ha_innobase::position( ref_stored_len = len; } -/*********************************************************************** -Tells something additional to the handler about how to do things. */ - -int -ha_innobase::extra( -/*===============*/ - /* out: 0 or error number */ - enum ha_extra_function operation) - /* in: HA_EXTRA_DONT_USE_CURSOR_TO_UPDATE */ -{ - row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt; - - switch (operation) { - case HA_EXTRA_RESET: - case HA_EXTRA_RESET_STATE: - prebuilt->read_just_key = 0; - break; - case HA_EXTRA_NO_KEYREAD: - prebuilt->read_just_key = 0; - break; - case HA_EXTRA_DONT_USE_CURSOR_TO_UPDATE: - prebuilt->in_update_remember_pos = FALSE; - break; - case HA_EXTRA_KEYREAD: - prebuilt->read_just_key = 1; - break; - default:/* Do nothing */ - ; - } - - return(0); -} - -int ha_innobase::reset(void) -{ - return(0); -} - /********************************************************************* Creates a table definition to an InnoDB database. */ @@ -2981,9 +2946,9 @@ ha_innobase::records_in_range( DBUG_ENTER("records_in_range"); - if (prebuilt->trx) { - prebuilt->trx->op_info = (char*) "estimating range size"; - } + /* Warning: since it is not sure that MySQL calls external_lock + before calling this function, the trx field in prebuilt can be + obsolete! */ active_index = keynr; @@ -3017,10 +2982,6 @@ ha_innobase::records_in_range( my_free((char*) key_val_buff2, MYF(0)); - if (prebuilt->trx) { - prebuilt->trx->op_info = (char*) ""; - } - DBUG_RETURN((ha_rows) n_rows); } @@ -3041,10 +3002,9 @@ ha_innobase::estimate_number_of_rows(void) ulonglong estimate; ulonglong data_file_length; - if (prebuilt->trx) { - prebuilt->trx->op_info = - (char*) "estimating upper bound of table size"; - } + /* Warning: since it is not sure that MySQL calls external_lock + before calling this function, the trx field in prebuilt can be + obsolete! */ DBUG_ENTER("info"); @@ -3061,10 +3021,6 @@ ha_innobase::estimate_number_of_rows(void) estimate = 2 * data_file_length / dict_index_calc_min_rec_len(index); - if (prebuilt->trx) { - prebuilt->trx->op_info = (char*) ""; - } - DBUG_RETURN((ha_rows) estimate); } @@ -3080,10 +3036,12 @@ ha_innobase::scan_time() { row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt; - /* In the following formula we assume that scanning 10 pages - takes the same time as a disk seek: */ - - return((double) (prebuilt->table->stat_clustered_index_size / 10)); + /* Since MySQL seems to favor table scans too much over index + searches, we pretend that a sequential read takes the same time + as a random disk read, that is, we do not divide the following + by 10, which would be physically realistic. */ + + return((double) (prebuilt->table->stat_clustered_index_size)); } /************************************************************************* @@ -3104,9 +3062,9 @@ ha_innobase::info( DBUG_ENTER("info"); - if (prebuilt->trx) { - prebuilt->trx->op_info = (char*) "calculating table stats"; - } + /* Warning: since it is not sure that MySQL calls external_lock + before calling this function, the trx field in prebuilt can be + obsolete! */ ib_table = prebuilt->table; @@ -3154,25 +3112,17 @@ ha_innobase::info( index->stat_n_diff_key_vals[j + 1]); } + /* Since MySQL seems to favor table scans + too much over index searches, we pretend + index selectivity is 2 times better than + our estimate: */ + + rec_per_key = rec_per_key / 2; + if (rec_per_key == 0) { rec_per_key = 1; } - /* Since the MySQL optimizer is often too - pessimistic in the assumption that a table - does not fit in the buffer pool, we - increase the attractiveness of indexes - by assuming the selectivity of any prefix - of an index is 1 / 100 or better. - (Actually, we should look at the table - size, and if the table is smaller than - the buffer pool, we should uniformly - increase the attractiveness of indexes, - regardless of the estimated selectivity.) */ - - if (rec_per_key > records / 100) { - rec_per_key = records / 100; - } table->key_info[i].rec_per_key[j] = rec_per_key; } @@ -3188,15 +3138,13 @@ ha_innobase::info( pointer and cause a seg fault. */ if (flag & HA_STATUS_ERRKEY) { + ut_a(prebuilt->trx && prebuilt->trx->magic_n == TRX_MAGIC_N); + errkey = (unsigned int) row_get_mysql_key_number_for_index( (dict_index_t*) trx_get_error_info(prebuilt->trx)); } - if (prebuilt->trx) { - prebuilt->trx->op_info = (char*) ""; - } - DBUG_VOID_RETURN; } @@ -3217,6 +3165,8 @@ ha_innobase::check( row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt; ulint ret; + ut_a(prebuilt->trx && prebuilt->trx->magic_n == TRX_MAGIC_N); + if (prebuilt->mysql_template == NULL) { /* Build the template; we will use a dummy template in index scans done in checking */ @@ -3250,6 +3200,10 @@ ha_innobase::update_table_comment( char* str = my_malloc(length + 550, MYF(0)); char* pos; + /* Warning: since it is not sure that MySQL calls external_lock + before calling this function, the trx field in prebuilt can be + obsolete! */ + if (!str) { return((char*)comment); } @@ -3271,6 +3225,53 @@ ha_innobase::update_table_comment( return(str); } +/*********************************************************************** +Tells something additional to the handler about how to do things. */ + +int +ha_innobase::extra( +/*===============*/ + /* out: 0 or error number */ + enum ha_extra_function operation) + /* in: HA_EXTRA_DONT_USE_CURSOR_TO_UPDATE */ +{ + row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt; + + /* Warning: since it is not sure that MySQL calls external_lock + before calling this function, the trx field in prebuilt can be + obsolete! */ + + switch (operation) { + case HA_EXTRA_RESET: + case HA_EXTRA_RESET_STATE: + prebuilt->read_just_key = 0; + break; + case HA_EXTRA_NO_KEYREAD: + prebuilt->read_just_key = 0; + break; + case HA_EXTRA_DONT_USE_CURSOR_TO_UPDATE: + prebuilt->in_update_remember_pos = FALSE; + break; + case HA_EXTRA_KEYREAD: + prebuilt->read_just_key = 1; + break; + default:/* Do nothing */ + ; + } + + return(0); +} + +/********************************************************************** +????????????? */ + +int +ha_innobase::reset(void) +/*====================*/ +{ + return(0); +} + /********************************************************************** As MySQL will execute an external lock for every new table it uses when it starts to process an SQL statement, we can use this function to store the @@ -3496,5 +3497,4 @@ ha_innobase::get_auto_increment() return(nr); } - #endif /* HAVE_INNOBASE_DB */ |