Commit graph

63 commits

Author SHA1 Message Date
marko
4047915e81 branches/5.1: Prevent a race condition in innobase_commit() by ensuring
that innodb_commit_concurrency>0 remains constant at run time. (Bug #42101)

srv_commit_concurrency: Make this a static variable in ha_innodb.cc.

innobase_commit_concurrency_validate(): Check that innodb_commit_concurrency
is not changed from or to 0 at run time.  This is needed, because
innobase_commit() assumes that innodb_commit_concurrency>0 remains constant.
Without this limitation, the checks for innodb_commit_concurrency>0
in innobase_commit() should be removed and that function would have to
acquire and release commit_cond_m at least twice per invocation.
Normally, innodb_commit_concurrency=0, and introducing the mutex operations
would mean significant overhead.

innodb_bug42101.test, innodb_bug42101-nonzero.test: Test cases.

rb://123 approved by Heikki Tuuri
2009-05-14 11:04:55 +00:00
vasil
af9b64a9d5 branches/5.1:
Fix Bug#43660 SHOW INDEXES/ANALYZE does NOT update cardinality for indexes
of InnoDB table

by replacing the PRNG that is used to pick random pages with a better
one.

This is based on r4670 but also adds a new configuration option and
enables the fix only if this option is changed. Please skip the present
revision when merging.

Approved by:	Heikki (via email)
2009-04-09 10:01:52 +00:00
inaam
ac4d073d1e branches/5.1:
Fix Bug#40760 "set global innodb_thread_concurrency = 0;" is not safe

The config param innodb_thread_concurrency is dynamically set and is
read when a thread enters/exits innodb. If the value is changed between
the enter and exit time the behaviour becomes erratic.
The fix is not to use srv_thread_concurrency when exiting, instead use
the flag trx->declared_to_be_inside_innodb.

rb://57

Approved by: Marko
2008-11-24 20:06:50 +00:00
vasil
18161a9819 branches/5.1:
Fix Bug#38189 innodb_stats_on_metadata missing

Make the variable innodb_stats_on_metadata visible to the users and
also settable at runtime. Previously it was only "visible" as a command
line startup option to mysqld.

Approved by:	Marko (https://svn.innodb.com/rb/r/36)
2008-10-28 10:10:25 +00:00
vasil
08c4820dd2 branches/5.1:
Fix Bug#36149 Read buffer overflow in srv0start.c found during "make test"

Use strncmp(3) instead of memcmp(3) to avoid reading past end of the string
if it is empty (*str == '\0'). This bug is _not_ a buffer overflow.

Discussed with:	Sunny (via IM)
2008-05-28 12:01:14 +00:00
vasil
068bf84c7a branches/5.1:
Fix Bug#36819 ut_usectime does not handle errors from gettimeofday

by retrying gettimeofday() several times if it fails in ut_usectime().
If it fails on all calls then return error to the caller to be handled
at higher level.

Update the variable innodb_row_lock_time_max in SHOW STATUS output only
if ut_usectime() was successful.
2008-05-27 07:40:07 +00:00
vasil
bb95926939 branches/5.1:
Fix Bug#36600 SHOW STATUS takes a lot of CPU in buf_get_latched_pages_number

by removing the Innodb_buffer_pool_pages_latched variable from
SHOW STATUS output in non-UNIV_DEBUG compilation.
 
Approved by:	Heikki
2008-05-19 13:59:42 +00:00
sunny
28e5a62684 branches/5.1: Remove the innodb_flush_method fdatasync option since it was
not being used and there was a potential it could mislead users.
2008-03-12 07:08:09 +00:00
inaam
ada26a245f branches/5.1: Port of r2267
This is a combination of changes that forward port the scalability fix applied to 5.0
through r1001.
It reverts changes r149 and r122 (these were 5.1 specific changes made in lieu of
scalability fix of 5.0)
Then it applies r1001 to 5.0 which is the original scalability fix.
Finally it applies r2082 which fixes an issue with the original fix.

Reviewed by: Heikki
2008-02-03 19:52:44 +00:00
vasil
2ee633f8eb Revert r1850 as MySQL did not approve the addition.
log for r1850:

Implement this feature request:
http://bugs.mysql.com/30706

* Add a function that returns the number of microseconds since
  epoch - ut_time_us().

* Add (innodb|innobase|srv)_replication_delay MySQL config parameter.

* Add UT_WAIT_FOR() macro that waits for a specified condition to occur
  until a timeout elapses.

* Using all of the above, handle the replication thread specially in
  srv_conc_enter_innodb().
2007-09-20 14:37:03 +00:00
vasil
8785af49a3 Implement this feature request:
http://bugs.mysql.com/30706

* Add a function that returns the number of microseconds since
  epoch - ut_time_us().

* Add (innodb|innobase|srv)_replication_delay MySQL config parameter.

* Add UT_WAIT_FOR() macro that waits for a specified condition to occur
  until a timeout elapses.

* Using all of the above, handle the replication thread specially in
  srv_conc_enter_innodb().

Approved by:	Heikki
2007-09-17 18:15:44 +00:00
marko
487677d01b Merge r1264 from branches/zip: Avoid memory fragmentation when
adding column definitions to tables.

dict_mem_table_add_col(): Add the parameter "heap" for temporary memory
allocation.  Allow it and "name" to be NULL.  These parameters are NULL
when creating dummy indexes.

dict_add_col_name(): Remove calls to ut_malloc() and ut_free().

dict_table_get_col_name(): Allow table->col_names to be NULL.

dict_table_add_system_columns(), dict_table_add_to_cache():
Add the parameter "heap".
---
Additional changes that had to be merged from branches/zip:

dict_table_add_system_columns(): New function, factored out from
dict_table_add_to_cache().

mlog_parse_index(): Add some consistency checks, and make use of
dict_table_add_system_columns().
2007-08-15 12:41:46 +00:00
vasil
00255d962b Fix Bug#20090 as suggested in the bug followup by Heikki.
Approved by:	Heikki
2007-06-04 14:00:44 +00:00
marko
a808cafee8 srv_lock_timeout_and_monitor_thread(): Correct the indentation that was
broken in r1521.
2007-05-29 08:41:59 +00:00
inaam
b1b1002a71 Forward port r1520 from branches/5.0
Patch to allow monitor threads to stop before proceeding with normal shutdown. 
Also have a separate time counter for tablespace monitor.

reviewed by: Heikki
2007-05-23 01:23:34 +00:00
marko
82b81a2987 Make InnoDB pluggable. That is, merge the modifications from MySQL WL#2936
and adapt some things.

Note that ha_innodb.cc depends on mysql_tmpfile() being declared in
<mysql/plugin.h>.  Until the function is declared there, you can
uncomment the buggy definition of mysql_tmpfile in ha_innodb.cc.

Remove storage/innobase/*/Makefile.am.  The whole compilation is driven by
storage/innobase/Makefile.am and storage/innobase/plug.in.

plug.in: Declare InnoDB as a dynamic plugin.

ha_innodb.h: Remove the declarations of many global variables.  The variables
are no longer directly referenced outside of storage/innobase.

trx_t: Add the field trx->duplicates.

trx_create(): Initialize the fields trx->active_trans and trx->duplicates.

innobase_query_is_update(): Remove.  Consult trx->duplicates instead.
2007-05-10 11:31:36 +00:00
vasil
02507a762a Fix typo in comment.
Spotted by:	Marko
2007-05-09 14:09:57 +00:00
vasil
05c9821a7c Fix Bug#25078 by always letting the replication thread on the slave
server to enter InnoDB. This can be made further customizable by the
user if we introduce a new config parameter. This will wait until
config parameters can be easily added.

Approved by:	Marko
2007-05-08 07:20:02 +00:00
vasil
f75a4b04a6 Fix typo in the comment. 2007-04-25 04:47:10 +00:00
sunny
5cdc5685d0 Fix code indentation from r1424. 2007-04-11 06:04:11 +00:00
sunny
f30895bdfc Bug# 20352. Added variable srv_insert_buffer_batch_size. We want to make
this variable settable. Since the pluggable engine interface currently
doesn't provide a usable mechanism, we will add the latter functionality
once it's available.
2007-04-11 04:12:40 +00:00
marko
09fbd1e0cb Output to the error log information about the limitations of
UNIV_IBUF_DEBUG.

innobase_start_or_create_for_mysql(): Note that crash recovery is broken
when UNIV_IBUF_DEBUG is defined.

ibuf_counts[]: Make this a two-dimensional array.  No need to allocate
anything from the heap.  Eliminate ibuf_counts_inited, as the array
will be zero-filled by the runtime environment.

ibuf_count_check(): New function, to print out an explanation before
assertion failure.
2007-04-10 17:58:27 +00:00
marko
86f93590f3 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
sunny
7c5df80879 Fix for Bug# 23666. On Windows ut_usectime returns secs
and usecs relative to the UNIX epoch (which is Jan, 1 1970).
2007-01-24 23:05:06 +00:00
marko
4c643e0e1a Merge r1239 from
branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG.
2007-01-18 21:27:31 +00:00
marko
b0b266a9c6 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
heikki
0daa938c0c Merge r1067:1077 from branches/5.0:
innobase_start_or_create_for_mysql(): Remove unnecessary delay now that
we moved the setting sync_order_checks_on=TRUE to log0recv.c,
to the start of the rollback phase in crash recovery.

Fix assertion failure sync0sync.c line 1239
(the latter ut_error in sync_thread_reset_level())
in crash recovery when UNIV_SYNC_DEBUG is enabled.
2006-11-28 14:37:05 +00:00
heikki
e8ad2f5744 Remove another accidentally committed change to srv0start.c.
The change was accidentally committed with the merge in r1068.
This revision corresponds to r1051 with a properly merged
r1067 of branches/5.0.
2006-11-27 15:14:35 +00:00
heikki
2e50afd62d Remove an accidentally committed change to srv0start.c.
The change was accidentally committed with the merge in r1068.
2006-11-27 15:09:50 +00:00
heikki
e8094c433d Merge r1067 from branches/5.0:
trx_rollback_for_mysql(), trx_commit_for_mysql():
Protect the creation of trx_dummy_sess with kernel_mutex.
This error was introduced in r1046 and r1050.
2006-11-27 15:06:43 +00:00
marko
5f73dd4b2e Port r983 from branches/zip: Enclose some more debug code in
#ifdef UNIV_SYNC_DEBUG to allow the code to be built
with UNIV_DEBUG but without UNIV_SYNC_DEBUG.
2006-11-21 13:53:48 +00:00
marko
4351bedba7 Merge changes from MySQL AB.
dict_col_copy_type_noninline(): Remove the return statement.
Some compilers do not allow return expressions of void type.

innobase_start_or_create_for_mysql(): Do not cap srv_max_threads to 1000
on Windows.

Makefile.am (EXTRA_DIST): Add plug.in
2006-10-05 11:00:06 +00:00
osku
a2a7c6cab5 Revamp the line splits done in r763 and r764 that can now be done better,
thanks to r826.
2006-09-19 07:22:21 +00:00
marko
79644bdb8e 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
osku
3729812895 Add dict_table_get_col_name() in preparation for getting rid of
dict_col_t::name, and use it instead of col->name everywhere.
2006-09-18 09:46:05 +00:00
marko
1c1026ec0d 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
osku
42f9837428 Add a warning comment above the place where we set srv_main_thread_op_info
to "waiting for server activity" that mentions that this string should not
be changed.
2006-08-31 11:01:15 +00:00
marko
27dffa4f7d Split lines before binary operators, not after them. 2006-08-29 08:27:56 +00:00
marko
917941e44c Split lines before an opening parenthesis, not after one.
Replace some printf(...) in debug builds with fprintf(stderr, ...).
2006-08-29 07:33:51 +00:00
marko
8f18616ef0 Reindent the code base (except for ha_innodb.{cc,h} and generated parser
and lexer files).  From now on, the following Emacs cc-mode settings apply
when indenting C function bodies in InnoDB:

(setq c-basic-offset 8)
(setq c-label-minimum-indentation 0)
(add-to-list 'c-offsets-alist '(c . 0))
(add-to-list 'c-offsets-alist '(label . [0]))

The indentation rules for function declarations still have not been
formalized, and they must be formatted manually.

Try to limit all lines to at most 79 characters (assuming TAB stops every
8 characters) by splitting lines before opening parenthesis, or at
string constants.

Fix some grammar mistakes in diagnostic output:
 match to, match with -> match
 found from -> found in
 trying rename -> trying to rename

Fix an error in page_check_dir(): it said "supremum not pointed to"
when the infimum was not pointed to.

Enclose commented-out code snippets in #if 0 ... #endif instead of /* ... */.
Add (void*) casts to some %p parameters in fprintf() calls.  Try to
split lines before a binary operator, not after one.  (These three fixes
were not made everywhere.)
2006-08-28 17:42:45 +00:00
marko
abe9dae496 srv_master_thread(): Add OS_THREAD_DUMMY_RETURN to get rid of a compiler
warning "no return value from a function returning non-void".
2006-08-17 08:51:42 +00:00
marko
b4270e7081 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
marko
b758497312 Correct all URLs pointing to the MySQL manual. (Bug #21467) 2006-08-08 10:54:57 +00:00
marko
85ccc78fe3 Adapt InnoDB to the new tablename to filename encoding in MySQL 5.1.
ut_print_name(), ut_print_namel(): Add parameter table_id for distinguishing
names of tables from other identifiers (names of indexes, columns and
constraints).

innobase_convert_from_table_id(), innobase_convert_from_id(),
innobase_convert_from_filename(), innobase_get_charset(): New functions.

dict_accept(), dict_scan_id(), dict_scan_col(), dict_scan_table_name(),
dict_skip_word(), dict_create_foreign_constraints_low():
Add parameter "cs", so that isspace() can be replaced with my_isspace(),
whose operation depends on the connection character set.

dict_scan_id(): Convert the identifier to UTF-8.

dict_str_starts_with_keyword(): New extern function, to replace dict_accept()
in row_search_for_mysql().

mysql_get_identifier_quote_char(): Replaced with innobase_print_identifier().

ha_innobase::create(): Remove the thd->convert_string() call.
Pass the statement to InnoDB in the connection character set
and let InnoDB convert the identifiers to UTF-8.
2006-05-24 10:27:17 +00:00
marko
fc77030d39 srv_parse_data_file_paths_and_sizes(): Accept lower-case 'm' and 'g'
as abbreviations of megabyte and gigabyte.  (Bug #19609)

srv_parse_megabytes(): New function.
2006-05-12 19:25:18 +00:00
osku
47f0a5aa7a srv_master_thread(): Remove unreachable code. 2006-04-29 04:43:37 +00:00
osku
5d3bf05722 Add parens to return statements where they are missing (except in
ha_innodb.cc).
2006-04-28 11:57:13 +00:00
osku
f970488ae0 Add 'level' parameter to mutex_create(), remove mutex_set_level().
Rename SYNC_LEVEL_NONE to SYNC_LEVEL_VARYING, add comment clarifying what it
is used for.
2006-04-28 05:43:08 +00:00
osku
ca150507fc Add platform-specific os_thread_ret_t and OS_THREAD_DUMMY_RETURN, and
convert thread start functions to use them.
2006-04-21 12:09:12 +00:00
osku
99585c9bae Remove srv_sys->operational since it is unused. 2006-04-21 07:04:02 +00:00