Commit graph

57956 commits

Author SHA1 Message Date
Sergey Petrunya
5ecad03df9 MWL#17: Table elimination
- When collecting Item_subselect::refers_to, put references to the correct
  subselect entry.
2009-07-08 21:10:38 +04:00
Sergey Petrunya
7b3d464578 MWL#17: Table elimination
- More comments
- Renove old code
2009-06-30 17:20:18 +04:00
Sergey Petrunya
8156d9eb0a MWL#17: Table elimination
- Last fixes

sql/item.cc:
  MWL#17: Table elimination
  - Don't make multiple calls of ::walk(check_column_usage_processor),
    call once and cache the value
sql/item.h:
  MWL#17: Table elimination
  - s/KEYUSE::usable/KEYUSE::type/, more comments
sql/opt_table_elimination.cc:
  MWL#17: Table elimination
  - Don't make multiple calls of ::walk(check_column_usage_processor),
    call once and cache the value
sql/sql_select.cc:
  MWL#17: Table elimination
  - s/KEYUSE::usable/KEYUSE::type/, more comments
sql/sql_select.h:
  MWL#17: Table elimination
  - s/KEYUSE::usable/KEYUSE::type/, more comments
sql/table.h:
  MWL#17: Table elimination
  - Better comments
2009-06-30 17:11:00 +04:00
Sergey Petrunya
9fa1bce436 MWL#17: Table elimination
mysql-test/r/table_elim.result:
  MWL#17: Table elimination
  - More tests
mysql-test/t/table_elim.test:
  MWL#17: Table elimination
  - More tests
sql/opt_table_elimination.cc:
  MWL#17: Table elimination
  - Code cleanup
sql/sql_select.cc:
  MWL#17: Table elimination
  - Code cleanup
sql/sql_select.h:
  MWL#17: Table elimination
  - Code cleanup
sql/table.h:
  MWL#17: Table elimination
  - Code cleanup
2009-06-29 17:51:15 +04:00
Sergey Petrunia
d764108a2c MWL#17: Table elimination
- Better comments, variable/function renames
2009-06-26 00:07:29 +04:00
Sergey Petrunia
15f964b68a Automerge 2009-06-25 14:09:47 +04:00
Sergey Petrunia
4102605fba MWL#17: Table elimination
- Moved table elimination code to sql/opt_table_elimination.cc
- Added comments 

.bzrignore:
  MWL#17: Table elimination
  - Moved table elimination code to sql/opt_table_elimination.cc
libmysqld/Makefile.am:
  MWL#17: Table elimination
  - Moved table elimination code to sql/opt_table_elimination.cc
sql/CMakeLists.txt:
  MWL#17: Table elimination
  - Moved table elimination code to sql/opt_table_elimination.cc
sql/Makefile.am:
  MWL#17: Table elimination
  - Moved table elimination code to sql/opt_table_elimination.cc
2009-06-25 14:05:53 +04:00
Sergey Petrunia
e1250b8656 MWL#17: Table elimination
- fix a typo bug in has_eqref_access_candidate()
- Adjust test to remove race condition

mysql-test/r/mysql-bug41486.result:
  Adjust test to remove race condition
mysql-test/t/mysql-bug41486.test:
  Adjust test to remove race condition
sql/item.cc:
  MWL#17: Table elimination:
    fix a typo bug in has_eqref_access_candidate()
2009-06-25 02:44:14 +04:00
Sergey Petrunia
defbdce7e8 More comments 2009-06-24 13:01:04 +04:00
Sergey Petrunia
c4922cbf10 MWL#17: Table elimination
- More testcases
- Let add_ft_key() set keyuse->usable

mysql-test/r/table_elim.result:
  MWL#17: Table elimination
  - More testcases
mysql-test/t/table_elim.test:
  MWL#17: Table elimination
  - More testcases
sql/sql_select.cc:
  MWL#17: Table elimination
  - Let add_ft_key() set keyuse->usable
2009-06-24 00:06:13 +04:00
Sergey Petrunia
9e65634b23 MWL#17: Table elimination
- Make elimination check to be able detect cases like  t.primary_key_col1=othertbl.col AND t.primary_key_col2=func(t.primary_key_col1).
  These are needed to handle e.g. the case of func() being a correlated subquery that selects the latest value.
- If we've removed a condition with subquery predicate, EXPLAIN [EXTENDED] won't show the subquery anymore

sql/item.cc:
  MWL#17: Table elimination
  - Add tem_field::check_column_usage_processor(). it allows to check which key parts a condition depends on.
sql/item.h:
  MWL#17: Table elimination
  - Add tem_field::check_column_usage_processor(). it allows to check which key parts a condition depends on.
sql/item_subselect.cc:
  MWL#17: Table elimination
  - Item_subselect got 'eliminated' attribute. It is used only to determine if the subselect should be printed by EXPLAIN.
  - Item_subselect got List<Item> refers_to - a list of item in the current select that are referred to from within the subselect.
  - Added Item_*::check_column_usage_processor(). it allows to check which key parts a condition depends on.
  - Added a comment about possible problem in Item_subselect::walk
sql/item_subselect.h:
  MWL#17: Table elimination
  - Item_subselect got 'eliminated' attribute. It is used only to determine if the subselect should be printed by EXPLAIN.
  - Item_subselect got List<Item> refers_to - a list of item in the current select that are referred to from within the subselect.
  - Added Item_*::check_column_usage_processor(). it allows to check which key parts a condition depends on.
sql/item_sum.cc:
  MWL#17: Table elimination
sql/sql_lex.cc:
  MWL#17: Table elimination
sql/sql_lex.h:
  MWL#17: Table elimination
sql/sql_select.h:
  MWL#17: Table elimination
2009-06-22 15:46:31 +04:00
Sergey Petrunia
7a9f45c6d5 * Use excessive parentheses to stop compiler warning
* Fix test results to account for changes in previous cset
2009-06-17 09:27:39 +04:00
Sergey Petrunia
c0103f705c * Merge
* Change valgrind suppression to work on valgrind 3.3.0
2009-06-17 00:43:58 +04:00
Sergey Petrunia
d8640e3eae MWL#17: Table elimination
- Move eliminate_tables() to before constant table detection. 
- First code for benchmark

sql-bench/test-table-elimination.sh:
  MWL#17: Table elimination
  - sql-bench "Benchmark", incomplete
sql/sql_select.cc:
  MWL#17: Table elimination
  - Move eliminate_tables() to before constant table detection, this will allow
    to spare const table reads (at a cost of not being able to take advantage of 
    tables that are constant because they have no records, but this case is of 
    lesser importance)
2009-06-16 23:54:13 +04:00
Sergey Petrunia
a0a7cb03ae Fix spurious valgrind warnings in rpl_trigger.test 2009-06-15 20:22:08 +04:00
Sergey Petrunia
6b4727dcb9 MWL#17: Table elimination
- Fix print_join() to work both for EXPLAIN EXTENDED (after table elimination) and for 
  CREATE VIEW (after join->prepare() but without any optimization).

mysql-test/r/union.result:
  MWL#17: Table elimination
  - Adjust test results
2009-06-15 00:59:24 +04:00
Sergey Petrunia
b1e25edc9b MWL#17: Table elimination
- Fix the previous cset: take into account that select_lex may be printed when 
 1. There is no select_lex->join at all (in that case, assume that no tables were eliminated)
 2. select_lex->join exists but there was no JOIN::optimize() call yet. handle this by initializing join->eliminated really early.
2009-06-14 16:35:04 +04:00
Sergey Petrunia
402e58cf78 MWL#17: Table elimination
- Do not show eliminated tables in the output of EXPLAIN EXTENDED
2009-06-14 14:01:10 +04:00
Sergey Petrunia
fd485ad988 MWL#17: Table elimination
- Make elimination work with aggregate functions. The problem was that aggregate functions 
  reported all table bits in used_tables(), and that prevented table elimination. Fixed by 
  making aggregate functions return more correct value from used_tables(). 

mysql-test/r/ps_11bugs.result:
  MWL#17: Table elimination
  - Update test results. The difference is because of Item_ref change: outer references to constants
    are now recognized as constants, too.
mysql-test/r/subselect.result:
  - Update test results. The difference is because of Item_ref change: outer references to constants
    are now recognized as constants, too.
mysql-test/r/table_elim.result:
  MWL#17: Table elimination
  - Check that elimination works in presense of aggreagate functions
mysql-test/t/table_elim.test:
  MWL#17: Table elimination
  - Check that elimination works in presense of aggreagate functions
sql/item.h:
  MWL#17: Table elimination
  - Add Item_ref::const_item() which calls (*ref)->const_item(). Before this diff Item_ref used the 
    default implementation of const_item(){ return used_tables()==0; }. This is no longer true, as 
    COUNT(*) now has used_tables()==0 but const_item()==FALSE.
sql/item_sum.cc:
  MWL#17: Table elimination
  - Make Item_sum() and it descendants not to return all bits in used_tables(). This is needed 
    because otherwise table elimination can't work in presense of aggregate functions
  - COUNT(*) now has used_tables()==0 and const_item()==FALSE. Had to change 
    Item_ref::const_item() to account for this.
sql/item_sum.h:
  MWL#17: Table elimination
  - Add comments
2009-06-10 01:11:33 +04:00
Sergey Petrunya
cf028a5474 Fix valgrind failure: provide an implementation of strmov_overlapp() that really can
handle overlapping.

include/m_string.h:
  Fix valgrind failure: provide an implementation of strmov_overlapp() that really can handle overlapping.
2009-06-08 17:55:46 +04:00
Sergey Petrunia
c2fa5e42a5 Merge MWL#17: Table elimination 2009-06-07 22:29:38 +04:00
Sergey Petrunia
9427771d30 MWL#17: Table Elimination
- Fix trivial valgrind warning
2009-06-07 22:24:03 +04:00
Sergey Petrunia
680107f107 Merge MWL#17 with maria/5.1 2009-06-03 22:23:30 +04:00
Sergey Petrunia
275a4b354b MWL#17: Table elimination
- First code. Elimination works for simple cases, passes the testsuite.
- Known issues:
  = No elimination is done for aggregate functions.
  = EXPLAIN EXTENDED shows eliminated tables (I think it better not)
  = No benchmark yet
  = The code needs some polishing.

mysql-test/r/table_elim.result:
  MWL#17: Table elimination
  - Testcases
mysql-test/t/table_elim.test:
  MWL#17: Table elimination
  - Testcases
sql/sql_select.cc:
  MWL#17: Table elimination
sql/sql_select.h:
  MWL#17: Table elimination
  - Added JOIN_TAB::eliminated (is JOIN_TAB the best place to store this flag?)
sql/table.h:
  MWL#17: Table elimination
  - ADded NESTED_JOIN::n_tables. We need to have the number of real tables remaining in an outer join nest.
2009-06-03 17:10:45 +04:00
unknown
52fb7f12ed Merge import of MySQL man pages, help tables, and install documentation into trunk. 2009-06-02 13:03:59 +02:00
Michael Widenius
67eb7eeeea Fix for bug 39200.
mysql-test/suite/maria/r/maria3.result:
  Merged fix from bug #39200.
mysql-test/suite/maria/t/maria3.test:
  Merged maria3.test
sql/sql_table.cc:
  Bug fix for 39200
2009-06-02 12:58:27 +03:00
unknown
cc5e283d15 Imported freely distributable documentation from upstream MySQL 5.1.34 source tarball. 2009-05-25 11:59:47 +02:00
unknown
d7ae55e704 Fix ps_not_windows test for -all-static build which cannot load plugins. 2009-05-22 19:53:25 +02:00
unknown
48083d73d3 After-merge fixes for problems seen in buildbot after merging MySQL-5.1.35.
- Version number.
 - Valgrind false alarms in libz.
 - New variant of suppression for Valgrind warning in dlclose().
 - Fix double free() in plugin init error case.

configure.in:
  Fix version number. We should reset the maria variant back to `1' when the MySQL version
  number increases.
include/my_sys.h:
  Fix false alarms in Valgrind for zlib.
  
  Apply same fix as for archive storage handler also to the cases of compression in the
  client protocol, and to the compression SQL function.
mysql-test/valgrind.supp:
  A new variant of the dlclose() suppression is needed now.
mysys/my_compress.c:
  Fix false alarms in Valgrind for zlib.
  
  Apply same fix as for archive storage handler also to the cases of compression in the
  client protocol, and to the compression SQL function.
sql/handler.cc:
  Fix a double free() in error case for plugin initialisation.
sql/item_strfunc.cc:
  Fix false alarms in Valgrind for zlib.
  
  Apply same fix as for archive storage handler also to the cases of compression in the
  client protocol, and to the compression SQL function.
2009-05-22 14:38:50 +02:00
unknown
ae134314b8 Fix accessing ulong enum option as uint, failing on 64-bit big-endian. 2009-05-20 17:34:34 +02:00
Michael Widenius
a129a82432 Merge
support-files/build-tags:
  Merge.
2009-05-19 16:34:17 +03:00
Michael Widenius
224108a19e Fixed problems in merge
mysql-test/r/information_schema.result:
  Fixed a result file.
mysql-test/r/innodb-autoinc.result:
  Fixed a result file.
mysql-test/t/connect.test:
  Fixed a problem with merge, needed to close
  connections and use the default
2009-05-19 12:28:05 +03:00
unknown
47d05970f8 Fix support-files/build-tags for newer bzr which do not default to --recursive on bzr ls. 2009-05-18 09:29:14 +02:00
Michael Widenius
b94f191a77 Merge fixes.
mysql-test/mysql-test-run.pl:
  Fixed missed lines in merge.
storage/maria/plug.in:
  Fixed problem with configuration. This is now included
  top level.
storage/pbxt/plug.in:
  Fixed problem with configuration. This is
  included now in top level.
2009-05-12 09:44:01 +03:00
unknown
db020fb30f Merge Toby Thain's Solaris fixes. 2009-05-11 17:31:30 +02:00
Toby Thain
13c45ccbd3 Portability changes for Solaris 10 (amd64). Re-hash BUILD/ scripts for Solaris to be more in line with generic scripts. 2009-05-09 00:01:53 -04:00
unknown
b125770aaa We are now using Valgrind rather than purify, and have for quite some time.
Consequently, rename HAVE_purify to HAVE_valgrind, and related changes.
Leave some comments about purify when not clear that they apply also to Valgrind.
Fix redundant IF_VALGRIND declaration.

Misc. small fixes:
 - Fixes for pool-of-threads patch.
 - Fixes for push of PBXT storage engine.
 - mysql-test-run.pl fix.
 - Fix build problem in compile-pentium64-max.


BUILD/SETUP.sh:
  Rename purify -> valgrind.
BUILD/build_mccge.sh:
  Rename purify -> valgrind.
BUILD/compile-dist:
  Fix that PBXT was missing in source tarball after `BUILD/compile-dist && make dist`
BUILD/compile-pentium64-max:
  Fix a build problem with BUILD/compile-pentium64-max on CentOS/Fedora Core 10 amd64.
        
  On these systems, there is libz.so but no libz.a. Finding libz.so, ./configure decides
  to use system zlib. But since BUILD/compile-pentium64-max builds a fully static binary
  with -all-static, the link of mysqld fails due to missing libz.a.
        
  Fix by using bundled zlib in the build script.
BUILD/compile-solaris-sparc-purify:
  Rename purify -> valgrind.
include/m_string.h:
  Rename purify -> valgrind.
include/my_global.h:
  Rename purify -> valgrind.
mysql-test/Makefile.am:
  Fix that PBXT test suite was missing from `make dist` source tarball.
mysql-test/lib/mtr_unique.pm:
  Better fix to avoid races when chmod'ing the semaphore file.
  (Though using chmod 666 shared files in /tmp/ is still not a very good solution).
mysql-test/t/pool_of_threads.cnf:
  Fix that test case pool_of_threads fails if run on mysqld with no --with-libevent support.
mysys/mf_qsort.c:
  Rename purify -> valgrind.
mysys/my_alloc.c:
  Rename purify -> valgrind.
mysys/my_init.c:
  Rename purify -> valgrind.
mysys/my_rnd.c:
  Rename purify -> valgrind.
mysys/safemalloc.c:
  Rename purify -> valgrind.
scripts/mysql_config.pl.in:
  Rename purify -> valgrind.
scripts/mysql_config.sh:
  Rename purify -> valgrind.
sql/field_conv.cc:
  Rename purify -> valgrind.
sql/filesort.cc:
  Rename purify -> valgrind.
sql/ha_partition.cc:
  Rename purify -> valgrind.
sql/hostname.cc:
  Rename purify -> valgrind.
sql/item_timefunc.cc:
  Rename purify -> valgrind.
sql/log_event.cc:
  Rename purify -> valgrind.
sql/log_event_old.cc:
  Rename purify -> valgrind.
sql/my_decimal.h:
  Rename purify -> valgrind.
sql/mysqld.cc:
  Rename purify -> valgrind.
  Fix redundant IF_VALGRIND declaration.
sql/opt_range.cc:
  Rename purify -> valgrind.
sql/opt_range.h:
  Rename purify -> valgrind.
sql/records.cc:
  Rename purify -> valgrind.
sql/rpl_rli.cc:
  Rename purify -> valgrind.
sql/rpl_rli.h:
  Rename purify -> valgrind.
sql/set_var.cc:
  Fix missing static declaration on pool_of_threads.
sql/slave.cc:
  Rename purify -> valgrind.
sql/sql_base.cc:
  Rename purify -> valgrind.
sql/sql_binlog.cc:
  Rename purify -> valgrind.
sql/sql_class.cc:
  Rename purify -> valgrind.
sql/sql_list.h:
  Rename purify -> valgrind.
sql/sql_load.cc:
  Rename purify -> valgrind.
sql/sql_select.cc:
  Rename purify -> valgrind.
sql/table.cc:
  Rename purify -> valgrind.
storage/archive/azio.c:
  Rename purify -> valgrind.
storage/innobase/buf/buf0buf.c:
  Rename purify -> valgrind.
storage/innobase/include/univ.i:
  Rename purify -> valgrind.
storage/innobase/srv/srv0start.c:
  Rename purify -> valgrind.
storage/maria/ha_maria.cc:
  Rename purify -> valgrind.
storage/maria/ma_blockrec.c:
  Rename purify -> valgrind.
storage/maria/ma_check.c:
  Rename purify -> valgrind.
storage/maria/ma_loghandler.c:
  Rename purify -> valgrind.
storage/maria/ma_packrec.c:
  Rename purify -> valgrind.
storage/maria/ma_page.c:
  Rename purify -> valgrind.
storage/maria/ma_pagecrc.c:
  Rename purify -> valgrind.
storage/maria/ma_search.c:
  Rename purify -> valgrind.
storage/myisam/mi_check.c:
  Rename purify -> valgrind.
storage/myisam/mi_page.c:
  Rename purify -> valgrind.
storage/myisam/mi_search.c:
  Rename purify -> valgrind.
storage/myisammrg/ha_myisammrg.cc:
  Rename purify -> valgrind.
strings/bcmp.c:
  Rename purify -> valgrind.
strings/decimal.c:
  Rename purify -> valgrind.
strings/strmake.c:
  Rename purify -> valgrind.
2009-05-06 14:03:24 +02:00
Michael Widenius
e726e587ec Merged with mysql-5.1 tree.
client/mysqltest.cc:
  Manually merged
configure.in:
  Manually merged
mysql-test/r/variables.result:
  Manually merged
mysql-test/t/variables.test:
  Manually merged
mysys/my_pread.c:
  Manually merged
mysys/my_read.c:
  Manually merged
sql/mysqld.cc:
  Manually merged
storage/csv/ha_tina.h:
  Manually merged
storage/myisam/ha_myisam.cc:
  Manually merged
storage/myisam/mi_check.c:
  Manually merged
storage/myisam/mi_search.c:
  Manually merged
2009-04-25 13:05:32 +03:00
Michael Widenius
210a412522 bzr merge from guilhem's maria tree to our local 5.1
configure.in:
  Manually merged
mysql-test/lib/My/ConfigFactory.pm:
  Manually merged
mysql-test/mysql-test-run.pl:
  Manually merged
mysql-test/t/information_schema.test:
  Manually merged
sql/handler.cc:
  Manually merged
support-files/mysql.spec.sh:
  Manually merged
2009-04-25 12:04:38 +03:00
unknown
059b9356a1 Bump maria version following release. 2009-04-23 15:06:16 +02:00
unknown
ca004e9ec5 merged from trunk. 2009-04-21 12:26:24 +02:00
unknown
928c506ed9 Fix two missing DBUG_RETURN. 2009-04-21 12:24:51 +02:00
Jonathan Perkin
086185089e Merge from mysql-5.1.34-release 2009-04-16 20:43:24 +02:00
Michael Widenius
7e44eb89a0 Merge with Trunk 2009-04-09 00:16:10 +03:00
Michael Widenius
b09c0acd4e Fixed wrong test for extra_ip_sock that caused mysqld to die on Mac if --extra-port was used
sql/sql_string.cc:
  Optimized tests to do fewer reallocs
sql/strfunc.cc:
  Indentation fix
2009-04-08 23:08:38 +03:00
unknown
83290da1e6 Merge mariadb-5.1 2009-04-08 18:59:24 +02:00
unknown
c558b3e068 Fix Valgrind errors seen in buildbot.
Fix mysql-test-run.pl to not terminate early when warnings in error logs are detected during
server shutdown. Instead, give a nice summary report at the end of the failures.

Fix code to make 100% sure no failures will go undetected.

Revert earlier wrong change.

Fix race with port allocation semaphore file permissions.

Adjust testsuite to copy with new PBXT engine now in the tree. The PBXT engine causes an
extra table to appear in the INFORMATION_SCHEMA. This causes different output for a few
test cases.

dbug/dbug.c:
  If DbugParse() is called multiple times, the stack->keywords for the
  top stack frame could be overwritten without being freed, causing a
  memory leak reported by Valgrind.
include/my_global.h:
  Add useful macro for different values when Valgrind (HAVE_purify) and not.
mysql-test/extra/rpl_tests/rpl_auto_increment.test:
  Omit pbxt variables from show variables output.
mysql-test/include/have_pbxt.inc:
  Add facility to disable test if PBXT engine is not available.
mysql-test/lib/mtr_report.pm:
  Give a nice summary report at the end of tests of any warnings seen in logs during
  server shutdowns.
mysql-test/lib/mtr_unique.pm:
  Move chmod 777 to greatly reduce the risk of leaving the port semaphore file unaccessible
  bu other users.
mysql-test/mysql-test-run.pl:
  Don't abort in case of warnings detected, instead give a nice summary report.
  
  Fix code to make 100% sure no failures will go undetected.
  
  Revert earlier wrong change when master disconnects early.
mysql-test/r/information_schema.result:
  Omit PBXT INFORMATION_SCHEMA table from output.
  Move part of test to information_schema_all_engines.
mysql-test/r/information_schema_all_engines.result:
  New file for information_schema tests that depend on which engines are available.
mysql-test/r/information_schema_db.result:
  Move part of test to information_schema_all_engines.
mysql-test/r/innodb-autoinc.result:
  Omit pbxt variables from show variables output.
mysql-test/r/mysqlshow.result:
  Move part of test to information_schema_all_engines.
mysql-test/suite/rpl/r/rpl_auto_increment.result:
  Omit pbxt variables from show variables output.
mysql-test/t/information_schema.test:
  Omit PBXT INFORMATION_SCHEMA table from output.
  Move part of test to information_schema_all_engines.
mysql-test/t/information_schema_all_engines.test:
  New file for information_schema tests that depend on which engines are available.
mysql-test/t/information_schema_db.test:
  Move part of test to information_schema_all_engines.
mysql-test/t/innodb-autoinc.test:
  Omit pbxt variables from show variables output.
mysql-test/t/mysqlshow.test:
  Move part of test to information_schema_all_engines.
mysql-test/valgrind.supp:
  Add variant suppression (different system library versions).
  Add suppression for problem with inet_ntoa().
sql/mysqld.cc:
  Fix missing DBUG_RETURN.
  Fix uninitialised thd->connect_utime, likely introduced by pool_of_threads.
sql/set_var.cc:
  Fix one-byte buffer overflow in several places.
  Fix unsafe use of String::c_ptr() of stack-allocated String buffer.
sql/sql_select.cc:
  Silence valgrind warning due to GCC bug.
sql/sql_string.h:
  Document potential problem with String::c_ptr() and String() constructor with caller-supplied buffer.
storage/archive/azio.c:
  Silence Valgrind false warning for libz.
2009-04-08 18:55:26 +02:00
Michael Widenius
21a195dd0d Merge with trunc (no conflicts) 2009-04-08 11:55:19 +03:00
Michael Widenius
92b2b45e4f Updated comment 2009-04-08 11:47:30 +03:00
Paul McCullagh
51d903630b Data file for PBXT test added 2009-04-07 12:57:46 +02:00