Commit graph

111 commits

Author SHA1 Message Date
sunny
f5efdbcf76 Fix for bug# 21101 - returns wrong error message when table column
defs exceed the max row size.

The fix returns a more appropriate error message. Add a test case to
innodb.test and expected output to innodb.result.
2007-04-11 01:34:33 +00:00
marko
b9902f7ac5 Report the current value of the AUTO_INCREMENT counter to MySQL.
(Bug #23313, Bug #21404)

ha_innobase::update_create_info(): New function, to report
the auto_increment_value.
2007-04-02 07:20:23 +00:00
marko
278c29e576 innobase_commit(): Correct the comments and formatting that were broken when
innodb_commit_concurrency was implemented.
2007-03-27 17:59:15 +00:00
marko
4f1615b745 Remove ha_innobase::last_query_id and references to thd->query_id.
MySQL calls external_lock at the beginning and end of a statement
when it is not calling start_stmt or commit or rollback.  Thus,
statement boundaries can be (and are already) detected without
monitoring thd->query_id.

The function innobase_commit() seemingly lacks the call to
innobase_release_stat_resources(), which should be called at
the end of every SQL statement.  The call was replaced by
equivalent statements by Vadim Tkachenko when he implemented
innodb_commit_concurrency in MySQL 5.0:

http://mysql.bkbits.net:8080/mysql-5.0/?PAGE=patch&REV=1.1886.70.1
2007-03-27 13:17:47 +00:00
marko
0f505f92d1 Add static qualifiers to some symbols in ha_innodb.cc that are not
referenced from other modules.
2007-03-27 08:22:27 +00:00
marko
e15454c52a Merge a change from MySQL AB:
ChangeSet@1.2409.1.83  2007-03-06 10:36:15-07:00  tsmith@hindu.god
Bug #26598: Create variable to allow turning off of statistic gathering
on metadata commands

Add innodb_stats_on_metadata option, which enables gathering
index statistics when processing metadata commands such as
SHOW TABLE STATUS.  Default behavior of the server does not
change (this option is enabled by default).
2007-03-26 08:16:35 +00:00
marko
b054fc69b0 Minor cleanup.
innobase_query_caching_of_table_permitted(): Make static.

ha_innobase::register_query_cache_table(): Move the function
definition from ha_innodb.h to ha_innodb.cc.  Add comments.
2007-03-21 10:02:00 +00:00
marko
8ac40ae7a7 class ha_innobase: Replace statistic_increment() with ha_statistic_increment().
ha_innobase::change_active_index(): Do not call current_thd unless
UNIV_DEBUG is defined.
2007-03-19 09:28:49 +00:00
marko
a8b14b8eba Minor cleanup in ha_innodb.cc.
Remove the unused constants HA_INNOBASE_ROWS_IN_TABLE and
HA_INNOBASE_RANGE_COUNT.  Declare innobase_active_counter static.
2007-03-08 07:54:54 +00:00
sunny
b76aeffed9 Fix for Bug# 21409. At low transaction isolation levels we let each
consistent read set its own snapshot
2007-03-05 00:37:57 +00:00
marko
5b7f96f982 Merge changes from MySQL AB:
ChangeSet@1.2452, 2007-02-23 13:13:55+02:00, monty@mysql.com +177 -0
  Fixed compiler warnings
  ...
  Fixed compiler warnings detected on windows64
2007-03-01 15:21:12 +00:00
marko
f74103028f ha_innodb.cc: Remove the unused innobase_repl_ variables. 2007-03-01 13:28:36 +00:00
marko
48d8e9819a ha_innodb.cc: Replace thd->tablespace_op with thd_tablespace_op(thd).
Plugins must treat class THD as an opaque type.
2007-02-15 14:10:41 +00:00
marko
8ea36d5647 ha_innodb.cc: Replace thd->in_lock_tables with thd_in_lock_tables(thd).
Plugins must treat class THD as an opaque type.
2007-02-15 14:09:49 +00:00
marko
6dbc015b33 ha_innodb.cc: Remove all references to thd->ha_data[hton->slot].
thd_to_trx(thd, hton): Accessor for getting the InnoDB trx object
of a MySQL thread object and an InnoDB handlerton.
2007-02-14 20:03:58 +00:00
marko
57990bb42e Remove the declarations of some global functions in ha_innodb.h and declare
them static in ha_innodb.cc.  These functions are invoked via function
pointers in handlerton.
2007-02-12 13:08:02 +00:00
marko
e622cb9325 Merge changes from MySQL AB:
Rename some FIELD_TYPE_ constants to MYSQL_TYPE_.

Change the scope of a type cast of two dividends.
2007-02-02 11:14:02 +00:00
osku
12b80747f2 Change this in ha_innobase:
void*           innobase_prebuilt;

to this:

 row_prebuilt_t* prebuilt;

by introducing the typedef in ha_innodb.h, and remove all the now needless
local variables and casts in ha_innodb.cc.
2007-01-11 14:24:53 +00:00
osku
03b9c45ec3 Apply patch from MySQL:
ChangeSet@1.2353, 2006-12-19 16:57:51-07:00, tsmith@siva.hindu.god +13 -0
   Added innodb_rollback_on_timeout option to restore the 4.1 
   InnoDB timeout behavior (Bug #24200)
2007-01-11 11:45:58 +00:00
marko
79b0e5d2dc Merge a change from MySQL AB:
ChangeSet@1.2372, 2006-12-31 02:29:11+01:00, kent@mysql.com +79 -0
  Many files:
    Removed "MySQL Finland AB & TCX DataKonsult AB" from copyright header
    Adjusted year(s) in copyright header 
    Added GPL copyright text
2007-01-11 09:36:27 +00:00
sunny
cc80a72c2a Fix a potential bug in ha_innodb.cc:innobase_query_is_update() where the
function can be called with "current_thd == NULL". Minor non-functional fix
in log0recv.c
2006-12-15 04:23:43 +00:00
osku
8184675a96 Unify dict_table_get_and_increment_handle_count() with dict_table_get() by
adding a second parameter, adjust callers.
2006-12-12 09:37:18 +00:00
osku
17e67cd556 ha_innodb.cc: Remove unused define MAX_ULONG_BIT. 2006-12-07 12:45:26 +00:00
heikki
0138132c05 Fix bug #24712: SHOW TABLE STATUS for file-per-table showing incorrect
time fields
2006-12-01 15:38:56 +00:00
marko
05a583aab3 Port r1034 from branches/zip: Remove some instrumentation and reduce
the output of SHOW MUTEX STATUS in non-debug builds.  (Bug #24386)
2006-11-21 13:56:18 +00:00
marko
0fb091df90 Merge a change from MySQL AB.
ChangeSet
  2006/11/10 17:22:43+02:00 aelkin@dsl-hkibras-fe30f900-107.dhcp.inet.fi 
  Bug #24190  many exportable definitions of field_in_record_is_null
  
  mysql had several(2) exportable definitions of field_in_record_is_null function.
  
  Fixed with adding static.

storage/innobase/handler/ha_innodb.cc
  2006/11/10 17:22:36+02:00 aelkin@dsl-hkibras-fe30f900-107.dhcp.inet.fi +1 -1
  made static
2006-11-16 15:05:23 +00:00
marko
f3cf33657c Minor cleanup.
ha_innobase::rnd_pos(): Use correct format in DBUG_PRINT statements.

buf_page_release(): Remove the local variable buf_fix_count.
2006-11-10 10:09:41 +00:00
osku
c08c1e65c9 Merge changes from MySQL to get the code compiling again:
Change return type of ha_innobase::info to int.

 plug.in: Add MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS.
2006-11-03 11:44:29 +00:00
marko
14fed4b06e ha_innobase::store_lock(): When downgrading table locks, do not
check thd->in_lock_tables but test if
thd->lex->sql_command == SQLCOM_LOCK_TABLES
instead.  Otherwise, stored functions will use table locks.  (Bug #18077)

This patch is from Heikki.
2006-10-16 12:19:36 +00:00
marko
bdf65e705e Merge changes from MySQL AB, and remove two compilation warnings.
ha_innodb.cc: innodb_mutex_show_status(): Add (ulong) casts to
ulonglong expressions being passed to fprintf %lu.  The warnings
were apparently introduced by MySQL AB developers.

mysql_declare_plugin(innobase): Add PLUGIN_LICENSE_GPL.

have_innodb.inc: Merge changes from MySQL AB.
2006-10-09 09:08:50 +00:00
marko
d3c13fb022 storage/innobase/handler: Merge changes from MySQL AB:
ChangeSet
  2006/09/30 18:44:42-07:00 brian@zim.(none) 
  Merge zim.(none):/home/brian/mysql/merge-5.1
  into  zim.(none):/home/brian/mysql/arch-5.1

ChangeSet
  2006/09/30 12:49:46-07:00 brian@zim.(none) 
  This patch adds handlerton passing to functions. NDB and Innodb still require a global hanlderton in the main code due to the nature of the sql_cache call back function (should be solveable... another patch).
  Partitioning now has a flag to allow disabling of engines from being compatible with partitioning. Cleaned up heap naming convention on panic call. 

ChangeSet
  2006/09/29 17:19:02-07:00 brian@zim.(none) 
  This removes the passing of global hton to engine instance. 

ChangeSet
  2006/09/28 13:22:56+02:00 gbichot@dl145h.mysql.com 
  Merge gbichot@bk-internal:/home/bk/mysql-5.1-arch
  into  dl145h.mysql.com:/users/gbichot/mysql-5.1-arch

ChangeSet
  2006/09/28 13:19:43+02:00 gbichot@dl145h.mysql.com 
  In the handlerton, cursor creation function don't have an argument
  and so the engine calls current_thd to derive transaction information;
  instead we now pass THD to those functions, it looks more logical
  (it makes the implicit current_thd parameter more visible).
  Approved by Brian and Monty.

ChangeSet
  2006/09/26 22:51:53-07:00 brian@zim.(none) 
  Merge zim.(none):/home/brian/mysql/merge-5.1
  into  zim.(none):/home/brian/mysql/arch-5.1
2006-10-03 12:46:23 +00:00
marko
975a6df3e3 Merge code from MySQL AB:
Make innobase_hton a pointer.
2006-09-20 09:38:09 +00:00
marko
7e894a1b88 ha_innobase::start_stmt(): Remove the check for
prebuilt->stored_select_lock_type being LOCK_X or LOCK_S.
This would cause false alarms with INSERT ... SELECT, which would use
LOCK_NONE in innodb_locks_unsafe_for_binlog mode.  (Bug #10746)
2006-09-20 08:52:00 +00:00
marko
f39237e200 dict_col_t: Copy the fields of "dtype_t type" directly to this structure,
so that all integer fields can be packed into 64 bits.  (Bug #20877)

dtype_t: Change the type of all bit-fields to unsigned.

dict_table_get_nth_col(), dict_table_get_sys_col_noninline(),
dict_table_get_sys_col(), dict_field_get_col(): Return const
dict_col_t*, so that changes to dict_col_t can be detected more
easily.  Add const to many dict_col_t* declarations.

dict_index_get_nth_type(): Replace with dict_index_get_nth_col().

dict_col_get_type(): Replace with dict_col_copy_type().

dict_col_get_min_size(), dict_col_get_max_size(), dict_col_get_fixed_size(),
dict_col_get_sql_null_size(): New functions.

dtype_get_at_most_n_mbchars(): Replace the parameter dtype
with the parameters prtype, mbminlen, mbmaxlen.

dtype_get_pad_char(), cmp_data_data(), cmp_data_data_slow(),
cmp_whole_field(): Replace the dtype_t* parameter with the ulint
parameters mtype, prtype.

dtype_copy(): Add a const qualifier to type2 (the one being copied from).

dtype_set_mblen(): Replaced with dtype_get_mblen().

dtype_get_fixed_size_low(), dtype_get_min_size_low(),
dtype_get_fixed_max_low(): Replace dtype_get_fixed_size(),
dtype_get_min_size(), and dtype_get_max_size().  These are used by the
dict_col_get_{fixed,min,max}_size() functions.

cmp_types_are_equal(): Replace with cmp_cols_are_equal().

dict_table_get_col_name(): Add a const qualifier parameter to the
parameter "table".

dtype_binary, dtype_binary_val: Remove.

dtype_is_fixed_size(): Remove.
2006-09-18 11:51:38 +00:00
marko
a78e211315 Add dict_col_get_clust_pos_noninline(), which was forgotten from r820. 2006-09-18 08:50:31 +00:00
marko
5df36be646 Turn ha_innobase::build_template() from a non-static member function
to a static plain function.
2006-09-14 13:10:46 +00:00
marko
9ac21cdea4 Remove dict_col_t::clust_pos.
dict_col_get_clust_pos(): Add parameter clust_index.  Replace the
look-up with a linear search of all columns in the clustered index.

row_upd_index_replace_new_col_vals(): Compute clust_index outside
the loops.  Compute clust_pos outside the inner loop.

row_upd_changes_ord_field_binary(), row_upd_changes_first_fields_binary():
Compute clust_index outside the loops.  Declare the auxiliary variables
inside the loop scope.
2006-09-14 11:51:34 +00:00
marko
e9d8c5e88a mysql_declare_plugin(innobase): Initialize the fields
reserved1 (apparently the system variables) and
reserved2 (apparently the configuration options).
2006-09-13 11:35:34 +00:00
marko
0245fe4a31 Reduce the size of the data dictionary cache. (Bug #20877)
dtype_t: Remove unused field "prec", which was supposed to be used for
the precision of decimal columns in stand-alone InnoDB.

dtype_get_prec(): Remove.

dtype_set(), dict_mem_table_add_col(): Remove parameter "prec".

dtype_t: Turn all fields (mtype, prtype, len, mbminlen, mbmaxlen, len)
into bit-fields.

dict_table_t, dict_index_t, dict_tree_t: Omit magic_n from non-debug builds.

dict_col_t: Turn ind, clust_pos, and ord_part into bit-fields.

Replace the default clust_pos value ULINT_UNDEFINED with
REC_MAX_N_FIELDS and replace all references to clust_pos with calls to
the accessor function dict_col_get_clust_pos().

dict_field_t: Turn prefix_len and fixed_len into bit-fields.

dict_tree_t: Remove pad[64].

dict_table_t: Turn the fields ibd_file_missing, tablespace_discarded,
cached, flags, stat_initialized, and autoinc_inited into bit-fields.
Remove does_not_fit_in_memory from non-debug builds.

dict_index_t: Turn the fields trx_id_offset, n_user_defined_cols,
n_uniq, n_def, n_fields, n_nullable, and cached into bit-fields.

dict_foreign_struct: Turn n_fields and type into bit-fields.

rw_lock_t: Turn cline, last_s_line, and last_x_line into bit-fields.
Omit level unless #defined UNIV_SYNC_DEBUG.

Move REC_MAX_N_FIELDS (and REC_MAX_HEAP_NO and REC_MAX_N_OWNED)
from rem0rec.c to rem0types.h, as they are needed in dict0dict.ic.
dict_col_get_clust_pos(): Map REC_MAX_N_FIELDS to ULINT_UNDEFINED.
2006-09-12 14:06:46 +00:00
marko
db256d897e Merge code cleanup from MySQL AB:
ChangeSet
  2006/09/07 08:23:58-07:00 brian@zim.(none) 
  Moves Innodb handler to the Innodb storage directory.

storage/innobase/handler/ha_innodb.cc
  2006/09/07 08:23:53-07:00 brian@zim.(none) +2 -3
  Adjusted include files, also disabled replication code which was not
  being used.

ChangeSet
  2006/09/07 12:34:12-07:00 brian@zim.(none) 
  Fix for a compile problem in Windows. 

storage/innobase/handler/ha_innodb.cc
  2006/09/07 12:34:10-07:00 brian@zim.(none) +0 -28
  Removed some dead code (Marko approved)
2006-09-11 08:58:43 +00:00
marko
8ac86bd8fd Merge change from MySQL AB:
ChangeSet
  2006/08/23 15:12:42-07:00 brian@zim.(none) 
  This is a cleanup of warnings that windows is complaining about. 

sql/ha_innodb.cc
  2006/08/23 15:12:39-07:00 brian@zim.(none) +0 -1
  Removed unused variables
2006-09-05 19:25:38 +00:00
marko
489ada03ec Merge code from MySQL AB:
ChangeSet
  2006/08/22 16:24:12-07:00 brian@zim.(none) 
  This changest:
  Plugins now when compiled or not compiled work correctly with status variables. 
  Status variables from plugins now set their own names (removed bit where plugin name was pre-appended this broke Innodb and Cluster)
  A few Makefile cleanups. 

sql/ha_innodb.cc
  2006/08/22 16:24:08-07:00 brian@zim.(none) +16 -6
  Cleanup to make status variables directly in engine
2006-09-04 10:45:05 +00:00
marko
2570bfa1bd ha_innodb.cc: Adjust the comment related to r784. Apparently it was
changed after review on the MySQL side.
2006-09-04 10:40:43 +00:00
marko
0af6b4a259 Merge a patch from MySQL AB:
ChangeSet@1.2288, 2006-08-29 15:35:05+02:00, guilhem@gbichot3.local +2 -0
  Fix for BUG#20866 "show table status on innodb raises assertion"
  and its duplicate BUG#19057 "Test 'rpl_row_func003' fails on SuSE SLES9 x86".
  It was an assertion failure, only in debug builds, not present
  in released versions (nothing to document).
  It happened when doing SHOW TABLE STATUS on an InnoDB table
  having an auto_increment column, right after creating the table.

  sql/ha_innodb.cc@1.288, 2006-08-29 15:35:02+02:00, guilhem@gbichot3.local +7 -1
    Before a val_() calls on a Field object, if that field was not marked
    for read, we need to mark it. This is explained here:
    ChangeSet 1.2119.601.1 2006/06/04 18:52:22 monty@mysql.com
    quoting the changeset's comment:
    
      - If a handler needs to call Field->val() or Field->store() on columns
        that are not used in the query, one should install a temporary
        all-columns-used map while doing so. For this, we provide the following
        functions:
      
        my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->read_set);
        field->val();
        dbug_tmp_restore_column_map(table->read_set, old_map);
      
        and similar for the write map:
      
        my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->write_set);
        field->val();
        dbug_tmp_restore_column_map(table->write_set, old_map);
      
        If this is not done, you will sooner or later hit a DBUG_ASSERT
        in the field store() / val() functions.
        (For not DBUG binaries, the dbug_tmp_restore_column_map() and
        dbug_tmp_restore_column_map() are inline dummy functions and should
        be optimized away be the compiler).
    
    Note that I verified that the bug didn't exist in non-debug builds.
2006-09-01 08:29:44 +00:00
marko
cc69e94438 Revert the hunk on ha_innobase::innobase_read_and_init_auto_inc()
that was accidentally committed in r782.
2006-09-01 08:19:47 +00:00
heikki
085c36edfe Fix bug #21784 of a crash in DROP TABLE with concurrent queries on the table 2006-08-31 19:52:25 +00:00
marko
bddc3be327 Merge a patch from MySQL AB (Mats Kindal):
Lock and unlock prepare_commit_mutex under the same conditions.
2006-08-22 07:20:52 +00:00
marko
5ea580635c ha_innobase::delete_all_rows(): Correct an error introduced in r705:
Replace the local variable "trx" with "prebuilt->trx".

Also, replace the second invocation of the macro current_thd with
the local variable thd.
2006-08-11 08:44:10 +00:00
marko
b689519f0b Merge a change from MySQL AB (originally implemented by Marko
in the 5.0 tree and now merged to the 5.1 tree):

# ChangeSet
#   2006/07/29 07:17:33+04:00 aivanov@mysql.com 
#   Make innodb_flush_log_at_trx_commit a settable global variable.
# 
# sql/ha_innodb.cc
#   2006/07/29 07:17:29+04:00 aivanov@mysql.com +1 -3
#   Remove innobase_flush_log_at_trx_commit
#   (set srv_flush_log_at_trx_commit directly).
# 
# sql/ha_innodb.h
#   2006/07/29 07:17:29+04:00 aivanov@mysql.com +1 -1
#   Remove innobase_flush_log_at_trx_commit.
#   Declare srv_flush_log_at_trx_commit.
# 
# storage/innobase/include/srv0srv.h
#   2006/07/29 07:17:30+04:00 aivanov@mysql.com +1 -1
#   Change the type of srv_flush_log_at_trx_commit.
# 
# storage/innobase/srv/srv0srv.c
#   2006/07/29 07:17:30+04:00 aivanov@mysql.com +1 -1
#   Change the type of srv_flush_log_at_trx_commit.
#
2006-08-11 08:05:40 +00:00
heikki
36f0308468 Remove redundant check_trx_exists() and ut_a() from r701,
as suggested by Marko
2006-08-08 11:38:34 +00:00