summaryrefslogtreecommitdiff
path: root/sql/ha_innobase.cc
diff options
context:
space:
mode:
authorunknown <heikki@donna.mysql.fi>2001-08-29 19:42:23 +0300
committerunknown <heikki@donna.mysql.fi>2001-08-29 19:42:23 +0300
commitdd9fa926b390d59a13f4d2a8e2fef6d653372651 (patch)
tree9d78d40bd578ed463aac576cc0fbd077bbe9cd20 /sql/ha_innobase.cc
parentfc6696de0357612a35a968b824cbcd1819af4fa4 (diff)
downloadmariadb-git-dd9fa926b390d59a13f4d2a8e2fef6d653372651.tar.gz
trx0roll.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints
trx0sys.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints trx0trx.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints row0mysql.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints row0purge.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints row0sel.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints row0uins.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints row0umod.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints row0upd.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints srv0srv.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints srv0start.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints sync0arr.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints fil0fil.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints ibuf0ibuf.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints lock0lock.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints os0file.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints btr0btr.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints btr0cur.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints btr0sea.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints buf0buf.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints data0data.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints srv0srv.h Fix the primary key update + BLOB bug, improve InnoDB Monitor prints trx0sys.h Fix the primary key update + BLOB bug, improve InnoDB Monitor prints trx0trx.h Fix the primary key update + BLOB bug, improve InnoDB Monitor prints btr0cur.h Fix the primary key update + BLOB bug, improve InnoDB Monitor prints buf0buf.h Fix the primary key update + BLOB bug, improve InnoDB Monitor prints data0data.h Fix the primary key update + BLOB bug, improve InnoDB Monitor prints ha_innobase.cc Fix the auto-inc+REPLACE+replication bug, improve InnoDB Monitor prints sql/ha_innobase.cc: Fix the auto-inc+REPLACE+replication bug, improve InnoDB Monitor prints innobase/include/btr0cur.h: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/include/buf0buf.h: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/include/data0data.h: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/include/srv0srv.h: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/include/trx0sys.h: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/include/trx0trx.h: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/btr/btr0btr.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/btr/btr0cur.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/btr/btr0sea.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/buf/buf0buf.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/data/data0data.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/fil/fil0fil.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/ibuf/ibuf0ibuf.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/lock/lock0lock.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/os/os0file.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/row/row0mysql.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/row/row0purge.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/row/row0sel.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/row/row0uins.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/row/row0umod.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/row/row0upd.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/srv/srv0srv.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/srv/srv0start.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/sync/sync0arr.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/trx/trx0roll.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/trx/trx0sys.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/trx/trx0trx.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints
Diffstat (limited to 'sql/ha_innobase.cc')
-rw-r--r--sql/ha_innobase.cc104
1 files changed, 90 insertions, 14 deletions
diff --git a/sql/ha_innobase.cc b/sql/ha_innobase.cc
index 061371eb5d4..5f76ec39ce3 100644
--- a/sql/ha_innobase.cc
+++ b/sql/ha_innobase.cc
@@ -180,6 +180,47 @@ 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
+the prototype for this function! */
+
+void
+innobase_mysql_print_thd(
+/*=====================*/
+ void* input_thd)/* in: pointer to a MySQL THD object */
+{
+ THD* thd;
+
+ thd = (THD*) input_thd;
+
+ printf("MySQL thread id %lu, query id %lu",
+ thd->thread_id, thd->query_id);
+ if (thd->host) {
+ printf(" %s", thd->host);
+ }
+
+ if (thd->ip) {
+ printf(" %s", thd->ip);
+ }
+
+ if (thd->user) {
+ printf(" %s", thd->user);
+ }
+
+ if (thd->proc_info) {
+ printf(" %s", thd->proc_info);
+ }
+
+ if (thd->query) {
+ printf(" %0.100s", thd->query);
+ }
+
+ printf("\n");
+}
+}
+
/*************************************************************************
Gets the InnoDB transaction handle for a MySQL handler object, creates
an InnoDB transaction struct if the corresponding MySQL thread struct still
@@ -199,6 +240,8 @@ check_trx_exists(
dbug_assert(thd != NULL);
trx = trx_allocate_for_mysql();
+ trx->mysql_thd = thd;
+
thd->transaction.all.innobase_tid = trx;
/* The execution of a single SQL statement is denoted by
@@ -633,7 +676,7 @@ innobase_commit(
if (trx_handle != (void*)&innodb_dummy_stmt_trx_handle) {
trx_commit_for_mysql(trx);
- trx_mark_sql_stat_end(trx);
+ trx_mark_sql_stat_end_do_not_start_new(trx);
} else {
trx_mark_sql_stat_end(trx);
}
@@ -672,6 +715,7 @@ innobase_rollback(
if (trx_handle != (void*)&innodb_dummy_stmt_trx_handle) {
error = trx_rollback_for_mysql(trx);
+ trx_mark_sql_stat_end_do_not_start_new(trx);
} else {
error = trx_rollback_last_sql_stat_for_mysql(trx);
trx_mark_sql_stat_end(trx);
@@ -1334,8 +1378,15 @@ ha_innobase::write_row(
autoincrement field */
auto_inc = table->next_number_field->val_int();
- if (auto_inc == 0)
- auto_inc= user_thd->next_insert_id;
+
+ /* In replication and also otherwise the auto-inc column
+ can be set with SET INSERT_ID. Then we must look at
+ user_thd->next_insert_id. If it is nonzero and the user
+ has not supplied a value, we must use it. */
+
+ if (auto_inc == 0 && user_thd->next_insert_id != 0) {
+ auto_inc = user_thd->next_insert_id;
+ }
if (auto_inc != 0) {
/* This call will calculate the max of the
@@ -2221,29 +2272,29 @@ ha_innobase::external_lock(
if (trx->n_mysql_tables_in_use == 0) {
trx_mark_sql_stat_end(trx);
}
- thd->transaction.all.innodb_active_trans=1;
+ thd->transaction.all.innodb_active_trans = 1;
trx->n_mysql_tables_in_use++;
if (prebuilt->select_lock_type != LOCK_NONE) {
- trx->mysql_n_tables_locked++;
+ trx->mysql_n_tables_locked++;
}
} else {
trx->n_mysql_tables_in_use--;
if (trx->n_mysql_tables_in_use == 0) {
- trx->mysql_n_tables_locked = 0;
+ trx->mysql_n_tables_locked = 0;
- if (trx->has_search_latch) {
+ if (trx->has_search_latch) {
- trx_search_latch_release_if_reserved(trx);
- }
+ trx_search_latch_release_if_reserved(trx);
+ }
- if (!(thd->options
- & (OPTION_NOT_AUTO_COMMIT | OPTION_BEGIN))) {
- innobase_commit(thd, trx);
- }
+ if (!(thd->options
+ & (OPTION_NOT_AUTO_COMMIT | OPTION_BEGIN))) {
+ innobase_commit(thd, trx);
+ }
}
}
@@ -2639,6 +2690,10 @@ ha_innobase::records_in_range(
DBUG_ENTER("records_in_range");
+ if (prebuilt->trx) {
+ prebuilt->trx->op_info = "estimating range size";
+ }
+
active_index = keynr;
key = table->key_info + active_index;
@@ -2671,6 +2726,10 @@ ha_innobase::records_in_range(
my_free((char*) key_val_buff2, MYF(0));
+ if (prebuilt->trx) {
+ prebuilt->trx->op_info = "";
+ }
+
DBUG_RETURN((ha_rows) n_rows);
}
@@ -2690,10 +2749,15 @@ ha_innobase::estimate_number_of_rows(void)
row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
dict_table_t* ib_table;
+ if (prebuilt->trx) {
+ prebuilt->trx->op_info =
+ "estimating upper bound of table size";
+ }
+
DBUG_ENTER("info");
ib_table = prebuilt->table;
-
+
dict_update_statistics(ib_table);
data_file_length = ((ulonglong)
@@ -2702,6 +2766,10 @@ ha_innobase::estimate_number_of_rows(void)
/* The minimum clustered index record size is 20 bytes */
+ if (prebuilt->trx) {
+ prebuilt->trx->op_info = "";
+ }
+
return((ha_rows) (1000 + data_file_length / 20));
}
@@ -2740,6 +2808,10 @@ ha_innobase::info(
DBUG_ENTER("info");
+ if (prebuilt->trx) {
+ prebuilt->trx->op_info = "calculating table stats";
+ }
+
ib_table = prebuilt->table;
if (flag & HA_STATUS_TIME) {
@@ -2802,6 +2874,10 @@ ha_innobase::info(
trx_get_error_info(prebuilt->trx));
}
+ if (prebuilt->trx) {
+ prebuilt->trx->op_info = "";
+ }
+
DBUG_VOID_RETURN;
}