Commit graph

443 commits

Author SHA1 Message Date
Mattias Jonsson
d7e7afd403 Merge of bug#51851.
Also moved HA_DATA_PARTITION from ha_partition.cc to table.h.
2010-05-24 14:51:59 +02:00
Mattias Jonsson
ae171f1e40 merge into mysql-5.1-bugteam 2010-05-21 14:18:14 +02:00
Alexey Kopytov
a6cf28a7a1 Manual merge from mysql-5.1-bugteam to mysql-trunk-merge.
Conflicts:

Text conflict in sql/sql_base.cc
Text conflict in sql/sql_partition.cc
Text conflict in sql/sql_priv.h
Text conflict in sql/sql_show.cc
2010-05-11 20:02:50 +04:00
Mats Kindahl
e409d6f69c WL#5030: Split and remove mysql_priv.h
This patch:

- Moves all definitions from the mysql_priv.h file into
  header files for the component where the variable is
  defined
- Creates header files if the component lacks one
- Eliminates all include directives from mysql_priv.h
- Eliminates all circular include cycles
- Rename time.cc to sql_time.cc
- Rename mysql_priv.h to sql_priv.h
2010-03-31 16:05:33 +02:00
Mattias Jonsson
864d6bc90b Bug#51851: Server with SBR locks mutex twice on LOAD DATA
into partitioned MyISAM table

Problem was that the ha_data structure was introduced in 5.1
and only used for partitioning first, but with the intention
of be of use for others engines as well, and when used by other
engines it would clash if it also was partitioned.

Solution is to move the partitioning specific data to a separate
structure, with its own mutex (which is used for auto_increment).

Also did rename PARTITION_INFO to PARTITION_STATS since there
already exist a class named partition_info, also cleaned up
some related variables.
2010-03-30 22:52:45 +02:00
Alexey Kopytov
f10885675c Manual merge of mysql-trunk into mysql-trunk-merge.
Conflicts:

Text conflict in client/mysqlbinlog.cc
Text conflict in mysql-test/Makefile.am
Text conflict in mysql-test/collections/default.daily
Text conflict in mysql-test/r/mysqlbinlog_row_innodb.result
Text conflict in mysql-test/suite/rpl/r/rpl_typeconv_innodb.result
Text conflict in mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test
Text conflict in mysql-test/suite/rpl/t/rpl_row_create_table.test
Text conflict in mysql-test/suite/rpl/t/rpl_slave_skip.test
Text conflict in mysql-test/suite/rpl/t/rpl_typeconv_innodb.test
Text conflict in mysys/charset.c
Text conflict in sql/field.cc
Text conflict in sql/field.h
Text conflict in sql/item.h
Text conflict in sql/item_func.cc
Text conflict in sql/log.cc
Text conflict in sql/log_event.cc
Text conflict in sql/log_event_old.cc
Text conflict in sql/mysqld.cc
Text conflict in sql/rpl_utility.cc
Text conflict in sql/rpl_utility.h
Text conflict in sql/set_var.cc
Text conflict in sql/share/Makefile.am
Text conflict in sql/sql_delete.cc
Text conflict in sql/sql_plugin.cc
Text conflict in sql/sql_select.cc
Text conflict in sql/sql_table.cc
Text conflict in storage/example/ha_example.h
Text conflict in storage/federated/ha_federated.cc
Text conflict in storage/myisammrg/ha_myisammrg.cc
Text conflict in storage/myisammrg/myrg_open.c
2010-03-24 18:03:44 +03:00
Alexey Kopytov
acc2b9e366 Manual merge of mysql-5.1-bugteam to mysql-trunk-merge.
Conflicts:

Text conflict in mysql-test/r/partition_innodb.result
Text conflict in sql/field.h
Text conflict in sql/item.h
Text conflict in sql/item_cmpfunc.h
Text conflict in sql/item_sum.h
Text conflict in sql/log_event_old.cc
Text conflict in sql/protocol.cc
Text conflict in sql/sql_select.cc
Text conflict in sql/sql_yacc.yy
2010-03-20 23:23:42 +03:00
Mattias Jonsson
3b897f2bc5 Bug#50561: ALTER PARTITIONS does not have adequate lock, breaks with
concurrent I_S query

There were two problem:
1) MYSQL_LOCK_IGNORE_FLUSH also ignored name locks
2) there was a race between abort_and_upgrade_locks and
   alter_close_tables
   (i.e. remove_table_from_cache and
    close_data_files_and_morph_locks)

Which allowed the table to be opened with MYSQL_LOCK_IGNORE_FLUSH flag
resulting in renaming a partition that was already in use,
which could cause the table to be unusable.

Solution was to not allow IGNORE_FLUSH to skip waiting for
a named locked table.

And to not release the LOCK_open mutex between the
calls to remove_table_from_cache and
close_data_files_and_morph_locks by merging the functions
abort_and_upgrade_locks and alter_close_tables.
2010-03-17 15:10:41 +01:00
Mattias Jonsson
da26454dcb merged 2010-03-12 11:14:40 +01:00
Mattias Jonsson
cb6d0e3cac merge 2010-03-11 14:18:44 +01:00
Mattias Jonsson
25596746db Bug#50392: insert_id is not reset for partitioned tables
auto_increment on duplicate entry

The bug was that when INSERT_ID was used and the storage
engine was told to release any reserved but not used
auto_increment values, it set the highest auto_increment
value to INSERT_ID.

The fix was to check if the auto_increment value was forced
by user (INSERT_ID) or by slave-thread, i.e. not auto-
generated. So that it is only allowed to release generated
values.
2010-03-04 18:16:10 +01:00
Mattias Jonsson
2d5c6b5bfe Bug#48229: group by performance issue of partitioned table
Problem was block_size on partitioned tables was not set,
resulting in keys_per_block was not correct which affects
the cost calculation for read time of indexes (including
cost for group min/max).Which resulted in a bad optimizer
decision.

Fixed by setting stats.block_size correctly.
2010-03-04 12:09:09 +01:00
Mattias Jonsson
af738870d4 Fix for debug print of null string
(fails on pb for solaris debug_max)
2010-03-03 15:58:12 +01:00
Alexander Nozdrin
04b8cb1882 Manual merge from mysql-trunk-merge.
Conflicts:
  - client/mysql.cc
  - client/mysqldump.c
  - configure.in
  - mysql-test/r/csv.result
  - mysql-test/r/func_time.result
  - mysql-test/r/show_check.result
  - mysql-test/r/sp-error.result
  - mysql-test/r/sp.result
  - mysql-test/r/sp_trans.result
  - mysql-test/r/type_blob.result
  - mysql-test/r/type_timestamp.result
  - mysql-test/r/warnings.result
  - mysql-test/suite/rpl/r/rpl_sp.result
  - sql/mysql_priv.h
  - sql/mysqld.cc
  - sql/sp.cc
  - sql/sql_base.cc
  - sql/sql_table.cc
  - sql/sql_trigger.cc
  - sql/sql_view.cc
  - sql/table.h
  - sql/share/errmsg.txt
  - mysql-test/suite/sys_vars/r/log_bin_trust_routine_creators_basic.result
2010-02-24 16:52:27 +03:00
Alexey Kopytov
8c31c4d16c Manual merge of mysql-5.1-bugteam to mysql-trunk-merge. 2010-02-22 00:33:11 +03:00
Mattias Jonsson
252db713c9 Manual merge (moved the check for log_table before name lock) 2010-02-12 10:03:10 +01:00
Konstantin Osipov
9c030fe508 Merge next-mr -> next-4284. 2010-02-06 13:28:06 +03:00
Konstantin Osipov
ad0f1f8021 Merge next-mr -> next-4284. 2010-02-05 01:08:08 +03:00
Konstantin Osipov
b92ab41c5c Merge next-mr -> next-4284 2010-02-03 16:43:03 +03:00
Konstantin Osipov
0ce6d93f85 Merge next-mr -> next-4284. 2010-02-03 03:06:42 +03:00
Mattias Jonsson
54c076e984 Bug#42438: Crash ha_partition::change_table_ptr
There was two problems:
The first was the symptom, caused by bad error handling in
ha_partition. It did not handle print_error etc. when
having no partitions (when used by dummy handler).

The second was the real problem that when dropping tables
it reused the table type (storage engine) from when the lock
was asked for, not the table type that it had when gaining
the exclusive name lock. So that it tried to delete tables
from wrong storage engines.

Solutions for the first problem was to accept some handler
calls to the partitioning handler even if it was not setup
with any partitions, and also if possible fallback
to use the base handler's default functions.

Solution for the second problem was to remove the optimization
to reuse the definition from the cache, instead always check
the frm-file when holding the LOCK_open mutex

(updated with a fix for a debug print crash and better
comments as required by reviewer, and removed optimization
to avoid reading the frm-file).
2010-02-01 16:07:00 +01:00
Alexander Nozdrin
274a193ded Auto-merge from mysql-trunk-merge.
main.partition_innodb started to pass.
2010-01-28 00:42:22 +03:00
Alexander Nozdrin
0531110e23 Manual merge from mysql-trunk-merge.
Conflicts:
  - sql/ha_partition.cc
  - sql/sql_partition.cc

The following tests started to fail:
  - main.partition_innodb (a crash)
2010-01-28 00:24:35 +03:00
Alexey Kopytov
7b5f5d5c37 Manual merge of mysql-5.1-bugteam into mysql-trunk-merge. 2010-01-24 00:09:23 +03:00
Alexander Nozdrin
eacc937d48 Manual merge from mysql-trunk-merge.
Conflicts:
  - configure.in
  - include/m_string.h
  - mysql-test/extra/rpl_tests/rpl_row_func003.test
  - mysql-test/r/mysqlbinlog.result
  - mysql-test/r/union.result
  - mysql-test/suite/binlog/r/binlog_killed_simulate.result
  - mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result
  - mysql-test/suite/binlog/r/binlog_unsafe.result
  - mysql-test/suite/binlog/t/binlog_unsafe.test
  - mysql-test/suite/rpl/r/rpl_loaddata_fatal.result
  - mysql-test/suite/rpl/r/rpl_loaddata_map.result
  - mysql-test/suite/rpl/r/rpl_stm_loaddata_concurrent.result
  - mysql-test/suite/rpl/r/rpl_stm_log.result
  - mysql-test/suite/rpl/t/rpl_optimize.test
  - mysql-test/t/mysqlbinlog.test
  - mysql-test/t/union.test
  - sql/rpl_utility.h
  - sql/sql_union.cc
  - strings/Makefile.am
2010-01-19 19:36:14 +03:00
Mattias Jonsson
fdf1441a5a post-push patch for bug#47343.
Missing ha_rnd_end in copy_partitions, found due to a
DBUG_ASSERT in mysql-pe
2010-01-19 17:02:51 +01:00
Mattias Jonsson
b1987bdcbf Bug#47343: InnoDB fails to clean-up after lock wait timeout on
REORGANIZE PARTITION

There were several problems which lead to this this,
all related to bad error handling.

1) There was several bugs preventing the ddl-log to be used for
   cleaning up created files on error.

2) The error handling after the copy partition rows did not close
   and unlock the tables, resulting in deletion of partitions
   which were in use, which lead InnoDB to put the partition to
   drop in a background queue.
2010-01-18 17:49:18 +01:00
Alfranio Correia
46d1689b7c merge mysql-next-mr --> mysql-5.1-rpl-merge
Conflicts:
  Text conflict in sql/log.cc
  Text conflict in sql/slave.cc
  Text conflict in sql/sql_base.cc
2010-01-13 12:22:34 +00:00
b805e3d4d6 Manual merge from next-mr. 2010-01-12 20:07:09 +08:00
Alfranio Correia
6f7929b143 merge mysql-5.1-rep+2-delivery1 --> mysql-5.1-rpl-merge
Conflicts:

Text conflict in .bzr-mysql/default.conf
Text conflict in mysql-test/extra/rpl_tests/rpl_loaddata.test
Text conflict in mysql-test/r/mysqlbinlog2.result
Text conflict in mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
Text conflict in mysql-test/suite/binlog/r/binlog_unsafe.result
Text conflict in mysql-test/suite/rpl/r/rpl_insert_id.result
Text conflict in mysql-test/suite/rpl/r/rpl_loaddata.result
Text conflict in mysql-test/suite/rpl/r/rpl_stm_auto_increment_bug33029.result
Text conflict in mysql-test/suite/rpl/r/rpl_udf.result
Text conflict in mysql-test/suite/rpl/t/rpl_slow_query_log.test
Text conflict in sql/field.h
Text conflict in sql/log.cc
Text conflict in sql/log_event.cc
Text conflict in sql/log_event_old.cc
Text conflict in sql/mysql_priv.h
Text conflict in sql/share/errmsg.txt
Text conflict in sql/sp.cc
Text conflict in sql/sql_acl.cc
Text conflict in sql/sql_base.cc
Text conflict in sql/sql_class.h
Text conflict in sql/sql_db.cc
Text conflict in sql/sql_delete.cc
Text conflict in sql/sql_insert.cc
Text conflict in sql/sql_lex.cc
Text conflict in sql/sql_lex.h
Text conflict in sql/sql_load.cc
Text conflict in sql/sql_table.cc
Text conflict in sql/sql_update.cc
Text conflict in sql/sql_view.cc
Conflict adding files to storage/innobase.  Created directory.
Conflict because storage/innobase is not versioned, but has versioned children.  Versioned directory.
Conflict adding file storage/innobase.  Moved existing file to storage/innobase.moved.
Conflict adding files to storage/innobase/handler.  Created directory.
Conflict because storage/innobase/handler is not versioned, but has versioned children.  Versioned directory.
Contents conflict in storage/innobase/handler/ha_innodb.cc
2010-01-07 15:39:11 +00:00
Marc Alff
a4c3bc618b WL#2360 Performance schema
Part IV: sql instrumentation
2010-01-06 22:42:07 -07:00
Alexey Kopytov
24fc798fc7 Manual merge of mysql-5.1-bugteam into mysql-trunk-merge.
Conflicts:

mysql-test/collections/default.experimental
2009-12-25 13:56:50 +03:00
Sergei Golubchik
ae2768ce9c WL#4738 streamline/simplify @@variable creation process
Bug#16565 mysqld --help --verbose does not order variablesBug#20413 sql_slave_skip_counter is not shown in show variables
Bug#20415 Output of mysqld --help --verbose is incomplete
Bug#25430 variable not found in SELECT @@global.ft_max_word_len;
Bug#32902 plugin variables don't know their names
Bug#34599 MySQLD Option and Variable Reference need to be consistent in formatting!
Bug#34829 No default value for variable and setting default does not raise error
Bug#34834 ? Is accepted as a valid sql mode
Bug#34878 Few variables have default value according to documentation but error occurs  
Bug#34883 ft_boolean_syntax cant be assigned from user variable to global var.
Bug#37187 `INFORMATION_SCHEMA`.`GLOBAL_VARIABLES`: inconsistent status
Bug#40988 log_output_basic.test succeeded though syntactically false.
Bug#41010 enum-style command-line options are not honoured (maria.maria-recover fails)
Bug#42103 Setting key_buffer_size to a negative value may lead to very large allocations 
Bug#44691 Some plugins configured as MYSQL_PLUGIN_MANDATORY in can be disabled
Bug#44797 plugins w/o command-line options have no disabling option in --help
Bug#46314 string system variables don't support expressions
Bug#46470 sys_vars.max_binlog_cache_size_basic_32 is broken
Bug#46586 When using the plugin interface the type "set" for options caused a crash.
Bug#47212 Crash in DBUG_PRINT in mysqltest.cc when trying to print octal number
Bug#48758 mysqltest crashes on sys_vars.collation_server_basic in gcov builds
Bug#49417 some complaints about mysqld --help --verbose output
Bug#49540 DEFAULT value of binlog_format isn't the default value
Bug#49640 ambiguous option '--skip-skip-myisam' (double skip prefix)
Bug#49644 init_connect and \0
Bug#49645 init_slave and multi-byte characters
Bug#49646 mysql --show-warnings crashes when server dies
2009-12-22 10:35:56 +01:00
Konstantin Osipov
ef15a335b3 Backport of:
----------------------------------------------------------
revno: 2630.4.38
committer: Konstantin Osipov <konstantin@mysql.com>
branch nick: mysql-6.0-4144
timestamp: Wed 2008-06-25 22:07:06 +0400
message:
  WL#4144 - Lock MERGE engine children.
  Committing a version of the patch merged with WL#3726
  on behalf of Ingo.

  Step #1: Move locking from parent to children.

  MERGE children are now left in the query list of tables
  after inserted there in open_tables(). So they are locked
  by lock_tables() as all other tables are.

  The MERGE parent does not store locks any more. It appears
  in a MYSQL_LOCK with zero lock data. This is kind of a "dummy"
  lock.

  All other lock handling is also done directly on the children.
  To protect against parent or child modifications during LOCK
  TABLES, the children are detached after every statement and
  attached before every statement, even under LOCK TABLES.

  The children table list is removed from the query list of tables
  on every detach and on close of the parent.

  Step #2: Move MERGE specific functionality from SQL layer
  into table handler.

  Functionality moved from SQL layer (mainly sql_base.cc)
  to the table handler (ha_myisammrg.cc).

  Unnecessary code is removed from the SQL layer.

  Step #3: Moved all MERGE specific members from TABLE
  to ha_myisammrg.

  Moved members from TABLE to ha_myisammrg.
  Renamed some mebers.
  Fixed comments.

  Step #4: Valgrind and coverage testing

  Valgrind did not uncover new problems.
  Added purecov comments.

  Added a new test for DATA/INDEX DIRECTORY options.
  Changed handling of ::reset() for non-attached children.
  Fixed the merge-big test.

  Step #5: Fixed crashes detected during review
  Changed detection when to attach/detach.
  Added new tests.

Backport also the fix for Bug#44040 "MySQL allows creating a 
MERGE table upon VIEWs but crashes when using it"
2009-12-03 02:09:22 +03:00
Konstantin Osipov
511c68fbd4 Backport of:
-------------------------------------------------------------------
revno: 2630.6.6
committer: Konstantin Osipov <konstantin@mysql.com>
branch nick: mysql-6.0-3726
timestamp: Tue 2008-05-27 16:15:44 +0400
message:
Implement code review fixes for WL#3726 "DDL locking for all
metadata objects": cleanup the code from share->mutex
acquisitions, which are now obsolete.
2009-11-30 22:38:25 +03:00
Konstantin Osipov
4cff617c25 Backport of:
----------------------------------------------------------------------
ChangeSet@1.2571, 2008-04-08 12:30:06+02:00, vvaintroub@wva. +122 -0
  Bug#32082 : definition of VOID in my_global.h conflicts with Windows
  SDK headers
  
  VOID macro is now removed. Its usage is replaced with void cast.
  In some cases, where cast does not make much sense (pthread_*, printf, 
  hash_delete, my_seek), cast is ommited.
2009-11-24 16:54:59 +03:00
Davi Arnaut
ecb6228c62 Manual merge of mysql-next-mr-runtime upstream. 2009-11-19 21:48:08 -02:00
Mattias Jonsson
f86c438f7c Bug#48846: Too much time spent in ha_partition::records_in_range if not able to prune
Problem was that ha_partition::records_in_range called
records_in_range for all non pruned partitions, even if
an estimate should be given.

Solution is to only use 1/3 of the partitions (up to 10) for
records_in_range and estimate the total from this subset.
(And continue until a non zero return value from the called
partitions records_in_range is given, since 0 means no rows
will match.)
2009-11-17 20:02:16 +01:00
Davi Arnaut
a7bbc779ae Backport of Bug#15192 to mysql-next-mr
------------------------------------------------------------
revno: 2597.4.17
revision-id: sp1r-davi@mysql.com/endora.local-20080328174753-24337
parent: sp1r-anozdrin/alik@quad.opbmk-20080328140038-16479
committer: davi@mysql.com/endora.local
timestamp: Fri 2008-03-28 14:47:53 -0300
message:
  Bug#15192 "fatal errors" are caught by handlers in stored procedures

  The problem is that fatal errors (e.g.: out of memory) were being
  caught by stored procedure exception handlers which could cause
  the execution to not be stopped due to a continue handler.

  The solution is to not call any exception handler if the error is
  fatal and send the fatal error to the client.
2009-11-10 18:31:28 -02:00
Andrei Elkin
d09bded416 merging 5.1 main -> 5.1-rep+2 -> 5.1-rep+3; binlog_unsafe , rpl_mysql_upgrade fail and are under treatment 2009-11-10 20:45:15 +02:00
Mikael Ronstrom
fc863ba96f Merge 2009-11-03 12:37:02 +01:00
Mikael Ronstrom
d9e05040f4 Merged WL#3352 into mysql-next-mr 2009-10-28 18:22:36 +01:00
Alexander Nozdrin
069d78c067 Merge from mysql-next-mr. 2009-10-23 15:22:21 +04:00
Alexander Nozdrin
3fd2f50b6c Merge from mysql-trunk-merge. 2009-10-19 17:36:19 +04:00
Mattias Jonsson
49c446059c Manual merge mysql-trunk -> mysql-trunk-wl3352 2009-10-19 12:09:52 +02:00
Mikael Ronstrom
05d7593fe3 Fixed review comments 2009-10-16 17:08:34 +02:00
Magne Mahre
6b80cd916a Bug #37433 Deadlock between open_table, close_open_tables,
get_table_share, drop_open_table
            
In the partition handler code, LOCK_open and share->LOCK_ha_data
are acquired in the wrong order in certain cases.  When doing a
multi-row INSERT (i.e a INSERT..SELECT) in a table with auto-
increment column(s). the increments must be in a monotonically
continuous increasing sequence (i.e it can't have "holes"). To
achieve this, a lock is held for the duration of the operation.
share->LOCK_ha_data was used for this purpose.
            
Whenever there was a need to open a view _during_ the operation
(views are not currently pre-opened the way tables are), and
LOCK_open was grabbed, a deadlock could occur.  share->LOCK_ha_data
is other places used _while_ holding LOCK_open.
            
A new mutex was introduced in the HA_DATA_PARTITION structure,
for exclusive use of the autoincrement data fields, so we don't
need to overload the use of LOCK_ha_data here.
            
A module test case has not been supplied, since the problem occurs
as a result of a race condition, and testing for this condition 
is thus not deterministic.   Testing for it could be done by
setting up a test case as described in the bug report.
2009-10-15 13:07:04 +02:00
Alexander Nozdrin
ca08f10ccd Manual merge from mysql-trunk-merge. 2009-10-14 12:25:39 +04:00
Mattias Jonsson
cd73187378 merge into mysql-5.1-bugteam 2009-10-09 09:56:07 +02:00
Mattias Jonsson
27b80f9db8 Bug#44059: Incorrect cardinality of indexes on a partitioned table
backport for bug#44059 from mysql-pe to mysql-5.1-bugteam

Using the partition with most rows instead of first partition
to estimate the cardinality of indexes.
2009-10-08 15:58:17 +02:00
Mattias Jonsson
87a4644db8 Bug#46922: crash when adding partitions and open_files_limit
is reached

Problem was bad error handling, leaving some new temporary
partitions locked and initialized and some not yet initialized
and locked, leading to a crash when trying to unlock the not
yet initialized and locked partitions

Solution was to unlock the already locked partitions, and not
include any of the new temporary partitions in later unlocks
2009-10-08 15:36:43 +02:00
Mikael Ronstrom
1fe164a20e Changed all no_ to num_ to avoid strange names like no_list_values which is not expected to be number of list values, rather a boolea indicating no list values 2009-10-01 15:04:42 +02:00
Sven Sandberg
31193a632e merged fixes for BUG#39934 to 5.1-rpl+3
Also renamed current_stmt_binlog_row_based to
current_stmt_binlog_format_row for consistency
2009-09-30 18:00:22 +02:00
Mikael Ronstrom
70cb38ec82 Merge to mysql-next-mr 2009-09-28 09:39:50 +02:00
Staale Smedseng
8b9843408d Bug #43414 Parenthesis (and other) warnings compiling MySQL
with gcc 4.3.2

Cleaning up warnings not present in 5.0.
2009-09-23 15:21:29 +02:00
Anurag Shekhar
05bf2ebaa8 Bug #45840 read_buffer_size allocated for each partition when
"insert into.. select * from"

When inserting into a partitioned table using 'insert into
<target> select * from <src>', read_buffer_size bytes of memory
are allocated for each partition in the target table.

This resulted in large memory consumption when the number of
partitions are high.

This patch introduces a new method which tries to estimate the
buffer size required for each partition and limits the maximum
buffer size used to maximum of 10 * read_buffer_size, 
11 * read_buffer_size in case of monotonic partition functions.
2009-09-17 17:35:43 +05:30
Mattias Jonsson
3174c31dfc merge 2009-09-12 00:40:23 +02:00
Mikael Ronstrom
7158ae635b Automerge 2009-09-10 11:18:50 +02:00
Mikael Ronstrom
ff1df12a20 WL#4444 Added TRUNCATE partition support, fixes bug#19405 and bug #35111 2009-09-10 11:15:39 +02:00
Mikael Ronstrom
28eb7825ef WL#4571, Enable Key cache defined for a partition to enable more scalability on partitioned MyISAM tables among other things 2009-09-10 11:14:23 +02:00
Mikael Ronstrom
6a368130ae Automerge 2009-09-07 12:22:57 +02:00
Mikael Ronstrom
ea5d204370 Fix to ensure that all subpartitions gets deleted before renaming starts, BUG#47029 2009-09-07 10:37:54 +02:00
Mattias Jonsson
cc900f2c50 Bug#35845: unneccesary call to ha_start_bulk_insert for not used partitions
(Backport)

Problem is that when insert (ha_start_bulk_insert) in i partitioned table,
it will call ha_start_bulk_insert for every partition, used or not.

Solution is to delay the call to the partitions ha_start_bulk_insert until
the first row is to be inserted into that partition
2009-09-04 15:02:15 +02:00
V Narayanan
097023fee7 Bug#45823 Assertion failure in file row/row0mysql.c line 1386
Inserting a negative value in the autoincrement column of a
partitioned innodb table was causing the value of the auto
increment counter to wrap around into a very large positive
value. The consequences are the same as if a very large positive
value was inserted into a column, e.g. reduced autoincrement
range, failure to read autoincrement counter.

The current patch ensures that before calculating the next
auto increment value, the current value is within the positive
maximum allowed limit.
2009-09-04 09:27:11 +05:30
Mattias Jonsson
586ee5d616 Bug#46639: 1030 (HY000): Got error 124 from storage engine on
INSERT ... SELECT ...

Problem was that when bulk insert is used on an empty
table/partition, it disables the indexes for better
performance, but in this specific case it also tries
to read from that partition using an index, which is
not possible since it has been disabled.

Solution was to allow index reads on disabled indexes
if there are no records.

Also reverted the patch for bug#38005, since that was a workaround
in the partitioning engine instead of a fix in myisam.
2009-08-21 17:38:29 +02:00
Satya B
ad951044e0 Fix for BUG#45816 - assertion failure with index containing double
column on partitioned table
      
      
An assertion 'ASSERT_COULUMN_MARKED_FOR_READ' is failed if the query 
is executed with index containing double column on partitioned table.
The problem is that assertion expects all the fields which are read,
to be in the read_set.
      
In this query only the field 'a' is in the readset as the tables in
the query are joined by the field 'a' and so the assertion fails 
expecting other field 'b'.
      
Since the function cmp() is just comparison of two parameters passed, 
the assertion is not required.
      
Fixed by removing the assertion in the double fields comparision
function and also fixed the index initialization to do ordered
index scan with RW LOCK which ensures all the fields from a key are in
the read_set.
 

Note: this bug is not reproducible with other datatypes because the
      assertion doesn't exist in comparision function for other 
      datatypes.
2009-08-06 17:01:26 +05:30
Tatiana A. Nurnberg
b925e40fc0 auto-merge 2009-07-31 21:58:40 +02:00
Tatiana A. Nurnberg
f6b8b9d2f8 Bug#40281, partitioning the general log table crashes the server
We disallow the partitioning of a log table. You could however
partition a table first, and then point logging to it. This is
not only against the docs, it also crashes the server.

We catch this case now.
2009-07-31 14:38:18 +02:00
Anurag Shekhar
4e1ec3bb0b Bug#30102: Rename table does corrupt tables with partition files on failure
Problem was that a failing rename just left the partitions at the state
it was at the failure.

Solution was to try to revert the started rename if a failure occured.
2009-07-24 15:41:23 +05:30
Sven Sandberg
45f724ec54 Merged fix for BUG#39934 up a few revisions.
NOTE: This undoes changes by BUG#42829 in sql_class.cc:binlog_query().
I will revert the change in a post-push fix (the binlog filter should
be checked in sql_base.cc:decide_logging_format()).
2009-07-14 22:12:27 +02:00
Sven Sandberg
f3985c649d BUG#39934: Slave stops for engine that only support row-based logging
General overview:
The logic for switching to row format when binlog_format=MIXED had
numerous flaws. The underlying problem was the lack of a consistent
architecture.
General purpose of this changeset:
This changeset introduces an architecture for switching to row format
when binlog_format=MIXED. It enforces the architecture where it has
to. It leaves some bugs to be fixed later. It adds extensive tests to
verify that unsafe statements work as expected and that appropriate
errors are produced by problems with the selection of binlog format.
It was not practical to split this into smaller pieces of work.

Problem 1:
To determine the logging mode, the code has to take several parameters
into account (namely: (1) the value of binlog_format; (2) the
capabilities of the engines; (3) the type of the current statement:
normal, unsafe, or row injection). These parameters may conflict in
several ways, namely:
 - binlog_format=STATEMENT for a row injection
 - binlog_format=STATEMENT for an unsafe statement
 - binlog_format=STATEMENT for an engine only supporting row logging
 - binlog_format=ROW for an engine only supporting statement logging
 - statement is unsafe and engine does not support row logging
 - row injection in a table that does not support statement logging
 - statement modifies one table that does not support row logging and
   one that does not support statement logging
Several of these conflicts were not detected, or were detected with
an inappropriate error message. The problem of BUG#39934 was that no
appropriate error message was written for the case when an engine
only supporting row logging executed a row injection with
binlog_format=ROW. However, all above cases must be handled.
Fix 1:
Introduce new error codes (sql/share/errmsg.txt). Ensure that all
conditions are detected and handled in decide_logging_format()

Problem 2:
The binlog format shall be determined once per statement, in
decide_logging_format(). It shall not be changed before or after that.
Before decide_logging_format() is called, all information necessary to
determine the logging format must be available. This principle ensures
that all unsafe statements are handled in a consistent way.
However, this principle is not followed:
thd->set_current_stmt_binlog_row_based_if_mixed() is called in several
places, including from code executing UPDATE..LIMIT,
INSERT..SELECT..LIMIT, DELETE..LIMIT, INSERT DELAYED, and
SET @@binlog_format. After Problem 1 was fixed, that caused
inconsistencies where these unsafe statements would not print the
appropriate warnings or errors for some of the conflicts.
Fix 2:
Remove calls to THD::set_current_stmt_binlog_row_based_if_mixed() from
code executed after decide_logging_format(). Compensate by calling the
set_current_stmt_unsafe() at parse time. This way, all unsafe statements
are detected by decide_logging_format().

Problem 3:
INSERT DELAYED is not unsafe: it is logged in statement format even if
binlog_format=MIXED, and no warning is printed even if
binlog_format=STATEMENT. This is BUG#45825.
Fix 3:
Made INSERT DELAYED set itself to unsafe at parse time. This allows
decide_logging_format() to detect that a warning should be printed or
the binlog_format changed.

Problem 4:
LIMIT clause were not marked as unsafe when executed inside stored
functions/triggers/views/prepared statements. This is
BUG#45785.
Fix 4:
Make statements containing the LIMIT clause marked as unsafe at
parse time, instead of at execution time. This allows propagating
unsafe-ness to the view.
2009-07-14 21:31:19 +02:00
Satya B
77f7311673 Bug#35111 - Truncate a MyISAM partitioned table does not reset
the auto_increment value
      
This is an alternative patch that instead of allowing RECREATE TABLE
on TRUNCATE TABLE it implements reset_auto_increment that is called
after delete_all_rows.

Note: this bug was fixed by Mattias Jonsson:
Pusing this patch: http://lists.mysql.com/commits/70370
2009-07-08 17:41:34 +05:30
Mattias Jonsson
a316631af4 Backport of patch for bug#40003 from 6.0 to 5.1,
related to the backport of the patch for bug#38719
2009-02-20 16:56:32 +01:00
Mattias Jonsson
5b6829ac6e merge 2009-01-07 23:30:10 +01:00
Georgi Kodinov
8c25823f94 merged 5.1-main -> 5.1-bugteam 2009-01-05 18:10:20 +02:00
Mattias Jonsson
4effc0bc9a Bug#36312: InnoDB DATA_FREE BUG?
Problem is that DATA_FREE in SHOW TABLE STATUS
is not correct when not using innodb_file_per_table.

The solution is to use I_S.PARTITIONS instead.

This is only a small fix for correcting mean record length and
always return 0 if the table is empty.
2008-12-19 09:23:15 +01:00
Mattias Jonsson
bd2629b439 post push fix for bug#40595
Addition of hander function was_semi_consistent_read
2008-12-16 12:44:18 +01:00
Joerg Bruehe
c7d03ca35b Merge main 5.1 into 5.1-build 2008-12-10 21:14:50 +01:00
Mattias Jonsson
2405e47df0 Bug#40515: Query on a partitioned table does not return
'lock wait timeout exceeded'

Problem was a bug in the implementation of scan in partitioning
which masked the error code from the partition's handler.

Fixed by returning the value from the underlying handler.
2008-12-04 10:47:25 +01:00
timothy.smith@sun.com
abd8574914 Merge from mysql-5.1.30-release 2008-11-27 00:02:10 +01:00
Build Team
d2c4816716 mysql-test/r/partition.result
mysql-test/t/partition.test
sql/ha_partition.cc
  Bug#40954: Crash in MyISAM index code with concurrency test using partitioned tables
  Problem was usage of read_range_first with an empty key.
  Solution was to not to give a key if it was empty. (real author Mattias Jonsson)

storage/archive/archive_reader.c
client/mysqlslap.c
  Aligned the copyright texts output from "--version" of tools, to
  let internal tools be able to change them if needed.

storage/ndb/test/tools/connect.cpp
storage/ndb/test/run-test/atrt.hpp
  Corrected a few GPL headers not restricted to GPL version 2

Makefile.am
  Added missing --report-features to the 'test-bt-fast' target

support-files/mysql.spec.sh
  Reversed the removal of the "%define license GPL" in as internal
  tools depended on it
2008-11-25 03:04:58 +01:00
Mattias Jonsson
26a916ff36 Bug#40954: Crash in MyISAM index code with concurrency test using partitioned tables
Problem was usage of read_range_first with an empty key.

Solution was to not to give a key if it was empty.
2008-11-24 17:24:03 +01:00
Build Team
366adeab08 Added "Sun Microsystems, Inc." to copyright headers on files modified
since Oct 1st
2008-11-10 21:21:49 +01:00
Mattias Jonsson
a891c0e8f4 Bug#40595: Non-matching rows not released with READ-COMMITTED
on tables with partitions

Problem was that the handler function try_semi_consistent_read
was not propagated to the innodb handler.

Solution was to implement that function in the partitioning
handler.
2008-11-10 21:13:24 +01:00
Georgi Kodinov
e12b692e51 merged 5.1-bugteam -> merge-5.1-bugteam 2008-11-06 16:24:59 +02:00
Georgi Kodinov
90bc97a583 merged 5.1 main -> 5.1-bugteam 2008-11-06 16:18:25 +02:00
Mattias Jonsson
d0a5d0a9c3 post push fix, removing dbug_print due to compiler warning 2008-11-06 13:47:41 +01:00
Mattias Jonsson
bb727f0328 merge 2008-11-05 21:13:54 +01:00
Mattias Jonsson
f2f556cfc7 merge 2008-11-05 20:44:19 +01:00
Mattias Jonsson
b1cf4dcd3c Bug#40494: MYSQL server crashes on range access with partitioning and
order by

Problem was that the first index read was unordered,
and the next was ordered, resulting in use of
uninitialized data.

Solution was to use the correct variable to see if
the 'next' call should be ordered or not.
2008-11-05 15:53:28 +01:00
Mattias Jonsson
2c7d4e80a2 merge 2008-11-04 08:55:43 +01:00
Mattias Jonsson
cacf708fef post-push fix for build warnings 2008-10-30 09:25:25 +01:00
Mattias Jonsson
aebc974df9 merge 2008-10-29 23:01:41 +01:00
Mattias Jonsson
b52aa0a792 merge 2008-10-29 21:30:04 +01:00
Mattias Jonsson
cb6cb742f3 Bug#39084: Getting intermittent errors with statement-based binary logging
Problem was that partitioning cached the table flags.
These flags could change due to TRANSACTION LEVEL changes.
Solution was to remove the cache and always return the table flags
from the first partition (if the handler was initialized).
2008-10-29 21:20:04 +01:00
Mattias Jonsson
5e353415f8 Bug#40176: update as first partitioning statement
breaks auto increment

The auto_increment value was not initialized if
the first statement after opening a table was
an 'UPDATE'.

solution was to check initialize if it was not,
before trying to increase it in update.
2008-10-23 22:14:07 +02:00
Mattias Jonsson
f113311d4b Bug#39434: ALTER TABLE CHECK/OPTIMIZE/ANALYZE PARTITION work
on non-partitioned table

Problem was that partitioning specific commands was accepted
for non partitioned tables and treated like
ANALYZE/CHECK/OPTIMIZE/REPAIR TABLE, after bug-20129 was fixed,
which changed the code path from mysql_alter_table to
mysql_admin_table.

Solution was to check if the table was partitioned before
trying to execute the admin command
2008-10-10 20:12:38 +02:00
Mattias Jonsson
44630e09ee Bug#37721: ORDER BY when WHERE contains non-partitioned
index column

There was actually two problems
1) when clustered pk, order by non pk index should also
compare with pk as last resort to differ keys from each
other
2) bug in the index search handling in ha_partition (was
found when extending the test case

Solution to 1 was to include the pk in key compare if
clustered pk and search on other index.

Solution for 2 was to remove the optimization from
ordered scan to unordered scan if clustered pk.
2008-10-10 12:01:01 +02:00
Alexey Botchkov
acdaa9aef6 Bug#38005 Partitions: error with insert select.
MyISAM blocks index usage for bulk insert into zero-records tables.
See ha_myisam::start_bulk_insert() lines from
...
    if (file->state->records == 0 ...
...

That causes problems for partition engine when some partitions have records some not
as the engine uses same access method for all partitions.

Now partition engine doesn't call index_first/index_last
for empty tables.

per-file comments:
  mysql-test/r/partition.result
        Bug#38005 Partitions: error with insert select.
        test result

  mysql-test/t/partition.test
        Bug#38005 Partitions: error with insert select.
        test case

  sql/ha_partition.cc
        Bug#38005 Partitions: error with insert select.
        ha_engine::index_first and
        ha_engine::index_last not called for empty tables.
2008-10-06 18:14:20 +05:00
Mattias Jonsson
8f64bf94ad Bug#37453: Dropping/creating index on partitioned table with
InnoDB Plugin locks table

The fast/on-line add/drop index handler calls was not implemented
whithin the partitioning.

This implements it in the partitioning handler.

Since this is only used by the not included InnoDB plugin, there
is no test case. (Have tested it manually with the plugin, and
it does not allow unique indexes not including partitioning
function, or removal of pk, which in innodb generates a new pk,
which is not in the partitioning function.)

NOTE: This introduces a new handler method, and because of that
changes the storage engine api. (One cannot use a handlerton to
see the capabilities of a table's handler if it is partitioned.
So I added a wrapper function in the handler that defaults to
the handlerton function, which the partitioning handler overrides.
2008-10-05 00:40:30 +02:00
Mattias Jonsson
c2d55ee203 post push fix for bug#38804 (back port of bug#33479)
Removes the regression bug#38751.
2008-10-03 11:30:54 +02:00
Mattias Jonsson
91d6278c5e pre push fix for bug#38804 2008-10-01 12:40:05 +02:00
Mattias Jonsson
c51023d90b merge 2008-10-01 12:14:55 +02:00
Mattias Jonsson
0494d58527 Bug#30573: Ordered range scan over partitioned tables returns some rows twice
and
Bug#33555: Group By Query does not correctly aggregate partitions

Backport of bug-33257 which is the same bug.

read_range_*() calls was not passed to the partition handlers,
but was translated to index_read/next family calls.
Resulting in duplicates rows and wrong aggregations.
2008-09-18 22:49:34 +03:00
Mattias Jonsson
5b164964e2 Bug#38804: Query deadlock causes all tables to be inaccessible.
Problem was a mutex added in bug n 27405 for solving a problem
with auto_increment in partitioned innodb tables.
(in ha_partition::write_row over partitions file->ha_write_row)

Solution is to use the patch for bug#33479, which refines the
usage of mutexes for auto_increment.

Backport of bug-33479 from 6.0:

Bug-33479: auto_increment failures in partitioning

Several problems with auto_increment in partitioning
(with MyISAM, InnoDB. Locking issues, not handling
multi-row INSERTs properly etc.)

Changed the auto_increment handling for partitioning:
Added a ha_data variable in table_share for storage engine specific data
such as auto_increment value handling in partitioning, also see WL 4305
and using the ha_data->mutex to lock around read + update.

The idea is this:
Store the table's reserved auto_increment value in
the TABLE_SHARE and use a mutex to, lock it for reading and updating it
and unlocking it, in one block. Only accessing all partitions
when it is not initialized.
Also allow reservations of ranges, and if no one has done a reservation
afterwards, lower the reservation to what was actually used after
the statement is done (via release_auto_increment from WL 3146).
The lock is kept from the first reservation if it is statement based
replication and a multi-row INSERT statement where the number of
candidate rows to insert is not known in advance (like INSERT SELECT,
LOAD DATA, unlike INSERT VALUES (row1), (row2),,(rowN)).

This should also lead to better concurrancy (no need to have a mutex
protection around write_row in all cases)
and work with any local storage engine.
2008-09-08 15:30:01 +02:00
Mattias Jonsson
42fe1205a0 Backport of patch for Bug#34604 (from 6.0)
post push fix for bug#20129, test failed due to non existing
source files.
2008-08-20 17:29:14 +02:00
Mattias Jonsson
1833014b06 merge 2008-08-19 12:26:30 +02:00
Mattias Jonsson
63f983aceb Post push fix for valgrind warning in ha_partition.cc
Bug#35161
Fixed memory leak when failing to open a partition.

Bug#20129
Added tests for verifying REPAIR PARTITION.
2008-08-19 11:44:22 +02:00
Chad MILLER
224ce48a06 Bug#38272: timestamps fields incorrectly defaulted on \
update accross partitions.
      
It's not Innodb-specific bug.
ha_partition::update_row() didn't set
table->timestamp_field_type= TIMESTAMP_NO_AUTO_SET when
orig_timestamp_type == TIMESTAMP_AUTO_SET_ON_INSERT.

So that a partition sets the timestamp field when a record
is moved to a different partition.

Fixed by doing '= TIMESTAMP_NO_AUTO_SET' unconditionally.
Also ha_partition::write_row() is fixed in same way as now
Field_timestamp::set() is called twice in SET_ON_INSERT case.

(Chad queues this patch on demand by Trudy/Davi.)
2008-08-15 14:26:25 -04:00
Mattias Jonsson
08d9e1207d Bug#37402: Mysql cant read partitioned table with capital letter in the name
Post push fix (compiler warning)
2008-08-13 10:47:24 +02:00
Mattias Jonsson
f84bf0077d manual merge of bug#37402 2008-08-12 12:26:23 +02:00
Mattias Jonsson
1e73141b65 manual merge of Bug#20129 into 5.1-bugteam 2008-08-11 20:06:08 +02:00
Mattias Jonsson
07e9a6dc2a Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
partition is corrupt

The main problem was that ALTER TABLE t ANALYZE/CHECK/OPTIMIZE/REPAIR
PARTITION took another code path (over mysql_alter_table instead of
mysql_admin_table) which differs in two ways:
1) alter table opens the tables in a different way than admin tables do
   resulting in returning with error before it tried the command
2) alter table does not start to send any diagnostic rows to the client
   which the lower admin functions continue to use -> resulting in
   assertion crash

The fix:
Remapped ALTER TABLE t ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION to use
the same code path as ANALYZE/CHECK/OPTIMIZE/REPAIR TABLE t.
Adding check in mysql_admin_table to setup the partition list for
which partitions that should be used.


Partitioned tables will still not work with
REPAIR TABLE/PARTITION USE_FRM, since that requires moving partitions
to tables, REPAIR TABLE t USE_FRM, and check that the data still
fulfills the partitioning function and then move the table back to
being a partition.

NOTE: I have removed the following functions from the handler
interface:
analyze_partitions, check_partitions, optimize_partitions,
repair_partitions
Since they are not longer needed.
THIS ALTERS THE STORAGE ENGINE API
2008-08-11 20:02:03 +02:00
Mattias Jonsson
854e230707 merge into an updated 5.1-bugteam tree 2008-08-11 16:15:39 +02:00
Mattias Jonsson
295fc5834a Bug#37402: Mysql cant read partitioned table with capital letter in the name
Problem was that ha_partition had HA_FILE_BASED flag set
(since it uses a .par file), but after open it uses the first partitions
flags, which results in different case handling for create and for
open.

Solution was to change the underlying partition name so it was consistent.
(Only happens when lower_case_table_names = 2, i.e. Mac OS X and storage
engines without HA_FILE_BASED, like InnoDB and Memory.)

(Recommit after adding rename of check_lowercase_names to
get_canonical_filename, and moved it from handler.h to mysql_priv.h)

NOTE: if a mixed case name for a partitioned table was created when
lower_case_table_name = 2 it should be renamed or dropped before using
the updated version (See bug#37402 for more info)
2008-07-11 01:14:13 +02:00
Mattias Jonsson
c499df928c Bug#35745: SELECT COUNT(*) is not correct for some partitioned tables.
problem was that ha_partition::records was not implemented, thus
using the default handler::records, which is not correct if the engine
does not support HA_STATS_RECORDS_IS_EXACT.
Solution was to implement ha_partition::records as a wrapper around
the underlying partitions records.

The rows column in explain partitions will now include the total
number of records in the partitioned table.

(recommit after removing out-commented code)
2008-07-07 22:42:19 +02:00
Mattias Jonsson
da29c528d3 Bug#35161: --myisam-recover does not work for partitioned MyISAM tables
Problem was that auto_repair, is_crashed and check_and_repair was not
implemented in ha_partition.

Solution, implemented them as loop over all partitions for is_crashed and
check_and_repair, and using the first partition for auto_repair.

(Recommit after fixing review comments)
2008-07-07 17:54:42 +02:00
Mattias Jonsson
3345a71545 Bug#35931 Index search of partitioned MyISAM table
returns erroneous results

Used the wrong function when fixing 30480 which lead to
no stop on end_key resulting in duplicate results from index scan

Includes test cases for the duplicates 37327 and 37329,
Duplicate rows and bad performance/High Handler_read_next values

Recommit after merge issues
2008-06-17 12:41:06 +02:00
jani@a88-113-38-195.elisa-laajakaista.fi
090d1396cf Merge a88-113-38-195.elisa-laajakaista.fi:/home/my/bk/mysql-5.1-main
into  a88-113-38-195.elisa-laajakaista.fi:/home/my/bk/mysql-5.1-marvel
2008-03-28 12:14:27 +02:00
mattiasj@witty.
d918fa6ec9 Valgrind warnings found after bug#32943 and after merge from -main
into -engines tree.

hander::table_share was not updated after changing table->s.
2008-03-17 15:56:53 +01:00
mattiasj@witty.
eaac5d5f3a Pre push fixes
Test file fixes for bugs 20129, 31931 and 34225
2008-02-24 19:13:18 +01:00
mattiasj@client-10-129-10-147.upp.off.mysql.com
2335bfaa5b Bug#20129: ALTER TABLE ... ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION
Problem was that it did not work with corrupted/crashed tables.

Solution is to disable these commands until WL#4176 is completed
2008-02-11 11:32:46 +01:00
jani@a88-113-38-195.elisa-laajakaista.fi
4f98f3e683 Merge a88-113-38-195.elisa-laajakaista.fi:/home/my/bk/mysql-5.1-main
into  a88-113-38-195.elisa-laajakaista.fi:/home/my/bk/mysql-5.1-marvel
2008-02-08 12:13:33 +01:00
kostja@bodhi.(none)
dfe685e6fc A pre-requisite for the fix for Bug#12713 "Error in a stored function
called from a SELECT doesn't cause ROLLBACK of state"
Make private all class handler methods (PSEA API) that may modify
data. Introduce and deploy public ha_* wrappers for these methods in 
all sql/.
This necessary to keep track of all data modifications in sql/,
which is in turn necessary to be able to optimize two-phase
commit of those transactions that do not modify data.
2007-12-20 21:16:55 +03:00
kostja@bodhi.(none)
15c04b2db8 Make handler::{write,delete,update}_row private. It's critical
that the entire server uses their public ha_* counterparts instead,
since only then we can ensure proper tracing of these calls that
is necessary for Bug#12713.
A pre-requisite for Bug#12713 "Error in a stored function called from 
a SELECT doesn't cause ROLLBACK of statem"
2007-12-19 22:15:02 +03:00
anozdrin/alik@station.
151444c626 Merge station.:/mnt/raid/alik/MySQL/devel/5.1
into  station.:/mnt/raid/alik/MySQL/devel/5.1-rt
2007-12-14 16:30:22 +03:00
gluh@mysql.com/eagle.(none)
b371f6385d additional after merge fix 2007-12-13 21:34:05 +04:00
gluh@eagle.(none)
4f5868114a Merge mysql.com:/home/gluh/MySQL/Merge/5.1
into  mysql.com:/home/gluh/MySQL/Merge/5.1-opt
2007-12-13 15:56:04 +04:00
anozdrin/alik@station.
93eef1ce40 Merge station.:/mnt/raid/alik/MySQL/devel/5.1
into  station.:/mnt/raid/alik/MySQL/devel/5.1-rt
2007-12-13 12:06:37 +03:00
kostja@bodhi.(none)
ebb9c5d983 Bug#12713 "Error in a stored function called from a SELECT doesn't
cause ROLLBACK of statement", part 1. Review fixes.

Do not send OK/EOF packets to the client until we reached the end of 
the current statement.
This is a consolidation, to keep the functionality that is shared by all 
SQL statements in one place in the server.
Currently this functionality includes:
- close_thread_tables()
- log_slow_statement().

After this patch and the subsequent patch for Bug#12713, it shall also include:
- ha_autocommit_or_rollback()
- net_end_statement()
- query_cache_end_of_result().

In future it may also include:
- mysql_reset_thd_for_next_command().
2007-12-12 18:21:01 +03:00
holyfoot/hf@hfmain.(none)
18e6de9f15 Merge mysql.com:/home/hf/work/32247/my51-32247
into  mysql.com:/home/hf/work/mrg/my51-mrg
2007-12-06 16:43:52 +04:00
holyfoot/hf@mysql.com/hfmain.(none)
dc01dba255 Bug #32247 Test reports wrong value of "AUTO_INCREMENT" (on a partitioned InnoDB table).
ha_partition::update_create_info() just calls update_create_info
of a first partition, so only get the autoincrement maximum
of the first partition, so SHOW CREATE TABLE can show
small AUTO_INCREMENT parameters.
Fixed by implementing ha_partition::update_create_info() in a way
other handlers work.
HA_ARCHIVE:stats.auto_increment handling made consistent with other engines
2007-12-06 16:39:42 +04:00
mattiasj@witty.
5452a154d6 Merge witty.:/Users/mattiasj/clones/mysql-5.1-bug30822
into  witty.:/Users/mattiasj/clones/51to_push
2007-12-05 19:39:32 +01:00
mattiasj@witty.
1d7ac77479 Bug#30480: Falcon: searches fail if LIKE and key partition
(also fixes the bugs: Bug#29320, Bug#29493 and Bug#30536)

Problem: Partitioning did not handle unordered scans correctly
for engines with unordered read order.

Solution: do not stop scanning fi a recored is out of range, since
there can be more records within the range afterwards.

Note: this is the patch that fixes the bug, but since there are no
storage engines shipped with mysql 5.1 (falcon comes in 6.0) there
are no test cases (it is a separate patch that only goes into 6.0)
2007-12-03 16:12:25 +01:00
sergefp@mysql.com
7d6d808b6a BUG#32772: partition crash 1: enum column
The bug was that for ordered index scans, ha_partition::index_init() did
not put index columns into table->read_set if the underlying storage 
engine did not have HA_PARTIAL_COLUMN_READ flag. 
This was causing assertion failure when handle_ordered_index_scan() tried
to sort the records according to index order.

Fixed by making ha_partition::index_init() put index columns into table->read_set
for all ordered scans.
2007-11-28 03:02:05 +03:00
jani@hynda.mysql.fi
2e034c1e3b Merge hynda.mysql.fi:/home/my/mysql-5.1-main
into  hynda.mysql.fi:/home/my/mysql-5.1-marvel
2007-11-26 11:27:01 +02:00
mattiasj@mattias-jonssons-macbook.local
eac847f39b Bug#30822: ALTER TABLE COALESCE PARTITION causes segmentation fault
Problem was for LINEAR HASH/KEY. Crashes because of wrong partition id
returned when creating the new altered partitions. (because of wrong
linear hash mask)

Solution: Update the linear hash mask before using it for the new
altered table.
2007-11-20 11:21:00 +01:00
sergefp@mysql.com
f3cd35b9f8 BUG#30573: Ordered range scan over partitioned tables returns some rows twice
The problem: ha_partition::read_range_first() could return a record that is 
outside of the scanned range. If that record happened to be in the next 
subsequent range, it would satisfy the WHERE and appear in the output twice.
(we would get it the second time when scanning the next subsequent range)

Fix: 
Made ha_partition::read_range_first() check if the returned recod is within
the scanned range, like other read_range_first() implementations do.
2007-11-20 05:02:49 +03:00
jani@hynda.mysql.fi
88bcde7661 Merge hynda.mysql.fi:/home/my/mysql-5.1-main
into  hynda.mysql.fi:/home/my/mysql-5.1-marvel
2007-11-14 16:32:03 +02:00
gluh@eagle.(none)
58336411c9 Merge mysql.com:/home/gluh/MySQL/Merge/5.1
into  mysql.com:/home/gluh/MySQL/Merge/5.1-opt
2007-11-14 17:30:16 +04:00
holyfoot/hf@mysql.com/hfmain.(none)
8085bed591 Bug #32067 Partitions: crash with timestamp column.
Partition handler fails updating tables with partitioning
based on timestamp field, as it calculates the timestamp field
AFTER it calculates the number of partition of a record.

Fixed by adding timestamp_field->set_time() call and disabling
such consequent calls
2007-11-12 21:11:31 +04:00
mattiasj@mattiasj-laptop.(none)
6776cc19a0 Bug#32091: Security breach via directory changes
Problem: the table's INDEX and DATA DIR was taken
  directly from the table's first partition.
  This allowed rename attack similar to
  bug#32111 when ALTER TABLE REMOVE PARTITIONING

Solution: Silently ignore the INDEX/DATA DIR
  for the table. (Like some other storage engines
  do). 
  Partitioned tables do not support DATA/INDEX
  DIR on the table level, only on its partitions.
2007-11-09 23:22:00 +01:00
jani@hynda.mysql.fi
e8d8102a93 Merge hynda.mysql.fi:/home/my/mysql-5.1-main
into  hynda.mysql.fi:/home/my/mysql-5.1-marvel
2007-11-08 13:23:08 +02:00
istruewing@stella.local
8b1679d769 Merge stella.local:/home2/mydev/mysql-5.1-amain
into  stella.local:/home2/mydev/mysql-5.1-axmrg
2007-10-31 13:13:20 +01:00
gluh@eagle.(none)
17acda6ca8 Merge mysql.com:/home/gluh/MySQL/Merge/5.1
into  mysql.com:/home/gluh/MySQL/Merge/5.1-opt
2007-10-23 19:08:21 +05:00
mattiasj@mattiasj-laptop.(none)
7c16fd2c0f Bug #30878: Crashing when alter an auto_increment non partitioned
table to partitioned

Problem:
Crashed because usage of an uninitialised mutex when auto_incrementing
  a partitioned temporary table

Fix:
Only locking (using the mutex) if not temporary table.
2007-10-17 20:40:23 +02:00
monty@mysql.com/narttu.mysql.fi
7887babe69 Moved a lot of old bug fixes and safe cleanups from Maria 5.1 tree to 5.1
- Reserver namespace and place in frm for TABLE_CHECKSUM and PAGE_CHECKSUM create options
- Added syncing of directory when creating .frm files
- Portability fixes
- Added missing cast that could cause bugs
- Code cleanups
- Made some bit functions inline
- Moved things out of myisam.h to my_handler.h to make them more accessable
- Renamed some myisam variables and defines to make them more globaly usable (as they are used outside of MyISAM)
- Fixed bugs in error conditions
- Use compiler time asserts instead of run time
- Fixed indentation
HA_EXTRA_PREPARE_FOR_DELETE -> HA_EXTRA_PREPARE_FOR_DROP as the old name was wrong
(Added a define for old value to ensure we don't break any old code)
Added HA_EXTRA_PREPARE_FOR_RENAME as a signal for rename (before we used a DROP signal which is wrong)
- Initialize error messages early to get better errors when mysqld or an engine fails to start
- Fix windows bug that query_performance_frequency was not initialized if registry code failed
- thread_stack -> my_thread_stack_size
2007-10-11 18:07:40 +03:00
istruewing@stella.local
0ab9d3718d Merge stella.local:/home2/mydev/mysql-5.1-amain
into  stella.local:/home2/mydev/mysql-5.1-axmrg
2007-10-10 21:25:19 +02:00
gluh@eagle.(none)
27762854ef Merge mysql.com:/home/gluh/MySQL/Merge/5.1
into  mysql.com:/home/gluh/MySQL/Merge/5.1-opt
2007-10-10 14:33:46 +05:00
holyfoot/hf@hfmain.(none)
e19efc0a6e Merge bk@192.168.21.1:mysql-5.1-opt
into  mysql.com:/home/hf/work/26527/my51-26527
2007-10-05 14:21:59 +05:00