summaryrefslogtreecommitdiff
path: root/sql/ha_innodb.cc
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2006-06-04 21:05:22 +0300
committerunknown <monty@mysql.com>2006-06-04 21:05:22 +0300
commit555eb848f2aa3ac5eb09b251072930eb38cd8f7e (patch)
tree8e3365da0e05942d80e6e6ae092f7e0e40832fe2 /sql/ha_innodb.cc
parent14e1d69aeaa09075fe3ec609d5ccdcf899508d7d (diff)
parent01d03e7b4b14b805a0d19c8473a495f05b34de65 (diff)
downloadmariadb-git-555eb848f2aa3ac5eb09b251072930eb38cd8f7e.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-5.1-new
into mysql.com:/home/my/mysql-5.1 BitKeeper/etc/ignore: auto-union include/heap.h: Auto merged include/my_base.h: Auto merged include/mysql_com.h: Auto merged mysql-test/mysql-test-run.pl: Auto merged mysql-test/mysql-test-run.sh: Auto merged mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test: Auto merged mysql-test/r/binlog_stm_mix_innodb_myisam.result: Auto merged mysql-test/r/func_time.result: Auto merged mysql-test/r/ndb_index_unique.result: Auto merged mysql-test/t/func_time.test: Auto merged mysql-test/t/view_grant.test: Auto merged sql/field.cc: Auto merged sql/field.h: Auto merged sql/ha_berkeley.cc: Auto merged sql/ha_berkeley.h: Auto merged mysql-test/r/view_grant.result: Auto merged sql/ha_federated.cc: Auto merged sql/ha_federated.h: Auto merged sql/ha_heap.h: Auto merged sql/ha_innodb.cc: Auto merged sql/ha_innodb.h: Auto merged sql/ha_myisam.h: Auto merged sql/ha_myisammrg.cc: Auto merged sql/ha_ndbcluster.h: Auto merged sql/ha_partition.h: Auto merged sql/item.cc: Auto merged sql/item_cmpfunc.h: Auto merged sql/item_func.cc: Auto merged sql/item_func.h: Auto merged sql/item_strfunc.h: Auto merged sql/item_subselect.cc: Auto merged sql/item_subselect.h: Auto merged sql/log.cc: Auto merged sql/mysqld.cc: Auto merged sql/set_var.cc: Auto merged sql/sp.cc: Auto merged sql/sp_head.cc: Auto merged sql/spatial.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_bitmap.h: Auto merged sql/sql_parse.cc: Auto merged sql/sql_partition.cc: Auto merged sql/sql_plugin.cc: Auto merged sql/sql_prepare.cc: Auto merged sql/share/errmsg.txt: Auto merged sql/sql_handler.cc: Auto merged sql/sql_view.cc: Auto merged sql/table.h: Auto merged storage/archive/ha_archive.cc: Auto merged storage/archive/ha_archive.h: Auto merged storage/example/ha_example.cc: Auto merged storage/myisam/ft_boolean_search.c: Auto merged unittest/mysys/base64-t.c: Auto merged mysql-test/r/innodb_mysql.result: manual merge mysql-test/t/innodb_mysql.test: manual merge mysql-test/valgrind.supp: manual merge sql/event.cc: manual merge sql/ha_heap.cc: manual merge sql/ha_myisam.cc: manual merge sql/ha_ndbcluster.cc: manual merge sql/ha_ndbcluster_binlog.cc: manual merge sql/ha_partition.cc: manual merge sql/handler.cc: manual merge renamed print_key_dupp_error to print_key_dup_error sql/handler.h: manual merge renamed print_key_dupp_error to print_key_dup_error sql/item.h: automatic merge sql/item_cmpfunc.cc: automatic merge sql/log_event.cc: manual merge Trivial cleanup sql/mysql_priv.h: manual merge renamed print_key_dupp_error to print_key_dup_error sql/opt_range.cc: manual merge renamed print_key_dupp_error to print_key_dup_error sql/sql_delete.cc: manual merge renamed print_key_dupp_error to print_key_dup_error sql/sql_insert.cc: manual merge renamed print_key_dupp_error to print_key_dup_error sql/sql_load.cc: manual merge renamed print_key_dupp_error to print_key_dup_error sql/sql_select.cc: manual merge renamed print_key_dupp_error to print_key_dup_error sql/sql_show.cc: manual merge renamed print_key_dupp_error to print_key_dup_error sql/sql_table.cc: manual merge renamed print_key_dupp_error to print_key_dup_error sql/sql_update.cc: manual merge renamed print_key_dupp_error to print_key_dup_error sql/table.cc: manual merge renamed print_key_dupp_error to print_key_dup_error storage/blackhole/ha_blackhole.cc: manual merge renamed print_key_dupp_error to print_key_dup_error storage/csv/ha_tina.cc: manual merge renamed print_key_dupp_error to print_key_dup_error mysql-test/valgrind.supp.orig: Manual merge
Diffstat (limited to 'sql/ha_innodb.cc')
-rw-r--r--sql/ha_innodb.cc81
1 files changed, 37 insertions, 44 deletions
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index 5607c025d63..742f9ce7631 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -204,14 +204,15 @@ static int innobase_rollback(THD* thd, bool all);
static int innobase_rollback_to_savepoint(THD* thd, void *savepoint);
static int innobase_savepoint(THD* thd, void *savepoint);
static int innobase_release_savepoint(THD* thd, void *savepoint);
-static handler *innobase_create_handler(TABLE_SHARE *table);
+static handler *innobase_create_handler(TABLE_SHARE *table,
+ MEM_ROOT *mem_root);
static const char innobase_hton_name[]= "InnoDB";
handlerton innobase_hton;
-static handler *innobase_create_handler(TABLE_SHARE *table)
+static handler *innobase_create_handler(TABLE_SHARE *table, MEM_ROOT *mem_root)
{
- return new ha_innobase(table);
+ return new (mem_root) ha_innobase(table);
}
@@ -804,10 +805,9 @@ ha_innobase::ha_innobase(TABLE_SHARE *table_arg)
HA_NULL_IN_KEY |
HA_CAN_INDEX_BLOBS |
HA_CAN_SQL_HANDLER |
- HA_NOT_EXACT_COUNT |
- HA_PRIMARY_KEY_ALLOW_RANDOM_ACCESS |
+ HA_PRIMARY_KEY_REQUIRED_FOR_POSITION |
HA_PRIMARY_KEY_IN_READ_INDEX |
- HA_CAN_GEOMETRY |
+ HA_CAN_GEOMETRY | HA_PARTIAL_COLUMN_READ |
HA_TABLE_SCAN_ON_INDEX),
start_of_scan(0),
num_write_row(0)
@@ -2307,7 +2307,7 @@ ha_innobase::open(
}
}
- block_size = 16 * 1024; /* Index block size in InnoDB: used by MySQL
+ stats.block_size = 16 * 1024; /* Index block size in InnoDB: used by MySQL
in query optimization */
/* Init table lock structure */
@@ -2902,16 +2902,15 @@ ha_innobase::store_key_val_for_row(
/******************************************************************
Builds a 'template' to the prebuilt struct. The template is used in fast
retrieval of just those column values MySQL needs in its processing. */
-static
void
-build_template(
+ha_innobase::build_template(
/*===========*/
row_prebuilt_t* prebuilt, /* in: prebuilt struct */
THD* thd, /* in: current user thread, used
only if templ_type is
ROW_MYSQL_REC_FIELDS */
TABLE* table, /* in: MySQL table */
- ulint templ_type) /* in: ROW_MYSQL_WHOLE_ROW or
+ uint templ_type) /* in: ROW_MYSQL_WHOLE_ROW or
ROW_MYSQL_REC_FIELDS */
{
dict_index_t* index;
@@ -3020,8 +3019,8 @@ build_template(
goto include_field;
}
- if (table->file->ha_get_bit_in_read_set(i+1) ||
- table->file->ha_get_bit_in_write_set(i+1)) {
+ if (bitmap_is_set(table->read_set, i) ||
+ bitmap_is_set(table->write_set, i)) {
/* This field is needed in the query */
goto include_field;
@@ -5405,7 +5404,7 @@ ha_innobase::info(
nor the CHECK TABLE time, nor the UPDATE or INSERT time. */
if (os_file_get_status(path,&stat_info)) {
- create_time = stat_info.ctime;
+ stats.create_time = stat_info.ctime;
}
}
@@ -5433,21 +5432,21 @@ ha_innobase::info(
n_rows++;
}
- records = (ha_rows)n_rows;
- deleted = 0;
- data_file_length = ((ulonglong)
+ stats.records = (ha_rows)n_rows;
+ stats.deleted = 0;
+ stats.data_file_length = ((ulonglong)
ib_table->stat_clustered_index_size)
* UNIV_PAGE_SIZE;
- index_file_length = ((ulonglong)
+ stats.index_file_length = ((ulonglong)
ib_table->stat_sum_of_other_index_sizes)
* UNIV_PAGE_SIZE;
- delete_length = 0;
- check_time = 0;
+ stats.delete_length = 0;
+ stats.check_time = 0;
- if (records == 0) {
- mean_rec_length = 0;
+ if (stats.records == 0) {
+ stats.mean_rec_length = 0;
} else {
- mean_rec_length = (ulong) (data_file_length / records);
+ stats.mean_rec_length = (ulong) (stats.data_file_length / stats.records);
}
}
@@ -5496,9 +5495,9 @@ ha_innobase::info(
if (index->stat_n_diff_key_vals[j + 1] == 0) {
- rec_per_key = records;
+ rec_per_key = stats.records;
} else {
- rec_per_key = (ha_rows)(records /
+ rec_per_key = (ha_rows)(stats.records /
index->stat_n_diff_key_vals[j + 1]);
}
@@ -5553,7 +5552,7 @@ ha_innobase::info(
}
}
- auto_increment_value = auto_inc;
+ stats.auto_increment_value = auto_inc;
}
prebuilt->trx->op_info = (char*)"";
@@ -5948,8 +5947,7 @@ ha_innobase::extra(
/*===============*/
/* out: 0 or error number */
enum ha_extra_function operation)
- /* in: HA_EXTRA_RETRIEVE_ALL_COLS or some
- other flag */
+ /* in: HA_EXTRA_FLUSH or some other flag */
{
row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
@@ -5963,13 +5961,6 @@ ha_innobase::extra(
row_mysql_prebuilt_free_blob_heap(prebuilt);
}
break;
- case HA_EXTRA_RESET:
- if (prebuilt->blob_heap) {
- row_mysql_prebuilt_free_blob_heap(prebuilt);
- }
- prebuilt->keep_other_fields_on_keyread = 0;
- prebuilt->read_just_key = 0;
- break;
case HA_EXTRA_RESET_STATE:
prebuilt->keep_other_fields_on_keyread = 0;
prebuilt->read_just_key = 0;
@@ -5977,16 +5968,6 @@ ha_innobase::extra(
case HA_EXTRA_NO_KEYREAD:
prebuilt->read_just_key = 0;
break;
- case HA_EXTRA_RETRIEVE_ALL_COLS:
- prebuilt->hint_need_to_fetch_extra_cols
- = ROW_RETRIEVE_ALL_COLS;
- break;
- case HA_EXTRA_RETRIEVE_PRIMARY_KEY:
- if (prebuilt->hint_need_to_fetch_extra_cols == 0) {
- prebuilt->hint_need_to_fetch_extra_cols
- = ROW_RETRIEVE_PRIMARY_KEY;
- }
- break;
case HA_EXTRA_KEYREAD:
prebuilt->read_just_key = 1;
break;
@@ -6000,6 +5981,18 @@ ha_innobase::extra(
return(0);
}
+int ha_innobase::reset()
+{
+ row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
+ if (prebuilt->blob_heap) {
+ row_mysql_prebuilt_free_blob_heap(prebuilt);
+ }
+ prebuilt->keep_other_fields_on_keyread = 0;
+ prebuilt->read_just_key = 0;
+ return 0;
+}
+
+
/**********************************************************************
MySQL calls this function at the start of each SQL statement inside LOCK
TABLES. Inside LOCK TABLES the ::external_lock method does not work to