Commit graph

677 commits

Author SHA1 Message Date
Sergey Petrunya
7f059782d0 Merge MWL#121-124 DS-MRR support for key-ordered reads + MWL#128 BNL-Hash join 2010-11-01 20:43:02 +03:00
Sergey Petrunya
6c15806b68 MWL#121-124 DS-MRR support for key-ordered retrieval, etc
- Merge into 5.3-main
2010-11-01 18:49:59 +03:00
Igor Babaev
0b72fd88a1 Merge. 2010-10-30 06:07:45 -07:00
Sergei Golubchik
8e7ebfbce8 5.2 merge 2010-10-28 19:04:23 +02:00
Igor Babaev
4f75a8254a Merge 5.3-mwl128 -> 5.3 2010-10-27 16:31:22 -07:00
Sergey Petrunya
d8efc3b155 DS-MRR improvements: address review feedback for R3 version of the patch 2010-10-26 15:35:13 +04:00
Sergei Golubchik
04a4b43346 merge with 5.1 2010-10-25 15:21:16 +02:00
Sergei Golubchik
60c15066db better fix for MySQL bugs
BUG#26447 prefer a clustered key for an index scan, as secondary index is always slower
  ... which was fixed to cause
BUG#35850 queries take 50% longer
  ... and was reverted

and

BUG#39653 prefer a secondary index for an index scan, as clustered key is always slower
  ... which was fixed to cause
BUG#55656 mysqldump takes six days instead of half an hour
  ... and was amended with a special case workaround


sql/opt_range.cc:
  move get_index_only_read_time() into the handler class
sql/sql_select.cc:
  use cost not an index length when choosing a cheaper index
2010-10-20 12:58:43 +02:00
Sergey Petrunya
72dd7575cd Merge 5.2->5.3
- Re-commit Monty's merge, partially fixed by Igor and SergeyP, 
  but still broken
2010-10-10 17:18:11 +03:00
Sergey Petrunya
4f56acb676 Better comments, move Lifo_buffer to separate file. 2010-09-28 12:19:50 +04:00
Sergei Golubchik
a3d80d952d merge with 5.1 2010-09-11 20:43:48 +02:00
Sergey Petrunya
dbc63bed22 MWL#121-125: DS-MRR improvements
- Address review feedback, step 1
2010-09-05 14:32:14 +04:00
Igor Babaev
94cfcbd9df The main patch for MWL#128: Implement Block Nested Loop Hash Join. 2010-08-31 09:34:21 -07:00
Michael Widenius
ad6d95d3cb Merge with MySQL 5.1.50
- Changed to still use bcmp() in certain cases becasue
  - Faster for short unaligneed strings than memcmp()
  - Bettern when using valgrind
- Changed to use my_sprintf() instead of sprintf() to get higher portability for old systems
- Changed code to use MariaDB version of select->skip_record()
- Removed -%::SCCS/s.% from Makefile.am:s to remove automake warnings
2010-08-27 17:12:44 +03:00
Michael Widenius
569c37163e Merge with MariaDB 5.1 2010-08-06 15:51:07 +03:00
Michael Widenius
50b43cf805 Fix for LP#614265 Crash in _ma_unpin_all_pages / _ma_search on DELETE with Aria search engine
Fixed compiler warnings

client/mysqlslap.c:
  Fixed compiler warnings
mysql-test/suite/maria/r/maria.result:
  Test case for LP#614265
mysql-test/suite/maria/t/maria.test:
  Test case for LP#614265
mysql-test/suite/pbxt/t/skip_name_resolve-master.opt:
  Ensure that we get restart before test (as test uses show processlist)
sql/handler.cc:
  Added cloned marker if clone was called (for safety checks & debugging)
sql/handler.h:
  Added cloned marker if clone was called (for safety checks & debugging)
storage/maria/ha_maria.cc:
  In clone call, set file->trn if cloned file had this set. This is needed as maria_create_trn_for_mysql() and thus file->trn is never set for cloned table.
  Ensure that file->trn is properly reset after calls to repair/check/zerofill.
  Increment locked table count if file->trn is set (as we decrement this in the unlock call)
tests/mysql_client_test.c:
  Fixed compiler warnings
2010-08-06 15:39:37 +03:00
Michael Widenius
d042146e5b Merge with MariaDB 5.1.49
Removed references to HA_END_SPACE_KEY (which has been 0 for a long time)
2010-08-05 22:56:11 +03:00
Michael Widenius
e0a6b02c5d Merge with MySQL 5.1.49
Fixed Bug#52005 'JOIN_TAB->dependent' may be incorrectly propageted for multilevel outer joins' in a better way (patch from Sergey Petrunya)
2010-08-02 12:01:24 +03:00
Sergei Golubchik
68f02c65ef merge with 5.1 2010-07-25 17:09:21 +02:00
Sergei Golubchik
069a068c90 restore the unintentinally broken ABI 2010-07-23 22:37:21 +02:00
Sergey Petrunya
e0999cdf7c DS-MRR support improvements (MWL#123, MWL#124, MWL#125)
- Lots of TODO comments
- add mrr_sort_keys flag to @@optimizer_switch
- [from Igor] SQL layer part passes HA_MRR_MATERIALIZED_KEYS flag
- Don't call rnd_pos() many times in a row if sorted rowid buffer
  has the same rowid value for multiple consequive (rowid, range_id) pairs.
2010-07-17 18:03:50 +04:00
Michael Widenius
e9166ca152 Fix for LP#588251: doStartTableScan() result not checked.
The issue was that we didn't always check result of ha_rnd_init() which caused a problem for handlers that returned an error in this code.
- Changed prototype of ha_rnd_init() to ensure that we get a compile warning if result is not checked.
- Added ha_rnd_init_with_error() that prints error on failure.
- Checked all usage of ha_rnd_init() and ensure we generate an error message on failures.
- Changed init_read_record() to return 1 on failure.




sql/create_options.cc:
  Fixed wrong printf
sql/event_db_repository.cc:
  Check result from init_read_record()
sql/events.cc:
  Check result from init_read_record()
sql/filesort.cc:
  Check result from ha_rnd_init()
sql/ha_partition.cc:
  Check result from ha_rnd_init()
sql/ha_partition.h:
  Fixed compiler warning
sql/handler.cc:
  Added ha_rnd_init_with_error()
  Check result from ha_rnd_init()
sql/handler.h:
  Added ha_rnd_init_with_error()
  Changed prototype of ha_rnd_init() to ensure that we get a compile warning if result is not checked
sql/item_subselect.cc:
  Check result from ha_rnd_init()
sql/log.cc:
  Check result from ha_rnd_init()
sql/log_event.cc:
  Check result from ha_rnd_init()
sql/log_event_old.cc:
  Check result from ha_rnd_init()
sql/mysql_priv.h:
  init_read_record() now returns error code on failure
sql/opt_range.cc:
  Check result from ha_rnd_init()
sql/records.cc:
  init_read_record() now returns error code on failure
  Check result from ha_rnd_init()
sql/sql_acl.cc:
  Check result from init_read_record()
sql/sql_cursor.cc:
  Print error if ha_rnd_init() fails
sql/sql_delete.cc:
  Check result from init_read_record()
sql/sql_help.cc:
  Check result from init_read_record()
sql/sql_plugin.cc:
  Check result from init_read_record()
sql/sql_select.cc:
  Check result from ha_rnd_init()
  Print error if ha_rnd_init() fails.
sql/sql_servers.cc:
  Check result from init_read_record()
sql/sql_table.cc:
  Check result from init_read_record()
sql/sql_udf.cc:
  Check result from init_read_record()
sql/sql_update.cc:
  Check result from init_read_record()
storage/example/ha_example.cc:
  Don't return error on rnd_init()
storage/ibmdb2i/ha_ibmdb2i.cc:
  Removed not relevant comment
2010-07-17 01:41:44 +03:00
Sergey Petrunya
e1006e9e1f MWL#121: DS-MRR support for clustered primary keys
- Merge with current 5.3
2010-07-16 13:38:23 +04:00
Sergey Petrunya
27f9fc063c MariaDB 5.2 -> MariaDB 5.3 merge 2010-06-26 14:05:41 +04:00
Mattias Jonsson
52d5941bf1 merge 2010-07-09 15:00:33 +02:00
Mattias Jonsson
70b02d3aed Bug#52517: Regression in ROW level replication performance with partitions
In bug-28430 HA_PRIMARY_KEY_REQUIRED_FOR_POSITION
was disabled in the partitioning engine in the first patch,
That bug was later fixed a second time, but that flag
was not removed.

No need to disable this flag, as it leads to bad
choise in row replication.

sql/ha_partition.h:
  Not disabling HA_PRIMARY_KEY_REQUIRED_FOR_POSITION flag.
  Updated comment (has nothing to do with hidden key.
sql/handler.h:
  Updated comments to about HA_PRIMARY_KEY_REQUIRED_FOR_POSITION.
2010-07-09 13:15:26 +02:00
Sergey Petrunya
488d352a66 MWL#121: DS-MRR support for clustered primary keys
- Remove back key_parts from multi_range_read_init() parameters
- Related code simplification/cleanup
2010-06-22 23:26:11 +04:00
Sergey Petrunya
925e508a2e MWL#121: DS-MRR support for clustered primary keys
- First code (will need code cleanup)
2010-06-19 15:40:19 +04:00
Davi Arnaut
0f9ddfa9d8 Bug#42733: Type-punning warnings when compiling MySQL --
strict aliasing violations.

One somewhat major source of strict-aliasing violations and
related warnings is the SQL_LIST structure. For example,
consider its member function `link_in_list` which takes
a pointer to pointer of type T (any type) as a pointer to
pointer to unsigned char. Dereferencing this pointer, which
is done to reset the next field, violates strict-aliasing
rules and might cause problems for surrounding code that
uses the next field of the object being added to the list.

The solution is to use templates to parametrize the SQL_LIST
structure in order to deference the pointers with compatible
types. As a side bonus, it becomes possible to remove quite
a few casts related to acessing data members of SQL_LIST.

sql/handler.h:
  Use the appropriate template type argument.
sql/item.cc:
  Remove now-unnecessary cast.
sql/item_subselect.cc:
  Remove now-unnecessary casts.
sql/item_sum.cc:
  Use the appropriate template type argument.
  Remove now-unnecessary cast.
sql/mysql_priv.h:
  Move SQL_LIST structure to sql_list.h
  Use the appropriate template type argument.
sql/sp.cc:
  Remove now-unnecessary casts.
sql/sql_delete.cc:
  Use the appropriate template type argument.
  Remove now-unnecessary casts.
sql/sql_derived.cc:
  Remove now-unnecessary casts.
sql/sql_lex.cc:
  Remove now-unnecessary casts.
sql/sql_lex.h:
  SQL_LIST now takes a template type argument which must
  match the type of the elements of the list. Use forward
  declaration when the type is not available, it is used
  in pointers anyway.
sql/sql_list.h:
  Rename SQL_LIST to SQL_I_List. The template parameter is
  the type of object that is stored in the list.
sql/sql_olap.cc:
  Remove now-unnecessary casts.
sql/sql_parse.cc:
  Remove now-unnecessary casts.
sql/sql_prepare.cc:
  Remove now-unnecessary casts.
sql/sql_select.cc:
  Remove now-unnecessary casts.
sql/sql_show.cc:
  Remove now-unnecessary casts.
sql/sql_table.cc:
  Remove now-unnecessary casts.
sql/sql_trigger.cc:
  Remove now-unnecessary casts.
sql/sql_union.cc:
  Remove now-unnecessary casts.
sql/sql_update.cc:
  Remove now-unnecessary casts.
sql/sql_view.cc:
  Remove now-unnecessary casts.
sql/sql_yacc.yy:
  Remove now-unnecessary casts.
storage/myisammrg/ha_myisammrg.cc:
  Remove now-unnecessary casts.
2010-06-10 17:45:22 -03:00
Sergei Golubchik
ac6b3c4430 few small MySQL bugs/issues that impact the engines, as discussed in the SE summit
* remove handler::index_read_last()
* create handler::keyread_read_time() (was get_index_only_read_time() in opt_range.cc)
* ha_show_status() allows engine's show_status() to fail
* remove HTON_FLUSH_AFTER_RENAME
* fix key_cmp_if_same() to work for floats and doubles
* set table->status in the server, don't force engines to do it
* increment status vars in the server, don't force engines to do it

mysql-test/r/status_user.result:
  correct test results - innodb was wrongly counting internal
  index searches as handler_read_* calls.
sql/ha_partition.cc:
  compensate for handler incrementing status counters -
  we want to count only calls to underlying engines
sql/handler.h:
  inline methods moved to sql_class.h
sql/key.cc:
  simplify the check
sql/opt_range.cc:
  move get_index_only_read_time to the handler class
sql/sp.cc:
  don't use a key that's stored in the record buffer -
  the engine can overwrite the buffer with anything, destroying the key
sql/sql_class.h:
  inline handler methods that need to see THD and TABLE definitions
sql/sql_select.cc:
  no ha_index_read_last_map anymore
sql/sql_table.cc:
  remove HTON_FLUSH_AFTER_RENAME
sql/table.cc:
  set HA_CAN_MEMCMP as appropriate
sql/tztime.cc:
  don't use a key that's stored in the record buffer -
  the engine can overwrite the buffer with anything, destroying the key
storage/myisam/ha_myisam.cc:
  engines don't need to update table->status or use ha_statistic_increment anymore
storage/myisam/ha_myisam.h:
  index_read_last_map is no more
2010-06-05 16:53:36 +02:00
Sergei Golubchik
ffc8f62b08 merge 5.1->5.2 2010-06-01 21:52:20 +02:00
Michael Widenius
4aa9d903c1 Merge with MySQL 5.1.47
Fixed some bugs introduced in 5.1.47
Disabled some tests until we have merged with latest Xtradb

configure.in:
  Added testing if valgrind/memcheck.h exists
storage/pbxt/src/ha_pbxt.cc:
  LOCK_plugin is not anymore locked in init
2010-05-26 21:55:40 +03:00
Sergei Golubchik
a3e8ae1280 A temporary solution to make CREATE TABLE attributes
to work when a table is partitioned
2010-05-11 16:49:23 +02:00
Sergei Golubchik
b58cb7c4a2 small changes to WL#43:
consistency: don't use "index" and "key" interchangeably
  => rename "key" to "index"
  consistency: all option types are logical, besides ULL
  => rename ULL to NUMBER
  don't accept floats where integers are expected
  accept hexadecimal where integers are expected
2010-04-30 12:12:25 +02:00
Sergei Golubchik
e24e1668bc MWL#43 CREATE TABLE options (by Sanja)
Docs/sp-imp-spec.txt:
  New sql_mode added.
include/my_base.h:
  Flag in frm of create options.
libmysqld/CMakeLists.txt:
  New files added.
libmysqld/Makefile.am:
  New files added.
mysql-test/r/events_bugs.result:
  New sql_mode added.
mysql-test/r/information_schema.result:
  New sql_mode added.
mysql-test/r/sp.result:
  New sql_mode added.
mysql-test/r/system_mysql_db.result:
  New sql_mode added.
mysql-test/suite/funcs_1/r/is_columns_mysql.result:
  New sql_mode added.
mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result:
  New sql_mode added.
mysql-test/t/events_bugs.test:
  New sql_mode added.
mysql-test/t/sp.test:
  New sql_mode added.
scripts/mysql_system_tables.sql:
  New sql_mode added.
scripts/mysql_system_tables_fix.sql:
  New sql_mode added.
sql/CMakeLists.txt:
  New files added.
sql/Makefile.am:
  New files added.
sql/event_db_repository.cc:
  New sql_mode added.
sql/field.cc:
  Create options support added.
sql/field.h:
  Create options support added.
sql/ha_partition.cc:
  Create options support added.
sql/handler.cc:
  Create options support added.
sql/handler.h:
  Create options support added.
sql/log_event.h:
  New sql_mode added.
sql/mysql_priv.h:
  New sql_mode added.
sql/mysqld.cc:
  New sql_mode added.
sql/share/errmsg.txt:
  New error messages added.
sql/sp.cc:
  New sql_mode added.
sql/sp_head.cc:
  Create options support added.
sql/sql_class.cc:
  Create options support added.
  Debug added.
sql/sql_class.h:
  Create options support added.
sql/sql_insert.cc:
  my_safe_a* moved to mysqld_priv.h
sql/sql_lex.h:
  Create options support added.
sql/sql_parse.cc:
  Create options support added.
sql/sql_show.cc:
  Create options support added.
sql/sql_table.cc:
  Create options support added.
sql/sql_view.cc:
  New sql_mode added.
sql/sql_yacc.yy:
  Create options support added.
sql/structs.h:
  Create options support added.
sql/table.cc:
  Create options support added.
sql/table.h:
  Create options support added.
sql/unireg.cc:
  Create options support added.
storage/example/ha_example.cc:
  Create options example.
storage/example/ha_example.h:
  Create options example.
storage/pbxt/src/discover_xt.cc:
  Create options support added.
2010-04-08 14:10:05 +02:00
Sergey Vojtovich
4aa36ee7b6 BUG#39053 - UNISTALL PLUGIN does not allow the storage engine
to cleanup open connections

It was possible to UNINSTALL storage engine plugin when binding
between THD object and storage engine is still active (e.g. in
the middle of transaction).

To avoid unclean deactivation (uninstall) of storage engine plugin
in the middle of transaction, additional storage engine plugin
lock is acquired by thd_set_ha_data().

If ha_data is not null and storage engine plugin was not locked
by thd_set_ha_data() in this connection before, storage engine
plugin gets locked.

If ha_data is null and storage engine plugin was locked by
thd_set_ha_data() in this connection before, storage engine
plugin lock gets released.

If handlerton::close_connection() didn't reset ha_data, server does
it immediately after calling handlerton::close_connection().

Note that this is just a framework fix, storage engines must switch
to thd_set_ha_data() from thd_ha_data() if they want to see fit.

include/mysql/plugin.h:
  As thd_{get|set}_ha_data() have some extra logic now, they
  must be implemented on server side.
include/mysql/plugin.h.pp:
  As thd_{get|set}_ha_data() have some extra logic now, they
  must be implemented on server side.
sql/handler.cc:
  Make sure ha_data is reset and ha_data lock is released.
sql/handler.h:
  hton is not supposed to be updated by ha_lock_engine(),
  make it const.
sql/sql_class.cc:
  As thd_{get|set}_ha_data() have some extra logic now, they
  must be implemented on server side.
sql/sql_class.h:
  Added ha_data lock.
2010-04-14 13:53:59 +04:00
Igor Babaev
1a507f4ffd Merge with the latest changes in the 5.2 tree. 2010-03-29 14:16:12 -07:00
Michael Widenius
2c77c9ea25 simple speed & space optimization:
- Avoid full inline of mark_trx_read_write() for many functions
- Avoid somewhat expensive tests for every write/update/delete row 

sql/handler.h:
  Adde ha_start_of_new_statement() to reset internal variables as part of the code in "open_table" that resets TABLE object for the new statement
  Faster mark_trx_read_write_part()
sql/sql_base.cc:
  Don't manipulate table->file internal structs directly
2010-03-25 15:33:39 +02:00
Sergey Petrunya
7df026676b Merge MariaDB-5.2 -> MariaDB 5.3 2010-03-20 15:01:47 +03:00
Igor Babaev
7e4d89c973 WL#86: Partitioned key cache for MyISAM.
This is the base patch for the task.
2010-02-16 08:41:11 -08:00
unknown
e5099a2c85 merge 5.1->5.2 2010-02-01 08:14:12 +02:00
Sergey Petrunya
b83cb52e9e Backport of subquery optimizations to 5.3.
There are still test failures because of:
- Wrong query results in outer join + semi join
- EXPLAIN output differences
2010-01-17 17:51:10 +03:00
Michael Widenius
d121e66305 Fix for compiler warnings on windows
Fix wrong cast of time()

include/my_pthread.h:
  Safety fix that also removes compiler warnings
sql/handler.h:
  Changed timestamp columns to be of type time_t
storage/maria/ma_check.c:
  Removed wrong cast
storage/maria/ma_create.c:
  Removed wrong cast
storage/myisam/mi_check.c:
  Removed wrong cast
storage/myisam/mi_create.c:
  Removed wrong cast
storage/xtradb/handler/ha_innodb.cc:
  Removed compiler warning on windows
2010-01-14 18:51:00 +02:00
unknown
1249c8d0d5 Add DB_TYPE_AUTOASSIGN as a better name for DB_TYPE_UNKNOWN, which is what plugins should generally use. 2010-01-04 14:12:53 +01:00
Sergey Petrunya
da5edf5057 MWL#67: MRR backport
- Make index condition pushdown be controlled by an @@optimizer_switch flag,
  not by @@engine_condition_pushdown
- Make MRR buffer size be controlled by @@mrr_buffer_size, not 
  by @@read_rnd_buffer_size
- Move parts of code to separate files
- Code cleanup
- Add --sorted_result to some SELECTs in tests.
2009-12-22 15:33:21 +03:00
Sergey Petrunya
59b6472010 Backport into MariaDB-5.2 the following:
WL#2474 "Multi Range Read: Change the default MRR implementation to implement new MRR interface"
WL#2475 "Batched range read functions for MyISAM/InnoDb"
        "Index condition pushdown for MyISAM/InnoDB"
- Adjust test results (checked)
- Code cleanup.
2009-12-15 20:23:55 +03:00
Sergey Petrunya
2a496c4dcf Backport into MariaDB-5.2 the following:
WL#2474 "Multi Range Read: Change the default MRR implementation to implement new MRR interface"
WL#2475 "Batched range read functions for MyISAM/InnoDb"
        "Index condition pushdown for MyISAM/InnoDB"
- Fix valgrind failures
2009-12-15 17:53:30 +03:00
Sergey Petrunya
96e092dc73 Backport into MariaDB-5.2 the following:
WL#2474 "Multi Range Read: Change the default MRR implementation to implement new MRR interface"
WL#2475 "Batched range read functions for MyISAM/InnoDb"
        "Index condition pushdown for MyISAM/InnoDB"
Igor's fix from sp1r-igor@olga.mysql.com-20080330055902-07614:
  There could be observed the following problems:
  1. EXPLAIN did not mention pushdown conditions from on expressions in the 
  'extra' column.  As a result if a query had no where conditions pushed 
  down to a table, but had on conditions pushed to this table the 'extra' 
  column in the EXPLAIN for the table missed 'using where'.
  2. Conditions for ref access were not eliminated from on expressions 
  though such conditions were eliminated from the where condition.
2009-12-15 10:16:46 +03:00
unknown
08e4635fba merge 5.1-> 5.2 2009-12-08 23:47:54 +02:00
unknown
a962160eec Merge with MySQL 5.1, with following additions:
- Moved some code from innodb_plugin to xtradb, to ensure that all tests runs
- Did changes in pbxt and maria storage engines becasue of changes in thd->query
- Reverted wrong code in sql_table.cc for how ROW_FORMAT is used.

This is a re-commit of Monty's merge to eliminate an extra commit from
MySQL-5.1.42 that was accidentally included in the merge.

This is a merge of the MySQL 5.1.41 clone-off (clone-5.1.41-build). In
case there are any extra changes done before final MySQL 5.1.41
release, these will need to be merged later before MariaDB 5.1.41
release.
2009-11-16 21:49:51 +01:00