Commit graph

3842 commits

Author SHA1 Message Date
Davi Arnaut
cd41cd953d Bug#22320: my_atomic-t unit test fails
The atomic operations implementation on 5.1 has a few problems,
which might cause tests to abort randomly. Since no code in 5.1
uses atomic operations, simply remove the code.
2010-07-05 09:00:39 -03:00
Davi Arnaut
0300935ff3 Bug#53445: Build with -Wall and fix warnings that it generates
If bzero is not available, resort to memset. Also, remove dead
bzero.c
2010-07-02 18:42:32 -03:00
Davi Arnaut
0eb26fdfa8 Bug#53445: Build with -Wall and fix warnings that it generates
Apart strict-aliasing warnings, fix the remaining warnings
generated by GCC 4.4.4 -Wall and -Wextra flags.

One major source of warnings was the in-house function my_bcmp
which (unconventionally) took pointers to unsigned characters
as the byte sequences to be compared. Since my_bcmp and bcmp
are deprecated functions whose only difference with memcmp is
the return value, every use of the function is replaced with
memcmp as the special return value wasn't actually being used
by any caller.

There were also various other warnings, mostly due to type
mismatches, missing return values, missing prototypes, dead
code (unreachable) and ignored return values.

BUILD/SETUP.sh:
  Remove flags that are implied by -Wall and -Wextra.
  Do not warn about unused parameters in C++.
BUILD/check-cpu:
  Print only the compiler version instead of verbose banner.
  Although the option is gcc specific, the check was only
  being used for GCC specific checks anyway.
client/mysql.cc:
  bcmp is no longer defined.
client/mysqltest.cc:
  Pass a string to function expecting a format string.
  Replace use of bcmp with memcmp.
cmd-line-utils/readline/Makefile.am:
  Always define _GNU_SOURCE when compiling GNU readline.
  Required to make certain prototypes visible.
cmd-line-utils/readline/input.c:
  Condition for the code to be meaningful.
configure.in:
  Remove check for bcmp.
extra/comp_err.c:
  Use appropriate type.
extra/replace.c:
  Replace use of bcmp with memcmp.
extra/yassl/src/crypto_wrapper.cpp:
  Do not ignore the return value of fgets. Retrieve the file
  position if fgets succeed -- if it fails, the function will
  bail out and return a error.
extra/yassl/taocrypt/include/blowfish.hpp:
  Use a single array instead of accessing positions of the sbox_
  through a subscript to pbox_.
extra/yassl/taocrypt/include/runtime.hpp:
  One definition of such functions is enough.
extra/yassl/taocrypt/src/aes.cpp:
  Avoid potentially ambiguous conditions.
extra/yassl/taocrypt/src/algebra.cpp:
  Rename arguments to avoid shadowing related warnings.
extra/yassl/taocrypt/src/blowfish.cpp:
  Avoid potentially ambiguous conditions.
extra/yassl/taocrypt/src/integer.cpp:
  Do not define type within a anonymous union.
  Use a variable to return a value instead of
  leaving the result in a register -- compiler
  does not know the logic inside the asm.
extra/yassl/taocrypt/src/misc.cpp:
  Define handler for pure virtual functions.
  Remove unused code.
extra/yassl/taocrypt/src/twofish.cpp:
  Avoid potentially ambiguous conditions.
extra/yassl/testsuite/test.hpp:
  Function must have C language linkage.
include/m_string.h:
  Remove check which relied on bcmp being defined -- they weren't
  being used as bcmp is only visible when _BSD_SOURCE is defined.
include/my_bitmap.h:
  Remove bogus helpers which were used only in a few files and
  were causing warnings about dead code.
include/my_global.h:
  Due to G++ bug, always silence false-positive uninitialized
  variables warnings when compiling C++ code with G++.
  Remove bogus helper.
libmysql/Makefile.shared:
  Remove built-in implementation of bcmp.
mysql-test/lib/My/SafeProcess/safe_process.cc:
  Cast pid to largest possible type for a process identifier.
mysys/mf_loadpath.c:
  Leave space of the ending nul.
mysys/mf_pack.c:
  Replace bcmp with memcmp.
mysys/my_bitmap.c:
  Dead code removal.
mysys/my_gethwaddr.c:
  Remove unused variable.
mysys/my_getopt.c:
  Silence bogus uninitialized variable warning.
  Do not cast away the constant qualifier.
mysys/safemalloc.c:
  Cast to expected type.
mysys/thr_lock.c:
  Silence bogus uninitialized variable warning.
sql/field.cc:
  Replace bogus helper with a more appropriate logic which is
  used throughout the code.
sql/item.cc:
  Remove bogus logical condition which always evaluates to TRUE.
sql/item_create.cc:
  Simplify code to avoid signedness related warnings.
sql/log_event.cc:
  Replace use of bcmp with memcmp.
  No need to use helpers for simple bit operations.
sql/log_event_old.cc:
  Replace bmove_align with memcpy.
sql/mysqld.cc:
  Move use declaration of variable to the ifdef block where it
  is used. Remove now-unnecessary casts and arguments.
sql/set_var.cc:
  Replace bogus helpers with simple and classic bit operations.
sql/slave.cc:
  Cast to expected type and silence bogus warning.
sql/sql_class.h:
  Don't use enum values as bit flags, the supposed type safety is
  bogus as the combined bit flags are not a value in the enumeration.
sql/udf_example.c:
  Only declare variable when necessary.
sql/unireg.h:
  Replace use of bmove_align with memcpy.
storage/innobase/os/os0file.c:
  Silence bogus warning.
storage/myisam/mi_open.c:
  Remove bogus cast, DBUG_DUMP expects a pointer to unsigned
  char.
storage/myisam/mi_page.c:
  Remove bogus cast, DBUG_DUMP expects a pointer to unsigned
  char.
strings/bcmp.c:
  Remove built-in bcmp.
strings/ctype-ucs2.c:
  Silence bogus warning.
tests/mysql_client_test.c:
  Use a appropriate type as expected by simple_command().
2010-07-02 15:30:47 -03:00
Michael Widenius
5a2f40d48a Fixes for Opensolaris (to get buildbot green)
- Fixed memory leaks in mysqldump
- Fixed printf of NULL which caused crashes on OpenSolaris when using --debug
- Fixed realloc() problem that caused out of memory when running mysqldump.test on OpenSolaris


client/mysqldump.c:
  Fixed memory leaks
  Fixed printf of NULL which caused crashes on OpenSolaris when using --debug
client/mysqltest.cc:
  Fixed printf of NULL which caused crashes on OpenSolaris when using --debug
include/my_global.h:
  Added simple macro val_or_null() to simplify detecting of NULL strings for printf
sql/handler.cc:
  Fixed printf of NULL which caused crashes on OpenSolaris when using --debug
sql/sql_db.cc:
  Fixed printf of NULL which caused crashes on OpenSolaris when using --debug
  Removed testing of 'new_db_name' as this is guranteed never NULL
sql/sql_show.cc:
  Fixed printf of NULL which caused crashes on OpenSolaris when using --debug
storage/csv/ha_tina.cc:
  Fixed realloc() problem that caused out of memory when running mysqldump.test on OpenSolaris
  (OpenSolaris default malloc() can't handle a lot of reallocs() of strings that are growing one byte at a time)
  This did speed up logging to cvs with a magnitude for large strings.
2010-06-23 03:48:11 +03:00
Sergei Golubchik
fc241c1ace plugin maturity is unsigned 2010-06-15 21:12:13 +02:00
Davi Arnaut
6f3a540c37 Bug#42733: Type-punning warnings when compiling MySQL --
strict aliasing violations.

Essentially, the problem is that large parts of the server were
developed in simpler times (last decades, pre C99 standard) when
strict aliasing and compilers supporting such optimizations were
rare to non-existent. Thus, when compiling the server with a modern
compiler that uses strict aliasing rules to perform optimizations,
there are several places in the code that might trigger undefined
behavior.

As evinced by some recent bugs, GCC does a somewhat good of job
misoptimizing such code, but on the other hand also gives warnings
about suspicious code. One problem is that the warnings aren't
always accurate, yet we can't afford to just shut them off as we
might miss real cases. False-positive cases are aggravated mostly
by casts that are likely to trigger undefined behavior.

The solution is to start a cleanup process focused on fixing and
reducing the amount of strict-aliasing related warnings produced
by GCC and others compilers. A good deal of noise reduction can
be achieved by just removing useless casts that are product of
historical cruft and are likely to trigger undefined behavior if
dereferenced.

client/mysql.cc:
  Remove now-unnecessary casts.
  Break up large strings.
client/mysql_upgrade.c:
  Remove now-unnecessary casts.
client/mysqladmin.cc:
  Remove now-unnecessary casts.
  Break up large strings.
client/mysqlbinlog.cc:
  Remove now-unnecessary casts.
client/mysqlcheck.c:
  Remove now-unnecessary casts.
client/mysqldump.c:
  Remove now-unnecessary casts.
client/mysqlimport.c:
  Remove now-unnecessary casts.
client/mysqlshow.c:
  Remove now-unnecessary casts.
client/mysqlslap.c:
  Remove now-unnecessary casts.
client/mysqltest.cc:
  Remove now-unnecessary casts.
extra/comp_err.c:
  Remove now-unnecessary casts.
extra/my_print_defaults.c:
  Remove now-unnecessary casts.
  Break up large strings.
extra/mysql_waitpid.c:
  Remove now-unnecessary casts.
extra/perror.c:
  Remove now-unnecessary casts.
extra/resolve_stack_dump.c:
  Remove now-unnecessary casts.
extra/resolveip.c:
  Remove now-unnecessary casts.
include/my_getopt.h:
  Use a void pointer type as the opaque type to avoid problems with type
  incompatibility -- GCC issues warnings when the type name is not type
  compatible with a operand. As a side bonus, a explicit cast won't be
  necessary anymore.
include/sslopt-longopts.h:
  Remove now-unnecessary casts.
  Break up large strings.
mysys/my_getopt.c:
  Update opaque type and introduce a type definition for the
  argument to my_getopt_register_get_addr.
server-tools/instance-manager/options.cc:
  Remove now-unnecessary casts.
sql/mysqld.cc:
  Remove now-unnecessary casts.
  Break up large strings.
  Update mysql_getopt_value prototype (the old prototype
  was different from the definition anyway).
sql/sql_plugin.cc:
  The type of a pointer to a function must be compatible with the
  pointed-to function type, otherwise the behavior is undefined.
sql/table.cc:
  The variable buf pointer to pointer to pointer to constant char
  could improperly alias a incompatible type in call to fix_type_
  pointers. Since this was actually dead code, it is simply removed.
sql/unireg.cc:
  Remove call to get_form_pos. The code creates a new FRM file which
  is always truncated and writes the form position as 0. Hence, no
  need to retrieve it, we now for sure it is 0.
storage/archive/archive_reader.c:
  Remove now-unnecessary casts.
storage/myisam/ft_nlq_search.c:
  Read weight directly from the buffer.
storage/myisam/fulltext.h:
  Add explanation about the type duality of a key buffer.
  Add accessor macro to retrieve a FT float value.
storage/myisam/mi_test1.c:
  Remove now-unnecessary casts.
storage/myisam/myisam_ftdump.c:
  Read weight directly from the buffer.
storage/myisam/myisamchk.c:
  Remove now-unnecessary casts.
storage/myisam/myisamlog.c:
  A pointer to char was used to alias a pointer to pointer to
  unsigned char, thus violating strict aliasing rules.
storage/myisam/myisampack.c:
  Remove now-unnecessary casts.
strings/decimal.c:
  Remove aliasing violation, printing the value is enough for
  debugging purposes.
tests/mysql_client_test.c:
  Remove now-unnecessary casts.
2010-06-10 17:16:43 -03:00
Davi Arnaut
75a18e24fa Merge of mysql-5.0-bugteam into mysql-5.1-bugteam.
config/ac-macros/ssl.m4:
  Enable yaSSL thread safety if linking with the server or a
  thread safe client library. Avoids building a thread safe
  yaSSL when only building a non-thread safe client library.
2010-06-08 18:14:18 -03:00
Davi Arnaut
51e90dc79e Bug#53906: Stray semicolon in my_sys.h corrupts macro function definition of MY_INIT
include/my_sys.h:
  Remove stray semicolon.
2010-06-08 16:20:54 -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
Georgi Kodinov
1c2c5529c3 merge mysql-5.1 -> mysql-5.1-bugteam 2010-06-01 14:44:31 +03:00
Michael Widenius
9e23495b1d Added macros to inform valgrind that memory is uninitialized
include/Makefile.am:
  Make my_valgrind.h global (as it's used by my_global.h)
include/my_global.h:
  Include my_valgrind.h
include/my_sys.h:
  TRASH() moved to my_valgrind.h
include/my_valgrind.h:
  Add VALGRIND defines to mark memory
mysys/my_alloc.c:
  Mark internal freed memory as undefined
2010-05-26 22:27:01 +03: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
Jonathan Perkin
c42772c7f2 bug#49968: Properly define HAVE_ERRNO_AS_DEFINE for the appropriate
OpenBSD releases.

Apply patch from Brad Smith, thanks!
2010-05-25 14:27:52 +01:00
Marko Mäkelä
98406ba452 Bug#53593: Add some instrumentation to improve Valgrind sensitivity
BUILD/*: Add valgrind_configs=--with-valgrind.
BUILD/*: Remove -USAFEMALLOC from valgrind_flags.

configure.in: Add AC_ARG_WITH(valgrind) and HAVE_VALGRIND.

include/my_sys.h: Define a number of MEM_ wrappers for VALGRIND_ functions.
include/my_sys.h: Make TRASH do MEM_UNDEFINED().

include/m_string.h: Remove unused macro bzero_if_purify(A,B).

_mymalloc(): Declare MEM_UNDEFINED() on the allocated memory.

_myfree(): Declare MEM_NOACCESS() on the freed memory.

storage/innobase/include/univ.i: Enable UNIV_DEBUG_VALGRIND based on
HAVE_VALGRIND rather than HAVE_purify.

Possible things to do:
 * In my_global.h, remove the defined(HAVE_purify) condition
   from the _WIN32 uint3korr().
 * In my_global.h *int*korr(), use | instead of +
   in order to keep the Valgrind V bits accurate
 * Consider replacing HAVE_purify with HAVE_VALGRIND
 * Use VALGRIND_CREATE_BLOCK, VALGRIND_DISCARD in mem_root and similar places
2010-05-20 13:40:42 +03:00
Davi Arnaut
4e378bc55b Manual merge. 2010-04-29 20:18:19 -03:00
Davi Arnaut
54705ab176 Bug#50974: Server keeps receiving big (> max_allowed_packet) packets indefinitely.
The server could be tricked to read packets indefinitely if it
received a packet larger than the maximum size of one packet.
This problem is aggravated by the fact that it can be triggered
before authentication.

The solution is to no skip big packets for non-authenticated
sessions. If a big packet is sent before a session is authen-
ticated, a error is returned and the connection is closed.

include/mysql_com.h:
  Add skip flag. Only used in server builds.
sql/net_serv.cc:
  Control whether big packets can be skipped.
2010-04-29 10:28:16 -03:00
unknown
b1e00b6be8 Merge MySQL 5.1.46 into MariaDB.
Still two test failures to be solved: main.myisam and main.subselect.
2010-04-28 14:52:24 +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
Igor Babaev
a37899a81a Post review fixes. 2010-04-05 19:08:10 -07:00
Igor Babaev
32a4805c5c Merge with the latest changes of 5.2 2010-04-03 13:19:35 -07:00
Sergei Golubchik
3b03f5d97e fixes for windows builds 2010-04-02 11:20:09 +02:00
Igor Babaev
59baf97d56 Post-review fixes. 2010-04-01 14:42:40 -07:00
unknown
20739646d7 Maria WL#61
Interface for maria extensions.
  Alternative plugin interface with additional info (maturity and string version).

CMakeLists.txt:
  Maria plugin interface used.
config/ac-macros/plugins.m4:
  Maria plugin interface used.
configure.in:
  Maria plugin interface used.
include/mysql/plugin.h:
  Maria plugin interface added.
include/mysql/plugin_auth.h.pp:
  Maria plugin interface added.
plugin/auth/auth_socket.c:
  Maria plugin interface added.
plugin/auth/dialog.c:
  Maria plugin interface added.
plugin/daemon_example/daemon_example.cc:
  Maria plugin interface added.
plugin/fulltext/plugin_example.c:
  Maria plugin interface added.
sql/ha_ndbcluster.cc:
  Maria plugin interface added.
sql/ha_partition.cc:
  Maria plugin interface added.
sql/log.cc:
  Maria plugin interface added.
sql/sql_acl.cc:
  Maria plugin interface added.
sql/sql_builtin.cc.in:
  Maria plugin interface used.
sql/sql_plugin.cc:
  Maria plugin interface added.
sql/sql_plugin.h:
  Maria plugin interface used.
sql/sql_show.cc:
  Maria plugin interface added.
storage/archive/ha_archive.cc:
  Maria plugin interface added.
storage/blackhole/ha_blackhole.cc:
  Maria plugin interface added.
storage/csv/ha_tina.cc:
  Maria plugin interface added.
storage/example/ha_example.cc:
  Maria plugin interface added.
storage/federated/ha_federated.cc:
  Maria plugin interface added.
storage/federatedx/ha_federatedx.cc:
  Maria plugin interface added.
storage/heap/ha_heap.cc:
  Maria plugin interface added.
storage/ibmdb2i/ha_ibmdb2i.cc:
  Maria plugin interface added.
storage/innobase/handler/ha_innodb.cc:
  Maria plugin interface added.
storage/innodb_plugin/handler/i_s.cc:
  Maria plugin interface added.
storage/maria/ha_maria.cc:
  Maria plugin interface added.
storage/myisam/ha_myisam.cc:
  Maria plugin interface added.
storage/myisammrg/ha_myisammrg.cc:
  Maria plugin interface added.
storage/pbxt/src/ha_pbxt.cc:
  Maria plugin interface added.
storage/xtradb/handler/ha_innodb.cc:
  Maria plugin interface added.
storage/xtradb/handler/i_s.cc:
  Maria plugin interface added.
storage/xtradb/handler/i_s.h:
  Maria plugin interface added.
2010-04-01 17:34:51 +03:00
Sergey Vojtovich
c37bfe0ae6 Merge fix for BUG39053 to 5.1-bugteam. 2010-04-14 15:53:43 +04: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
Georgi Kodinov
83dfeb2435 Bug #47095: Can't open_files_limit really be larger than 65535?
Several problems addressed:

1. The maximum value for --open_files_limit on non-windows boxes
is now raised to UINT_MAX (the maximum possible without significant
changes in the code). The maximum value on windows is kept to be
2048 due to a known limitation (bug 24509).

2. mysqld_safe now supports --open_files_limit=xx in addition to 
--open-files-limit=xx

3. mysqld_safe always passes through --open[_-]files[_-]limit
to the underlying mysqld. It used to pass it through only if it 
the user running the script has access to the root directory or
there was an --user argument specified.

4. Fixed a prototype in my_file.c to match its counterpart in 
the other #ifdef branch.
2010-04-09 14:47:18 +03:00
Michael Widenius
1aafea91e5 Merge with 5.1
Fixed valgrind warnings found from running main.connect under valgrind


sql/sp_head.cc:
  Ensure that vcol_info is reset
sql/sql_acl.cc:
  Fixed usage of wrong memroot for password
sql/sql_yacc.yy:
  Ensure that vcol_info is reset
2010-04-01 12:04:26 +03:00
Igor Babaev
48014285f1 Merge with the latest changes og 5.2. 2010-03-31 16:10:03 -07:00
Michael Widenius
fee40e2773 Fixed some compiler warnings
include/m_ctype.h:
  MY_UNICASE_INFO already includes 'const'
plugin/auth/dialog.c:
  Fixed parameters to have correct signed/unsigned type
sql/sql_acl.cc:
  old_password_plugin is not used for EMBEDDED_LIBRARY
storage/pbxt/src/ha_pbxt.cc:
  Remove not used variable
2010-03-31 21:37:45 +03:00
Igor Babaev
1a507f4ffd Merge with the latest changes in the 5.2 tree. 2010-03-29 14:16:12 -07:00
Sergei Golubchik
291fd96983 pluggable auth with plugin examples
Makefile.am:
  add new API files to the check_abi rule,
  remove duplicates
client/CMakeLists.txt:
  now a client can use dlopen too
client/Makefile.am:
  be csh-friendly
include/my_global.h:
  add dummy plugs for dlopen and co.
  for the code that needs them to work in static builds
mysys/Makefile.am:
  be csh-friendly
plugin/auth/dialog.c:
  typo fixed
2010-03-29 17:13:53 +02:00
Sergey Petrunya
7df026676b Merge MariaDB-5.2 -> MariaDB 5.3 2010-03-20 15:01:47 +03:00
Sergei Golubchik
f09ca00e08 merged 2010-03-15 12:51:23 +01:00
unknown
3e32ba3ff1 Fix some compiler warnings seen in Buildbot.
Add some extra error output and code cleanup in an attempt to fix/debug
a rare random testsuite problem in check_warnings, where the exit code
from mysqltest is somehow corrupted inside mysql-test-run.pl.

include/my_global.h:
  Fix compiler warnings on some platforms.
mysql-test/lib/My/SafeProcess.pm:
  Move dereference of $? subprocess exit code closer to where it is generated,
  to make the code more robust and on the chance that this will fix the
  occasional problems in check_warnings we see in Buildbot.
mysql-test/mysql-test-run.pl:
  When check_warnings failed, also log the mysqld server for which it failed.
sql/sql_lex.cc:
  Fix compiler warning about possibly uninitialised value, by rewriting a for()
  loop that is always executed at least once into a do .. while() loop with an
  assert.
sql/table.cc:
  Fix compiler warning about uninitialised value.
storage/federatedx/ha_federatedx.cc:
  Fix uninitialised variable.
storage/maria/ma_delete.c:
  Fix compiler warning about uninitialised value.
storage/maria/ma_loghandler.c:
  Fix compiler warning about uninitialised value.
storage/myisam/ft_stopwords.c:
  Fix compiler warning.
storage/myisam/mi_write.c:
  Fix compiler warning about possibly uninitialised value, by rewriting a while()
  loop that is always executed at least once into a do .. while() loop with an
  assert.
storage/xtradb/btr/btr0cur.c:
  Fix compiler warning about possibly uninitialised value.
support-files/compiler_warnings.supp:
  Fix warning suppression to cover all cases in yassl.
vio/viossl.c:
  Fix compiler warning.
2010-03-10 11:32:14 +01:00
unknown
4d7b6a6ea1 Automerge MySQL 5.1.44 merge into latest MariaDB trunk. 2010-03-10 10:12:23 +01:00
Michael Widenius
292f6568fa Added count of my_sync calls (to SHOW STATUS)
tmp_table_size can now be set to 0 (to disable in memory internal temp tables)
Improved speed for internal Maria temp tables:
- Don't use packed keys, except with long text fields.
- Don't copy key all accessed pages during key search.
Some new benchmark tests to sql-bench (for group by)

BUILD/compile-pentium64-gcov:
  Update script to use same pentium_config flags as other tests
BUILD/compile-pentium64-gprof:
  Update script to use same pentium_config flags as other tests
include/my_sys.h:
  Added count of my_sync calls
mysql-test/r/variables.result:
  tmp_table_size can now be set to 0
sql-bench/test-select.sh:
  Added some new test for GROUP BY on a not key field and group by with different order by
sql/mysqld.cc:
  Added count of my_sync calls
  tmp_table_size can now be set to 0 (to disable in memory internal temp tables)
sql/sql_select.cc:
  If tmp_table_size is 0, don't use in memory temp tables (good for benchmarking MyISAM/Maria temp tables)
  Don't pack keys for Maria tables;  The 8K page size makes packed keys too slow for temp tables.
storage/maria/ma_key_recover.h:
  Moved definition to maria_def.h
storage/maria/ma_page.c:
  Moved code used to simplify comparing of identical Maria tables to own function (page_cleanup())
  Fixed that one can read a page with a read lock.
storage/maria/ma_rkey.c:
  For not exact key reads, cache the page where we found key (to speed up future read-next/read-prev calls)
storage/maria/ma_search.c:
  Moved code to cache last key page to separate function.
  Instead of copying pages, only get a link to the page. This notable speeds up key searches on bigger tables.
storage/maria/ma_write.c:
  Added comment
storage/maria/maria_def.h:
  Moved page_cleanup() to separate function.
2010-03-09 21:22:24 +02:00
Sergey Vojtovich
52c2d8410a Plugin author, description and version are available
via I_S.PLUGINS, not via SHOW PLUGINS.
2010-03-16 17:15:19 +04:00
unknown
4bf849c23c Merge MySQL 5.1.44 into MariaDB. 2010-03-04 09:03:07 +01:00
Sergei Golubchik
2ceaffc467 mwl:98 - libservices 2010-03-03 15:44:14 +01:00
Staale Smedseng
600a283689 Bug #45058 init_available_charsets uses double checked locking
A client doing multiple mysql_library_init() and
mysql_library_end() calls over the lifetime of the process may
experience lost character set data, potentially even a
SIGSEGV.

This patch reinstates the reloading of character set data when
a mysql_library_init() is done after a mysql_library_end().
2010-02-26 15:30:14 +01:00
Sergei Golubchik
f04cf03f75 fix for a possible DoS in the my_net_skip_rest() 2010-02-23 13:04:58 +01: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
Sergei Golubchik
b6d030edbf merged 2010-02-12 09:47:31 +01:00
Michael Widenius
d77e3cde5f When one does a drop table, the indexes are not flushed to disk before drop anymore (with MyISAM/Maria)
myisam-recover options changed from OFF to 'DEFAULT' to get less change of data loss when using MyISAM.
(The disadvantage is that changed MyISAM tables will be checked at access time; Use --myisam-recover=OFF for old behavior)
Don't call extra(HA_EXTRA_FORCE_REOPEN) in ALTER TABLE if table is locked as this will mark table as crashed!
Added assert to detect if we accidently would use MyISAM versioning in MySQL

include/my_base.h:
  Mark NOT_USED as USED, as we now use this as a flag to not call extra()
mysql-test/mysql-test-run.pl:
  Don't write all options when there is something wrong with the arguments
mysql-test/r/sp-destruct.result:
  Add missing flush of mysql.proc (as the test copied live tables)
mysql-test/r/variables.result:
  myisam-recover options changed to 'default'
mysql-test/r/view.result:
  Don't show create time in result
mysql-test/suite/maria/t/maria-recovery2-master.opt:
  Don't run test with myisam-recover (as this produces extra warnings during simulated death)
mysql-test/t/sp-destruct.test:
  Add missing flush of mysql.proc (as the test copied live tables)
mysql-test/t/view.test:
  Don't show create time in result
sql/lock.cc:
  Added marker if table was deleted to argument list
sql/mysql_priv.h:
  Added marker if table was deleted to argument list
sql/mysqld.cc:
  myisam-recover options changed from OFF to 'DEFAULT' to get less change of data loss when using MyISAM
  Allow one to specify OFF as argument to myisam-recover (was default before but one couldn't specify it)
sql/sql_base.cc:
  Mark if table is going to be deleted
sql/sql_delete.cc:
  Mark if table is going to be deleted
sql/sql_table.cc:
  Mark if table is going to be deleted
  Don't call extra(HA_EXTRA_FORCE_REOPEN) in ALTER TABLE if table is locked as this will mark table as crashed!
sql/table.cc:
  Signal to handler if table is getting deleted as part of getting droped from table cache.
sql/table.h:
  Added marker if table is going to be deleted.
storage/maria/ha_maria.cc:
  Don't search for transaction handler if file is not transactional or outside of transaction
  (Fixed possible core dump)
storage/maria/ma_blockrec.c:
  Don't write changed information if table is going to be deleted.
storage/maria/ma_close.c:
  Don't write changed information if table is going to be deleted.
storage/maria/ma_extra.c:
  Mark tables that are deleted as crased, to ensure good behavior on restart if we suddenly crash.
storage/maria/ma_locking.c:
  Cleanup
storage/maria/ma_recovery.c:
  We need trnman to be inited during redo phase (to be able to open tables checked with maria_chk)
storage/maria/maria_def.h:
  Added marker if table is going to be deleted.
storage/myisam/mi_close.c:
  Don't write changed information if table is going to be deleted.
storage/myisam/mi_extra.c:
  Mark tables that are deleted as crased, to ensure good behavior on restart if we suddenly crash.
storage/myisam/mi_open.c:
  Added assert to detect if we accidently would use MyISAM versioning in MySQL
storage/myisam/myisamdef.h:
  Added marker if table is going to be deleted.
2010-02-10 21:06:24 +02:00
unknown
e5099a2c85 merge 5.1->5.2 2010-02-01 08:14:12 +02:00
Michael Widenius
4847e50ddb Changed version number from RC to stable
Fixed bug in Yassle to get correct error messages in case of errors
Provide better error messages in case of ssl connect failure
Updated out-of-date ssl certificates to fix failing mysql-test-system (certificates now active for 10 years)
Fixed bug in query_cache that could cause asserts and hangs in DEBUG builds.
Fixed bug where one connection did not see changes done by another connection.

configure.in:
  Changed version number from RC to stable
extra/yassl/src/yassl_error.cpp:
  Fixed bug in Yassle to get correct error messages in case of errors
  - 'error' is an enum that hold more error numbers than the enum was defined for
include/violite.h:
  Added error output string for sslaccept() and sslconnect() to get reason for connect failure
mysql-test/mysql-test-run.pl:
  Write failed test cases if mysql-test-run fails because of too many errors
mysql-test/r/grant.result:
  Update results to reflect new certificates
mysql-test/r/openssl_1.result:
  Update results to reflect new certificates
mysql-test/std_data/cacert.pem:
  Update ssl certificate
mysql-test/std_data/client-cert.pem:
  Update ssl certificate
mysql-test/std_data/client-key.pem:
  Update ssl certificate
mysql-test/std_data/server-cert.pem:
  Update ssl certificate
mysql-test/std_data/server-key.pem:
  Update ssl certificate
mysql-test/t/grant.test:
  Update test to reflect new certificates
mysql-test/t/openssl_1.test:
  Update test to reflect new certificates
mysql-test/t/query_cache_debug.test:
  Remove 'big_test' as test is now fast
sql-common/client.c:
  Give a better error message if ssl connect fails
sql/net_serv.cc:
  Fixed compiler warnings
sql/slave.cc:
  Give a better error message in logs if ssl connect fails
sql/sql_cache.cc:
  debug_wait_for_kill() now removes the set watch variable after kill signal
  This is needed as invalidate_table() may be called twice for one query.
  Ensure that net->query_cache_query is reset after query. This fixes assert in
  query_cache_end_of_result() if query_cache_query holds results from previous query.
  Removed DBUG_ASSERT(0), as this code can be run by query_cache_debug.test
sql/sql_connect.cc:
  Give a better error message if ssl connect fails
sql/sql_parse.cc:
  Fixed bug where one connection did not see changes done by another connection.
  For statements that changes tables, close_thread_tables() MUST be called before
  sending OK as a table handler may not make the changes available for other connections
  before unlock_tables().
vio/viossl.c:
  Give a better error message if ssl connect fails
2010-01-29 12:42:31 +02:00
Michael Widenius
e2efd93385 Fixed some compiler warnings and errors in test suite found by buildbot
include/ft_global.h:
  Changed string size to 'size_t' (to avoid compiler warnings later)
include/maria.h:
  Changed string size to 'size_t' (to avoid compiler warnings later)
mysql-test/r/show_check.result:
  Don't use logging to tables, as there is no guarantee in which order tables are showed in 'show open tables'
mysql-test/suite/rpl/t/rpl_rotate_logs.test:
  Use HIGH_PRIORITY inserts to avoid problem with concurrent inserts on the slave.
mysql-test/t/show_check-master.opt:
  Don't use logging to tables, as there is no guarantee in which order tables are showed in 'show open tables'
sql/item.cc:
  Fixed compiler warning
storage/maria/ft_maria.c:
  Changed string size to 'size_t' (to avoid compiler warnings later)
storage/myisam/ft_boolean_search.c:
  Fixed compiler warnings
storage/myisam/ft_myisam.c:
  Changed string size to 'size_t' (to avoid compiler warnings later)
storage/myisam/ft_nlq_search.c:
  Changed string size to 'size_t' (to avoid compiler warnings later)
storage/myisam/ft_parser.c:
  Changed string size to 'size_t' (to avoid compiler warnings)
storage/myisam/ft_stopwords.c:
  Changed string size to 'size_t' (to avoid compiler warnings)
storage/myisam/ftdefs.h:
  Changed string size to 'size_t' (to avoid compiler warnings)
2010-01-27 23:53:08 +02:00
Staale Smedseng
22be2783f2 Merging from 5.0-bugteam 2010-01-27 11:42:20 +01:00
Michael Widenius
d8ecbbe634 Merge with MySQL 5.1.42
- Marked a couple of tests with --big
- Fixed xtradb/handler/ha_innodb.cc to call explain_filename()

storage/xtradb/handler/ha_innodb.cc:
  Call explain_filename() to get proper names for partitioned tables
2010-01-15 17:27:55 +02: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
Michael Widenius
f83113df07 Applied Antony T Curtis patch for declaring many CHARSET objects as const
Removed compiler warnings

extra/libevent/epoll.c:
  Removed compiler warnings
extra/libevent/evbuffer.c:
  Removed compiler warnings
extra/libevent/event.c:
  Removed compiler warnings
extra/libevent/select.c:
  Removed compiler warnings
extra/libevent/signal.c:
  Removed compiler warnings
include/m_ctype.h:
  Define CHARSET_INFO, MY_CHARSET_HANDLER, MY_COLLATION_HANDLER, MY_UNICASE_INFO, MY_UNI_CTYPE and MY_UNI_IDX as const structures.
  Declare that pointers point to const data
include/m_string.h:
  Declare that pointers point to const data
include/my_sys.h:
  Redefine variables and function prototypes
include/mysql.h:
  Declare charset as const
include/mysql.h.pp:
  Declare charset as const
include/mysql/plugin.h:
  Declare charset as const
include/mysql/plugin.h.pp:
  Declare charset as const
mysys/charset-def.c:
  Charset can't be of type CHARSET_INFO as they are changed when they are initialized.
mysys/charset.c:
  Functions that change CHARSET_INFO must use 'struct charset_info_st'
  Add temporary variables to not have to change all_charsets[] (Which now is const)
sql-common/client.c:
  Added cast to const
sql/item_cmpfunc.h:
  Added cast to avoid compiler error.
sql/sql_class.cc:
  Added cast to const
sql/sql_lex.cc:
  Added cast to const
storage/maria/ma_ft_boolean_search.c:
  Added cast to avoid compiler error.
storage/maria/ma_ft_parser.c:
  Added cast to avoid compiler error.
storage/maria/ma_search.c:
  Added cast to const
storage/myisam/ft_boolean_search.c:
  Added cast to avoid compiler error
storage/myisam/ft_parser.c:
  Added cast to avoid compiler error
storage/myisam/mi_search.c:
  Added cast to const
storage/pbxt/src/datadic_xt.cc:
  Added cast to const
storage/pbxt/src/ha_pbxt.cc:
  Added cast to const
  Removed compiler warning by changing prototype of XTThreadPtr()
storage/pbxt/src/myxt_xt.h:
  Character sets should be const
storage/pbxt/src/xt_defs.h:
  Character sets should be const
storage/xtradb/btr/btr0cur.c:
  Removed compiler warning
strings/conf_to_src.c:
  Added const
  Functions that change CHARSET_INFO must use 'struct charset_info_st'
strings/ctype-big5.c:
  Made arrays const
strings/ctype-bin.c:
  Made arrays const
strings/ctype-cp932.c:
  Made arrays const
strings/ctype-czech.c:
  Made arrays const
strings/ctype-euc_kr.c:
  Made arrays const
strings/ctype-eucjpms.c:
  Made arrays const
strings/ctype-extra.c:
  Made arrays const
strings/ctype-gb2312.c:
  Made arrays const
strings/ctype-gbk.c:
  Made arrays const
strings/ctype-latin1.c:
  Made arrays const
strings/ctype-mb.c:
  Made arrays const
strings/ctype-simple.c:
  Made arrays const
strings/ctype-sjis.c:
  Made arrays const
strings/ctype-tis620.c:
  Made arrays const
strings/ctype-uca.c:
  Made arrays const
strings/ctype-ucs2.c:
  Made arrays const
strings/ctype-ujis.c:
  Made arrays const
strings/ctype-utf8.c:
  Made arrays const
strings/ctype-win1250ch.c:
  Made arrays const
strings/ctype.c:
  Made arrays const
  Added cast to const
  Functions that change CHARSET_INFO must use 'struct charset_info_st'
strings/int2str.c:
  Added cast to const
2010-01-06 21:20:16 +02:00
Georgi Kodinov
c248859ec8 merge 2009-12-24 11:00:04 +02: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
Staale Smedseng
00e6c3a89e Bug#43397 mysql headers redefine pthread_mutex_init
unnecessarily

Changing an instance of the define that was missed
in the original commit due to the fact that it was
misspelled.
2009-12-20 19:02:15 +01:00
Satya B
bbf079cf2c merge mysql-5.0-bugteam to mysql-5.1-bugteam 2009-12-17 17:15:13 +05:30
Satya B
cf9966f86f Fix for Bug#37408 - Compressed MyISAM files should not require/use mmap()
When compressed myisam files are opened, they are always memory mapped
sometimes causing memory swapping problems.

When we mmap the myisam compressed tables of size greater than the memory 
available, the kswapd0 process utilization is very high consuming 30-40% of 
the cpu. This happens only with linux kernels older than 2.6.9

With newer linux kernels, we don't have this problem of high cpu consumption
and this option may not be required.
 
The option 'myisam_mmap_size' is added to limit the amount of memory used for
memory mapping of myisam files. This option is not dynamic.

The default value on 32 bit system is 4294967295 bytes and on 64 bit system it
is 18446744073709547520 bytes.

Note: Testcase only tests the option variable. The actual bug has be to 
tested manually.

include/my_global.h:
  Fix for Bug #37408 - Compressed MyISAM files should not require/use mmap()
  
  define SIZE_T_MAX
include/myisam.h:
  Fix for Bug #37408 - Compressed MyISAM files should not require/use mmap()
  
  declare 'myisam_mmap_size' and 'myisam_mmap_used' variables and the mutex
  THR_LOCK_myisam_mmap
myisam/mi_packrec.c:
  Fix for Bug #37408 - Compressed MyISAM files should not require/use mmap()
  
  add 'myisam_mmap_size' option which limits the memory available to mmap of 
  myisam files
myisam/mi_static.c:
  Fix for Bug #37408 - Compressed MyISAM files should not require/use mmap()
  
  declare 'myisam_mmap_size' and 'myisam_mmap_used' variables and the mutex
  THR_LOCK_myisam_mmap
myisam/myisamdef.h:
  Fix for Bug #37408 - Compressed MyISAM files should not require/use mmap()
  
  move MEMMAP_EXTRA_MARGIN to myisam.h so that it can be used in mysqld.cc
mysql-test/r/variables.result:
  Fix for Bug #37408 - Compressed MyISAM files should not require/use mmap()
  
  Testcase for BUG#37408 to test the myisam_mmap_size option
mysql-test/t/variables.test:
  Fix for Bug #37408 - Compressed MyISAM files should not require/use mmap()
  
  Testcase for BUG#37408 to test the myisam_mmap_size option
mysys/my_thr_init.c:
  Fix for Bug #37408 - Compressed MyISAM files should not require/use mmap()
  
  intialize the lock THR_LOCK_myisam_mmap
sql/mysqld.cc:
  Fix for Bug #37408 - Compressed MyISAM files should not require/use mmap()
  
  add the 'myisam_mmap_size' option
sql/set_var.cc:
  Fix for Bug #37408 - Compressed MyISAM files should not require/use mmap()
  
  add the 'myisam_mmap_size' to the SHOW VARIABLES list
2009-12-17 16:55:50 +05:30
Georgi Kodinov
adc17cd41e Bug #48866: mysql.test fails under Fedora 12
strmov() is not guaranteed to work correctly on overlapping
source and destination buffers. On some OSes it may work,
but Fedora 12 has a stpcpy() that's not working correctly 
on overlapping buffers.
Fixed to use the overlap-safe version of strmov instead.
Re-vitalized the overlap-safe version of strmov.
2009-12-16 19:31:19 +02: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
Staale Smedseng
8969530cff Bug #45058 init_available_charsets uses double checked locking
As documented in the bug report, the double checked locking
pattern has inherent issues, and cannot guarantee correct
initialization.

This patch replaces the logic in init_available_charsets()
with the use of pthread_once(3). A wrapper function,
my_pthread_once(), is introduced and is used in lieu of direct
calls to init_available_charsets(). Related defines
MY_PTHREAD_ONCE_* are also introduced.

For the Windows platform, the implementation in lp:sysbench is
ported. For single-thread use, a simple define calls the
function and sets the pthread_once control variable.

Charset initialization is modified to use my_pthread_once().

include/my_no_pthread.h:
  Dummy my_pthread_once() for single thread use.
include/my_pthread.h:
  Declaration for new function my_pthread_once().
mysys/charset.c:
  Logic in init_available_charsets() is simplified. 
  Using my_pthread_once() for all calls to this func.
mysys/my_winthread.c:
  Windows implementation of my_pthread_once().
2009-12-12 19:11:25 +01:00
unknown
08e4635fba merge 5.1-> 5.2 2009-12-08 23:47:54 +02:00
Staale Smedseng
7a14bfa52d Merge from 5.0 2009-12-06 19:01:11 +01:00
unknown
db260b19e3 Merge MySQL 5.1.41 into MariaDB trunk, including a number of after-merge fixes.
Also merge charset patch.
2009-11-30 22:37:27 +01:00
Michael Widenius
0df8279c46 Fixes after comments from last push:
- Removed some not needed casts
- Change plugin.h to be 'binary compatible' with old versions
- Added mysql_ft_size_t typedef to plugin.h to make it trivial to change string lengths to size_t on next ABI change
- Made some fixes suggested by Kristian to make things more portable and future safe (when it comes to strict aliasing)

include/ft_global.h:
  Introduced FT_WEIGTH, to handle fulltext weights in a slightly more portable manner
include/mysql/plugin.h:
  Change plugin.h to be 'binary compatible' with old versions
  Added mysql_ft_size_t typedef to plugin.h to make it trivial to change string lengths to size_t on next ABI change
  Changed flags to unsigned (as flags should always be unsigned)
mysql-test/t/information_schema.test:
  Fixed typo
sql/sp_head.cc:
  Removed cast
sql/sql_select.cc:
  Removed cast
sql/table.cc:
  Removed cast
storage/maria/ma_ft_boolean_search.c:
  Use mysql_ft_size_t instead of size_t for plugin.h code
  Changed some other string lengths to size_t
storage/maria/ma_ft_nlq_search.c:
  Use FT_WEIGTH to make code more portable
storage/maria/ma_ft_parser.c:
  Use mysql_ft_size_t instead of size_t for plugin.h code
  Changed some other string lengths to size_t
storage/maria/ma_ftdefs.h:
  Changed some string lengths to size_t
storage/maria/maria_ftdump.c:
  Use FT_WEIGTH to make code more portable
storage/myisam/ft_boolean_search.c:
  Use mysql_ft_size_t instead of size_t for plugin.h code
storage/myisam/ft_nlq_search.c:
  Use FT_WEIGTH to make code more portable
storage/myisam/ft_parser.c:
  Use mysql_ft_size_t instead of size_t for plugin.h code
storage/myisam/myisam_ftdump.c:
  Use FT_WEIGTH to make code more portable
2009-11-30 15:36:06 +02:00
Michael Widenius
4c14f9f23c Added more general support for sorting 2 characters as one (contractions)
Added support for Croatian sorting orders utf8_croatian_ci and ucs2_croatian_ci.
Patch done by Alexander Barkov. See http://www.collation-charts.org/articles/croatian.htm

mysql-test/r/ctype_uca.result:
  Added testing of Croatian sort order
mysql-test/t/ctype_uca.test:
  Added testing of Croatian sort order
2009-11-30 14:42:24 +02:00
Michael Widenius
d13c54351d Remove compiler warnings (Including some warnings from -Wstrict-aliasing)
Don't use static link by default (in compile-pentium) as some new systems doesn't have all static libraries available
Change type for functions in plugin.h:str_mysql_ftparser_param() to const unsigned char and string lengths to size_t.
One effect of the above change is that one needs to include mysql_global.h or define size_t before including plugin.h
This fixes a case where mysql_client_test failed with newer gcc that enables strict-aliasing by default


BUILD/compile-pentium:
  Don't use static link by default as some new systems doesn't have all static libraries available
client/mysql_upgrade.c:
  Remove not used variable
cmd-line-utils/readline/config_readline.h:
  Define some constants to get rid of compiler warnings on Linux
cmd-line-utils/readline/display.c:
  Get rid of compiler warnings
cmd-line-utils/readline/history.c:
  Got rid of compiler warnings:
  - Defining some strings as const
  - Added cast
cmd-line-utils/readline/rlmbutil.h:
  Added cast to get rid of compiler warnings
cmd-line-utils/readline/text.c:
  Remove not needed initialization to get rid of compiler warnings
cmd-line-utils/readline/xmalloc.c:
  Changed types to 'const char* to get rid of compiler warnings
configure.in:
  Ensure that we use MariaDB as suffix
include/mysql/plugin.h:
  Changed types to 'const unsigned char* to get rid of compiler warnings (in other parts of the code)
  Change length for not \0 terminated string to size_t
include/mysql/plugin.h.pp:
  Update related to plugin.h
libmysql/libmysql.c:
  Fixed bug that caused core dump with newer gcc when strict aliasing is not turned off
mysql-test/t/information_schema.test:
  Test is depending on innodb
mysql-test/t/not_partition.test:
  Fixed wrong directory name
  (Not noticed before as we don't ususally run this test)
mysys/lf_hash.c:
  Got rid of compiler warnings from -Wstrict-aliasing
mysys/my_redel.c:
  Removed not used variable
regex/engine.c:
  Changed types to 'const char* to get rid of compiler warnings
regex/engine.ih:
  Changed types to 'const char* to get rid of compiler warnings
sql/sp_head.cc:
  Got rid of compiler warning from -Wstrict-aliasing
sql/sql_base.cc:
  Got rid of compiler warnings from -Wstrict-aliasing
  (The original code was probably wrong as nj_col->table_field was
sql/sql_builtin.cc.in:
  plugin.h needs to have size_t defined
sql/sql_parse.cc:
  Remove used variable
sql/sql_select.cc:
  Got rid of compiler warnings from -Wstrict-aliasing
sql/sql_show.cc:
  Added #ifdef to get rid of compiler warning when not using partition engine
sql/table.cc:
  Got rid of compiler warning from -Wstrict-aliasing
storage/maria/ha_maria.cc:
  Got rid of compiler warnings from -Wstrict-aliasing:
  - Use the thd_killed() API function
storage/maria/lockman.c:
  Got rid of compiler warnings from -Wstrict-aliasing
storage/maria/ma_check.c:
  Got rid of compiler warnings from -Wstrict-aliasing
  Change to use new version of _ma_killed_ptr; Don't call it as often as before
storage/maria/ma_check_standalone.h:
  Update to compatible _ma_killed_ptr() from ha_maria.cc
storage/maria/ma_ft_boolean_search.c:
  Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts)
storage/maria/ma_ft_nlq_search.c:
  Got rid of compiler warnings from -Wstrict-aliasing
  Ensure that 'subkeys' is 32 bit
storage/maria/ma_ft_parser.c:
  Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts)
storage/maria/ma_ftdefs.h:
  Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts)
storage/maria/ma_sort.c:
  Change to use new version of _ma_killed_ptr; Don't call it as often as before
storage/maria/ma_state.c:
  Got rid of compiler warnings from -Wstrict-aliasing
storage/maria/maria_def.h:
  Redefine ma_killed_ptr()
storage/maria/maria_ftdump.c:
  Got rid of compiler warnings from -Wstrict-aliasing
storage/maria/trnman.c:
  Got rid of compiler warnings from -Wstrict-aliasing
storage/myisam/ft_boolean_search.c:
  Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts)
storage/myisam/ft_nlq_search.c:
  Got rid of compiler warnings from -Wstrict-aliasing
storage/myisam/ft_parser.c:
  Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts)
storage/myisam/ft_stopwords.c:
  Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts)
storage/myisam/ftdefs.h:
  Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts)
storage/myisam/ha_myisam.cc:
  Got rid of compiler warnings from -Wstrict-aliasing:
  - Use the thd_killed() API function
storage/myisam/mi_check.c:
  Use new killed_ptr() function
storage/myisam/myisam_ftdump.c:
  Got rid of compiler warnings from -Wstrict-aliasing
storage/myisam/myisamchk.c:
  Update to compatible killed_ptr() from ha_myisam.cc
storage/myisam/myisamdef.h:
  Redefine killed_ptr()
storage/myisam/myisamlog.c:
  Got rid of compiler warnings from -Wstrict-aliasing
storage/myisam/sort.c:
  Change to use new version of killed_ptr; Don't call it as often as before
storage/xtradb/fil/fil0fil.c:
  Fixedc ompiler warning
storage/xtradb/trx/trx0i_s.c:
  Include mysql_plugin.h later to ensure that size_t is defined
2009-11-30 01:08:56 +02:00
Michael Widenius
926668feb1 Automatic merge 2009-11-25 09:36:28 +02:00
Davi Arnaut
6cfe31e382 Post-merge fix for bug 41728: revert fix that was pushed in mistake to 5.1 and up. 2009-11-24 19:25:23 -02:00
Vladislav Vaintroub
26a37b36ef Bug#47571 : idle named pipe connection is unkillable
implement Davi's review suggestions (post-push fixes)


include/violite.h:
  Use official abbreviation for milliseconds (ms)
sql/mysqld.cc:
  Fix formatting
  Add error handling for the case of CreateEvent error
vio/vio.c:
  Use official abbreviation for milliseconds(ms)
  Remove superfluous memset
  Fix formatting
vio/viosocket.c:
  Use official abbreviation for milliseconds (ms)
  Use size_t  datatype instead of int in pipe_complete_io
2009-11-20 13:09:50 +01:00
unknown
d70904c762 MySQL 5.1.41 after-merge fix: Fix non-debug build breakage. 2009-11-16 22:35:55 +01: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
Michael Widenius
815b9fedef Safety change to ensure read/black trees (used with heap tables) works on 64 bit setups where ulong <> size_t
Don't retry test cases by default
Fixed bug where we could (under unlikely error conditions) access not initialized variable

include/my_tree.h:
  Safety change to ensure read/black trees (used with heap tables) works on 64 bit setups where ulong <> size_t
  (Pointed out by Bryan Aker)
mysql-test/mysql-test-run.pl:
  Don't retry test cases by default
  This makes it too easy to miss failures and we have anyway to fix race conditions, not ignore them.
mysys/tree.c:
  Safety change to ensure read/black trees (used with heap tables) works on 64 bit setups where ulong <> size_t
sql/sql_delete.cc:
  Fixed bug where we could (under unlikely error conditions) access not initialized variable.
  (Pointed out by Bryan Aker)
2009-11-16 17:34:08 +02:00
Igor Babaev
e4e1ae0d13 Merge of the patch introducing virtual columns into maria-5.2 2009-11-11 20:31:28 -08:00
Igor Babaev
d749c7e600 Merge 2009-11-09 18:32:39 -08:00
Michael Widenius
166e0683c0 Added error handling for my_seek() & my_tell() failures
mysys/my_seek.c:
  Give error if MY_WME is used
sql/sql_insert.cc:
  Fixed compiler warning
storage/maria/ha_maria.cc:
  Changed driver of Maria storage engine project
2009-11-07 12:34:19 +02:00
unknown
ad368a2b54 Merge Mysql 5.1.39 merge into MariaDB trunk 2009-11-06 18:22:32 +01:00
Vladislav Vaintroub
b51777484f merge 2009-11-03 01:52:57 +01:00
Vladislav Vaintroub
e080080711 Bug#47571: idle named pipe connection is unkillable
Bug#31621: Windows server hanging during shutdown using named pipes 
           and idle connection
            
Problem: when idle pipe connection is forcefully closed with KILL
statement or when the server goes down, thread that is closing connection
would hang infinitely in CloseHandle(). The reason for the hang is that 
named pipe operations are performed synchronously. In this mode all IOs
on pipe are serialized, that is CloseHandle() will not abort ReadFile() 
in another thread, but wait for ReadFile() to complete.
            
The fix implements asynchrnous mode for named pipes, where operation of file
are not synchronized. Read/Write operation would fire an async IO and wait for
either IO completion or timeout.
            
Note, that with this patch timeouts are properly handled for named pipes.
      
Post-review: Win32 timeout code has been fixed for named pipes and shared
memory. We do not store pointer to NET in vio structure, only the read and 
write timeouts.


include/violite.h:
  Add pipe_overlapped to Vio structure for async IO for named pipes.
sql-common/client.c:
  Use asynchronous pipe IO.
sql/mysqld.cc:
  Use asynchronous pipe IO.
vio/vio.c:
  -Refactor timeouts for win32 protocols: shared memory and named pipes.
  Store read/write timeout in VIO structure, instead of storing pointer
  to NET. New function vio_win32_timeout called indirectly via 
  vio_timeout changes these values.
vio/vio_priv.h:
  Remove vio_ignore_timeout.
  Add vio_win32_timeout to be used for named pipes and shared memory.
vio/viosocket.c:
  Use async IO for named pipes.
  After issuing IO, wait for either IO completion, pipe_close_event
  or timeout.
          
  Refactor timeouts for named pipe and shared memory.
2009-11-02 23:19:58 +01:00
Davi Arnaut
1955c86624 Automerge. 2009-11-02 09:22:36 -02:00
Michael Widenius
056cebe61a Automatic merge with 5.1 2009-10-28 16:56:07 +02:00
Sergey Vojtovich
578007404d A follow-up to fix for
BUG#47073 - valgrind errs, corruption,failed repair of partition,
            low myisam_sort_buffer_size

Fixed race conditions discovered with the provided test case and
stabilized test case.

include/myisam.h:
  Serialize submission of messages from multi-threaded REPAIR.
mysql-test/r/myisam.result:
  REPAIR output highly depend on threads activity. Disabled
  result log to make test case deterministic.
mysql-test/t/myisam.test:
  REPAIR output highly depend on threads activity. Disabled
  result log to make test case deterministic.
storage/myisam/ha_myisam.cc:
  Serialize submission of messages from multi-threaded REPAIR.
storage/myisam/mi_check.c:
  Serialize submission of messages from multi-threaded REPAIR.
storage/myisam/sort.c:
  Only master thread is allowed to detach write cache from
  the share.
2009-10-27 18:27:27 +04:00
Igor Babaev
90a4a3dcd7 Merge of the latest 5.1 changes. 2009-10-26 13:48:20 -07:00
Michael Widenius
5bddbc44c6 Fixed compiler warning message
- Added checking of return value for system(), freopen(), fgets() and chown()
- Ensure that calls that require a format strings gets a format string
- Other trivial things
Updated test suite results (especially for pbxt and embedded server)
Removed warning for "Invalid (old?) table or database name 'mysqld.1'" from pbxt tests
Speed up some pbxt tests by inserting begin ; commit; around "while loops with inserts"
Added mysqld startup option '--debug-flush'
Create maria_recovery.trace in data directory instead of current directory

client/mysql.cc:
  Check return value from system()
client/mysql_upgrade.c:
  Check return value from fgets()
client/mysqladmin.cc:
  Check return value from fgets()
client/mysqlslap.c:
  Check return value from system() (but ignore it, as it's not critical)
extra/yassl/src/crypto_wrapper.cpp:
  Check return value from fgets() (but ignore it, as it's internal file)
extra/yassl/taocrypt/src/aes.cpp:
  Added extra {} to remove compiler warning
extra/yassl/taocrypt/src/blowfish.cpp:
  Added extra {} to remove compiler warning
extra/yassl/taocrypt/src/misc.cpp:
  Ifdef not used code
include/mysys_err.h:
  Added error message for failing chown()
mysql-test/mysql-test-run.pl:
  Don't give warning for skipping ndbcluster (never enabled in MariaDB)
mysql-test/suite/funcs_1/r/is_columns_is_embedded.result:
  Update with new information schema information
mysql-test/suite/funcs_1/r/is_tables_is_embedded.result:
  New test
mysql-test/suite/funcs_1/r/is_tables_myisam_embedded.result:
  Update test results (has not been tested for a long time)
mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result:
  Update test results (has not been tested for a long time)
mysql-test/suite/funcs_1/t/is_tables_is.test:
  Don't run with embedded server (as results differ)
  I added a new test for embedded server
mysql-test/suite/funcs_1/t/is_tables_is_embedded.test:
  New test
mysql-test/suite/pbxt/my.cnf:
  Allow one to run pbxt tests without having to specify --mysqld=--default-storage-engine=pbxt
mysql-test/suite/pbxt/t/count_distinct3.test:
  Speed up test by inserting begin; ... commit;
mysql-test/suite/pbxt/t/subselect.test:
  Speed up test by inserting begin; ... commit;
mysys/errors.c:
  Added error message for failing chown()
mysys/my_copy.c:
  Added error message for failing chown()
mysys/my_redel.c:
  Added error message for failing chown()
mysys/safemalloc.c:
  Added cast to get rid of compiler warning
sql/ha_partition.cc:
  Fixed wrong argument to sql_print_error() (it requires a format string)
sql/log.cc:
  Test return value of freopen()
sql/mysqld.cc:
  Test return value of freopen()
  Added startup option '--debug-flush' to be used when one gets a core dump (easy to explain to people on IRC)
sql/rpl_rli.cc:
  Fixed wrong argument to sql_print_error() (it requires a format string)
sql/set_var.cc:
  Added {} to get rid of compiler warnings
sql/slave.cc:
  Fixed wrong argument to mi->report() and sql_print...() (they require a format string)
sql/sql_cache.cc:
  Fixed wrong argument to sql_printinformation() (it requires a format string)
sql/sql_parse.cc:
  Test return value of fgets()
sql/sql_plugin.cc:
  Fixed wrong argument to sql_print_error() (it requires a format string)
sql/sql_select.cc:
  Use unique table name for internal temp tables instead of full path
  (Simple speed & space optimization)
sql/udf_example.c:
  Removed compiler warning about not used variable
storage/maria/ha_maria.cc:
  Fixed wrong argument to sql_print_error() and ma_check_print_error() (they require a format string)
storage/maria/ma_recovery.c:
  Create maria_recovery.trace in data directory instead of current directory
storage/maria/unittest/ma_test_loghandler-t.c:
  Fixed wrong argument to ok();  Requires a format string
storage/pbxt/src/strutil_xt.cc:
  Detect temporary tables by checking if that path for the table is in the mysql data directory.
  The database for temporary tables is after this patch, from PBXT point of view, ""
  This is needed to stop PBXT from calling filename_to_tablename() with the base directory as an argument, which caused
  ERROR: Invalid (old?) table or database name 'mysqld.1'" in the log when running the test suite.
tests/mysql_client_test.c:
  Fixed compiler warnings
unittest/mysys/base64-t.c:
  Fixed wrong argument to diag() (it requires a format string)
  Added a comment that the current 'print' of differing buffers doesn't print the right thing,
  but didn't fix this as it's not important (unless we find a bug in the real code)
2009-10-26 13:35:42 +02:00
Michael Widenius
ab0905c6d7 This is based on the userstatv2 patch from Percona and OurDelta.
The original code comes, as far as I know, from Google (Mark Callaghan's team) with additional work from Percona, Ourdelta and Weldon Whipple.

This code provides the same functionallity, but with a lot of changes to make it faster and better fit the MariaDB infrastucture.

Added new status variables:
- Com_show_client_statistics, Com_show_index_statistics, Com_show_table_statistics, Com_show_user_statistics
- Access_denied_errors, Busy_time (clock time), Binlog_bytes_written, Cpu_time, Empty_queries, Rows_sent, Rows_read

Added new variable / startup option 'userstat' to control if user statistics should be enabled or not

Added my_getcputime(); Returns cpu time used by this thread.
New FLUSH commands:
- FLUSH SLOW QUERY LOG
- FLUSH TABLE_STATISTICS
- FLUSH INDEX_STATISTICS
- FLUSH USER_STATISTICS
- FLUSH CLIENT_STATISTICS

New SHOW commands:
- SHOW CLIENT_STATISTICS
- SHOW USER_STATISTICS
- SHOW TABLE_STATISTICS
- SHOW INDEX_STATISTICS

New Information schemas:
- CLIENT_STATISTICS
- USER_STATISTICS
- INDEX_STATISTICS
- TABLE_STATISTICS

Added support for all new flush commands to mysqladmin

Added handler::ha_... wrappers for all handler read calls to do statistics counting
- Changed all code to use new ha_... calls
- Count number of read rows, changed rows and rows read trough an index

Added counting of number of bytes sent to binary log (status variable Binlog_bytes_written)
Added counting of access denied errors (status variable Access_denied_erors)

Bugs fixed:
- Fixed bug in add_to_status() and add_diff_to_status() where longlong variables where threated as long
- CLOCK_GETTIME was not propely working on Linuxm

client/mysqladmin.cc:
  Added support for all new flush commmands and some common combinations:
  
  flush-slow-log
  flush-table-statistics
  flush-index-statistics
  flush-user-statistics
  flush-client-statistics
  flush-all-status
  flush-all-statistics
configure.in:
  Added checking if clock_gettime needs the librt.
  (Fixes Bug #37639 clock_gettime is never used/enabled in Linux/Unix)
include/my_sys.h:
  Added my_getcputime()
include/mysql_com.h:
  Added LIST_PROCESS_HOST_LEN & new REFRESH target defines
mysql-test/r/information_schema.result:
  New information schema tables added
mysql-test/r/information_schema_all_engines.result:
  New information schema tables added
mysql-test/r/information_schema_db.result:
  New information schema tables added
mysql-test/r/log_slow.result:
  Added testing that flosh slow query logs is accepted
mysql-test/r/status_user.result:
  Basic testing of user, client, table and index statistics
mysql-test/t/log_slow.test:
  Added testing that flosh slow query logs is accepted
mysql-test/t/status_user-master.opt:
  Ensure that we get a fresh restart before running status_user.test
mysql-test/t/status_user.test:
  Basic testing of user, client, table and index statistics
mysys/my_getsystime.c:
  Added my_getcputime()
  Returns cpu time used by this thread.
sql/authors.h:
  Updated authors to have core and original MySQL developers first.
sql/event_data_objects.cc:
  Updated call to mysql_reset_thd_for_next_command()
sql/event_db_repository.cc:
  Changed to use new ha_... calls
sql/filesort.cc:
  Changed to use new ha_... calls
sql/ha_partition.cc:
  Changed to use new ha_... calls
  Fixed comment syntax
sql/handler.cc:
  Changed to use new ha_... calls
  Reset table statistics
  Added code to update global table and index status
  Added counting of rows changed
sql/handler.h:
  Added table and index statistics variables
  Added function reset_statistics()
  Added handler::ha_... wrappers for all handler read calls to do statistics counting
  Protected all normal read calls to ensure we use the new calls in the server.
  Made ha_partition a friend class so that partition code can call the old read functions
sql/item_subselect.cc:
  Changed to use new ha_... calls
sql/lex.h:
  Added keywords for new information schema tables and flush commands
sql/log.cc:
  Added flush_slow_log()
  Added counting of number of bytes sent to binary log
  Removed not needed test of thd (It's used before, so it's safe to use)
  Added THD object to MYSQL_BIN_LOG::write_cache() to simplify statistics counting
sql/log.h:
  Added new parameter to write_cache()
  Added flush_slow_log() functions.
sql/log_event.cc:
  Updated call to mysql_reset_thd_for_next_command()
  Changed to use new ha_... calls
sql/log_event_old.cc:
  Updated call to mysql_reset_thd_for_next_command()
  Changed to use new ha_... calls
sql/mysql_priv.h:
  Updated call to mysql_reset_thd_for_next_command()
  Added new statistics functions and variables needed by these.
sql/mysqld.cc:
  Added new statistics variables and structures to handle these
  Added new status variables:
  - Com_show_client_statistics, Com_show_index_statistics, Com_show_table_statistics, Com_show_user_statistics
  - Access_denied_errors, Busy_time (clock time), Binlog_bytes_written, Cpu_time, Empty_queries, Rows_set, Rows_read
  Added new option 'userstat' to control if user statistics should be enabled or not
sql/opt_range.cc:
  Changed to use new ha_... calls
sql/opt_range.h:
  Changed to use new ha_... calls
sql/opt_sum.cc:
  Changed to use new ha_... calls
sql/records.cc:
  Changed to use new ha_... calls
sql/set_var.cc:
  Added variable 'userstat'
sql/sp.cc:
  Changed to use new ha_... calls
sql/sql_acl.cc:
  Changed to use new ha_... calls
  Added counting of access_denied_errors
sql/sql_base.cc:
  Added call to statistics functions
sql/sql_class.cc:
  Added usage of org_status_var, to store status variables at start of command
  Added functions THD::update_stats(), THD::update_all_stats()
  Fixed bug in add_to_status() and add_diff_to_status() where longlong variables where threated as long
sql/sql_class.h:
  Added new status variables to status_var
  Moved variables that was not ulong in status_var last.
  Added variables to THD for storing temporary values during statistics counting
sql/sql_connect.cc:
  Variables and functions to calculate user and client statistics
  Added counting of access_denied_errors and lost_connections
sql/sql_cursor.cc:
  Changed to use new ha_... calls
sql/sql_handler.cc:
  Changed to use new ha_... calls
sql/sql_help.cc:
  Changed to use new ha_... calls
sql/sql_insert.cc:
  Changed to use new ha_... calls
sql/sql_lex.h:
  Added SQLCOM_SHOW_USER_STATS, SQLCOM_SHOW_TABLE_STATS, SQLCOM_SHOW_INDEX_STATS, SQLCOM_SHOW_CLIENT_STATS
sql/sql_parse.cc:
  Added handling of:
  - SHOW CLIENT_STATISTICS
  - SHOW USER_STATISTICS
  - SHOW TABLE_STATISTICS
  - SHOW INDEX_STATISTICS
  Added handling of new FLUSH commands:
  - FLUSH SLOW QUERY LOGS
  - FLUSH TABLE_STATISTICS
  - FLUSH INDEX_STATISTICS
  - FLUSH USER_STATISTICS
  - FLUSH CLIENT_STATISTICS
  Added THD parameter to mysql_reset_thd_for_next_command()
  Added initialization and calls to user statistics functions
  Added increment of statistics variables empty_queries, rows_sent and access_denied_errors.
  Added counting of cpu time per query
sql/sql_plugin.cc:
  Changed to use new ha_... calls
sql/sql_prepare.cc:
  Updated call to mysql_reset_thd_for_next_command()
sql/sql_select.cc:
  Changed to use new ha_... calls
  Indentation changes
sql/sql_servers.cc:
  Changed to use new ha_... calls
sql/sql_show.cc:
  Added counting of access denied errors
  Added function for new information schema tables:
  - CLIENT_STATISTICS
  - USER_STATISTICS
  - INDEX_STATISTICS
  - TABLE_STATISTICS
  Changed to use new ha_... calls
sql/sql_table.cc:
  Changed to use new ha_... calls
sql/sql_udf.cc:
  Changed to use new ha_... calls
sql/sql_update.cc:
  Changed to use new ha_... calls
sql/sql_yacc.yy:
  Add new show and flush commands
sql/structs.h:
  Add name_length to KEY to avoid some strlen
  Added cache_name to KEY for fast storage of keyvalue in cache
  Added structs USER_STATS, TABLE_STATS, INDEX_STATS
  Added function prototypes for statistics functions
sql/table.cc:
  Store db+table+index name into keyinfo->cache_name
sql/table.h:
  Added new information schema tables
sql/tztime.cc:
  Changed to use new ha_... calls
2009-10-19 20:14:48 +03:00
Igor Babaev
f7a75b999b The main commit of Andrey Zhakov's patch introducing vurtual(computed) columns.
The original patch has been ameliorated by Sanja and Igor.
2009-10-16 15:57:48 -07:00
unknown
6aad537a6a Merge MySQL 5.1.39 into MariaDB 5.1. 2009-10-15 23:38:29 +02:00
Magnus Blåudd
1ec86b21f9 Bug#47857 strip_sp function in mysys/mf_strip.c never used and cause name clash
- Remove mf_strip.c and the declaration of 'strip_sp'
2009-10-06 13:04:51 +02:00
Michael Widenius
f77e2692dc Added client functions:
- mysql_get_server_name()
  This returns MySQL or MariaDB depending on the server type
- mariadb_connection()
  This returns 1 if you are connected to a MariaDB server

Modifed the MySQL command line client to print out if you are connected to MariaDB or MySQL
Better default prompt (shows server you are connected to and base directory)

client/mysql.cc:
  Print out if you are connected to MariaDB or MySQL
  Better default prompt (shows server you are connected to and base directory)
  Added option \N to prompt to print server name.
configure.in:
  Changed maria to MariaDB in version string
include/mysql.h:
  Added mysql_get_server_name() and mariadb_connection()
include/mysql.h.pp:
  Update for new API functions
libmysql/libmysql.c:
  Added client functions:
  - mysql_get_server_name()
    This returns MySQL or MariaDB depending on the server type
  - mariadb_connection()
    This returns 1 if you are connected to a MariaDB server
2009-10-02 13:36:28 +03:00
Ingo Struewing
4d57b851a0 WL#4259 - Debug Sync Facility
Backport from 6.0 to 5.1.
Only those sync points are included, which are used in debug_sync.test.

  The Debug Sync Facility allows to place synchronization points
  in the code:
  
  open_tables(...)
  
  DEBUG_SYNC(thd, "after_open_tables");
  
  lock_tables(...)
  
  When activated, a sync point can
  
  - Send a signal and/or
  - Wait for a signal
  
  Nomenclature:
  
  - signal:            A value of a global variable that persists
                       until overwritten by a new signal. The global
                       variable can also be seen as a "signal post"
                       or "flag mast". Then the signal is what is
                       attached to the "signal post" or "flag mast".
  
  - send a signal:     Assign the value (the signal) to the global
                       variable ("set a flag") and broadcast a
                       global condition to wake those waiting for
                       a signal.
  
  - wait for a signal: Loop over waiting for the global condition until
                       the global value matches the wait-for signal.
  
  Please find more information in the top comment in debug_sync.cc
  or in the worklog entry.


.bzrignore:
  WL#4259 - Debug Sync Facility
  Added the symbolic link libmysqld/debug_sync.cc.
CMakeLists.txt:
  WL#4259 - Debug Sync Facility
  Added definition for ENABLED_DEBUG_SYNC.
configure.in:
  WL#4259 - Debug Sync Facility
  Added definition for ENABLED_DEBUG_SYNC.
include/my_sys.h:
  WL#4259 - Debug Sync Facility
  Added definition for the DEBUG_SYNC_C macro.
libmysqld/CMakeLists.txt:
  WL#4259 - Debug Sync Facility
  Added sql/debug_sync.cc.
libmysqld/Makefile.am:
  WL#4259 - Debug Sync Facility
  Added sql/debug_sync.cc.
mysql-test/include/have_debug_sync.inc:
  WL#4259 - Debug Sync Facility
  New include file.
mysql-test/mysql-test-run.pl:
  WL#4259 - Debug Sync Facility
  Added option --debug_sync_timeout.
mysql-test/r/debug_sync.result:
  WL#4259 - Debug Sync Facility
  New test result.
mysql-test/r/have_debug_sync.require:
  WL#4259 - Debug Sync Facility
  New require file.
mysql-test/t/debug_sync.test:
  WL#4259 - Debug Sync Facility
  New test file.
mysys/my_static.c:
  WL#4259 - Debug Sync Facility
  Added definition for debug_sync_C_callback_ptr.
mysys/thr_lock.c:
  WL#4259 - Debug Sync Facility
  Added sync point "wait_for_lock".
sql/CMakeLists.txt:
  WL#4259 - Debug Sync Facility
  Added debug_sync.cc and debug_sync.h.
sql/Makefile.am:
  WL#4259 - Debug Sync Facility
  Added debug_sync.cc and debug_sync.h.
sql/debug_sync.cc:
  WL#4259 - Debug Sync Facility
  New source file.
sql/debug_sync.h:
  WL#4259 - Debug Sync Facility
  New header file.
sql/mysqld.cc:
  WL#4259 - Debug Sync Facility
  Added opt_debug_sync_timeout.
  Added calls to debug_sync_init() and debug_sync_end().
  Fixed a purecov comment (unrelated).
sql/set_var.cc:
  WL#4259 - Debug Sync Facility
  Added server variable "debug_sync".
sql/set_var.h:
  WL#4259 - Debug Sync Facility
  Added declaration for server variable "debug_sync".
sql/share/errmsg.txt:
  WL#4259 - Debug Sync Facility
  Added error messages ER_DEBUG_SYNC_TIMEOUT and ER_DEBUG_SYNC_HIT_LIMIT.
sql/sql_base.cc:
  WL#4259 - Debug Sync Facility
  Added sync points "after_flush_unlock" and "before_lock_tables_takes_lock".
sql/sql_class.cc:
  WL#4259 - Debug Sync Facility
  Added initialization for debug_sync_control to THD::THD.
  Added calls to debug_sync_init_thread() and debug_sync_end_thread().
sql/sql_class.h:
  WL#4259 - Debug Sync Facility
  Added element debug_sync_control to THD.
storage/myisam/myisamchk.c:
  Fixed a typo in an error message string (unrelated).
2009-09-29 17:38:40 +02:00
Davi Arnaut
aca9b35ffe Bug#41728: Dropped symbol but no soname change
Restore a stub of the removed mysql_odbc_escape_string function
to fix a ABI breakage. The function was intended to be private
and used only by Connector/ODBC, but, unfortunately, it was exported
as part of the ABI. Nonetheless, only a stub is restored as the
original function is inherently broken and shouldn't be used.

This restoration only applies to MySQL 5.0. This will be addressed
differently in later versions -- reworked library versioning.

include/mysql.h:
  Restore mysql_odbc_escape_string prototype.
include/mysql_h.ic:
  Update ABI check.
libmysql/libmysql.c:
  Restore a mysql_odbc_escape_string stub.
libmysql/libmysql.def:
  Restore mysql_odbc_escape_string.
libmysqld/libmysqld.def:
  Restore mysql_odbc_escape_string.
2009-09-29 09:55:53 -03:00
Staale Smedseng
6a89842e36 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
Staale Smedseng
d6ca0cbb23 Merge from 5.0 2009-09-17 17:25:52 +02:00
Staale Smedseng
e5888b16af Bug #43414 Parenthesis (and other) warnings compiling MySQL
with gcc 4.3.2
      
This is the fifth patch cleaning up more GCC warnings about
variables used before initialized using the new macro
UNINIT_VAR().
2009-09-17 17:10:30 +02:00
Sergey Petrunya
2f93e7cd3f MWL#17: Table elimination: fixes for windows
include/my_global.h:
  MWL#17: Table elimination: fixes for windows
  - Add ALIGN_MAX_UNIT (assume malloc returns data aligned to this much)
mysql-test/r/table_elim.result:
  MWL#17: Table elimination: fixes for windows
  - Use only lower-case as EXPLAIN [EXTENDED] changes case of table names
    on windows
mysql-test/t/table_elim.test:
  MWL#17: Table elimination: fixes for windows
  - Use only lower-case as EXPLAIN [EXTENDED] changes case of table names
    on windows
sql/opt_table_elimination.cc:
  MWL#17: Table elimination: fixes for windows
  - Add extra alignment-padding-space for stack-allocated buffers.
2009-09-16 23:05:03 +04:00
Sergey Petrunya
151e5d586c Merge lp:maria -> lp:~maria-captains/maria/maria-5.1-merge 2009-09-15 14:46:35 +04:00
Alexander Nozdrin
057192abbd Add DBUG_VIOLATION_HELPER_LEAVE definition to non-debug build. 2009-09-10 16:18:54 +04:00
Alexander Nozdrin
70972926ab A patch for Bug#45118 (mysqld.exe crashed in debug mode
on Windows in dbug.c) -- part 2: a patch for the DBUG subsystem
to detect misuse of DBUG_ENTER / DBUG_RETURN macros.
5.1 version.
2009-09-10 11:40:57 +04:00
Sergey Petrunya
29f0dcb563 Merge MySQL->MariaDB
* Finished Monty and Jani's merge
* Some InnoDB tests still fail (because it's old xtradb code run against
  newer testsuite). They are expected to go after mergning with the latest
  xtradb.
2009-09-08 00:50:10 +04:00
Ingo Struewing
540b2dc004 Bug#17332 - changing key_buffer_size on a running server
can crash under load

Backport from 5.1.
Does also include key cache fixes from:
Bug 44068 (RESTORE can disable the MyISAM Key Cache)
Bug 40944 (Backup: crash after myisampack)



include/keycache.h:
  Bug#17332 - changing key_buffer_size on a running server
              can crash under load
  Added KEY_CACHE components in_resize and waiting_for_resize_cnt.
myisam/mi_preload.c:
  Bug#17332 - changing key_buffer_size on a running server
              can crash under load
  Added code to allow LOAD INDEX to load indexes of different block size.
mysys/mf_keycache.c:
  Bug#17332 - changing key_buffer_size on a running server
              can crash under load
  .
  Changed resize_key_cache() to not disable the key cache
  after the flush phase. Changed queue handling to use
  standard functions. Wake all threads waiting on resize_queue.
  We can now have read/write threads waiting there (see below).
  .
  Combined add_to_queue() and the wait loops that were always
  following it to the new function wait_on_queue().
  Combined release_queue() and the condition that was always
  preceding it to the new function release_whole_queue().
  .
  Added code to flag and respect the exceptional situation
  BLOCK_IN_EVICTION.
  .
  Rewrote the resize branch of find_key_block().
  .
  Added code to the eviction handling in find_key_block()
  to catch more exceptional cases.
  .
  Changed key_cache_read(), key_cache_insert() and key_cache_write()
  so that they lock keycache->cache_lock whenever the key cache is
  initialized. Checking for a disabled cache and incrementing and
  decrementing the "resize counter" is always done within the lock.
  Locking and unlocking as well as counting the "resize counter" is
  now done once outside the loop. All three functions can now handle
  a NULL return from find_key_block. This happens in the flush phase
  of a resize and demands direct file I/O. Care is taken for
  secondary requests (PAGE_WAIT_TO_BE_READ) to wait in any case.
  Moved block status changes behind the copying of buffer data.
  key_cache_insert() does now read the block if the caller did
  supply less data than a full cache block.
  key_cache_write() does now take care of parallel running flushes
  (BLOCK_FOR_UPDATE, BLOCK_IN_FLUSHWRITE).
  .
  Changed free_block() to un-initialize block variables in the
  correct order and respect an exceptional BLOCK_IN_EVICTION state.
  .
  Changed flushing to take care for parallel running writes.
  Changed flushing to avoid freeing blocks in eviction.
  Changed flushing to consider that parallel writes can move blocks
  from the file_blocks hash to the changed_blocks hash.
  Changed flushing to take care for other parallel flushes.
  Changed flushing to assure that it ends with everything flushed.
  Optimized normal flush at end of statement (FLUSH_KEEP),
  but let other flush types be stringent.
  .
  Added some comments and debugging statements.
mysys/my_static.c:
  Bug#17332 - changing key_buffer_size on a running server
              can crash under load
  Removed an unused global variable.
sql/ha_myisam.cc:
  Bug#17332 - changing key_buffer_size on a running server
              can crash under load
  Moved an automatic (stack) variable to the scope where it is used.
sql/sql_table.cc:
  Bug#17332 - changing key_buffer_size on a running server
              can crash under load
  Changed TL_READ to TL_READ_NO_INSERT in mysql_preload_keys.
2009-09-07 18:35:37 +02:00
Satya B
33f9066e39 merge mysql-5.0-bugteam to mysql-5.1-bugteam 2009-09-03 17:59:25 +05:30
Satya B
2fc9c5d199 Fix for BUG#46591 - .frm file isn't sync'd with sync_frm enabled for
CREATE TABLE...LIKE...
      
The mysql server option 'sync_frm' is ignored when table is created with 
syntax CREATE TABLE .. LIKE.. 
      
Fixed by adding the MY_SYNC flag and calling my_sync() from my_copy() when
the flag is set.

In mysql_create_table(), when the 'sync_frm' is set, MY_SYNC flag is passed 
to my_copy(). 
      
Note: TestCase is not attached and can be tested manually using debugger.

client/Makefile.am:
  BUG#46591 - .frm file isn't sync'd with sync_frm enabled for 
              CREATE TABLE...LIKE...
      
  add my_sync to sources as it is used in my_copy() method
include/my_sys.h:
  BUG#46591 - .frm file isn't sync'd with sync_frm enabled for 
              CREATE TABLE...LIKE...
      
  MY_SYNC flag is added to call my_sync() method
mysys/my_copy.c:
  BUG#46591 - .frm file isn't sync'd with sync_frm enabled for 
              CREATE TABLE...LIKE...
      
  my_sync() is method is called when MY_SYNC is set in my_copy()
sql/sql_table.cc:
  BUG#46591 - .frm file isn't sync'd with sync_frm enabled for 
              CREATE TABLE...LIKE...
      
  Fixed mysql_create_like_table() to call my_sync() when opt_sync_frm variable
  is set
2009-09-03 16:02:03 +05:30
Sergey Petrunya
d762bf21cc MWL#17: Table-elimination
- Addressing review feedback, generation 4.

include/my_global.h:
  Make ALIGN_PTR's action correspond to that of ALIGN_SIZE
sql/item.cc:
  MWL#17: Table-elimination
  - Review feedback: function renames, better comments
sql/item.h:
  MWL#17: Table-elimination
  - Review feedback: function renames, better comments
sql/item_cmpfunc.cc:
  MWL#17: Table-elimination
  - Review feedback: function renames, better comments
sql/item_subselect.cc:
  MWL#17: Table-elimination
  - Review feedback: function renames, better comments
sql/item_subselect.h:
  MWL#17: Table-elimination
  - Review feedback: function renames, better comments
sql/opt_table_elimination.cc:
  MWL#17: Table-elimination
  - Addressing review feedback, generation 4: abstract everything in case
    we would need to change it for something else in the future.
sql/sql_list.h:
  MWL#17: Table-elimination
  - Introduce exchange_sort(List<T> ...) template function
sql/sql_select.cc:
  MWL#17: Table-elimination
  - Review feedback: function renames, better comments
2009-09-01 00:02:09 +04:00
Staale Smedseng
5be4c38226 Merge from 5.0 for 43414 2009-08-28 18:21:54 +02:00
Staale Smedseng
1ba25ae47c Bug #43414 Parenthesis (and other) warnings compiling MySQL
with gcc 4.3.2
      
This patch fixes a number of GCC warnings about variables used
before initialized. A new macro UNINIT_VAR() is introduced for
use in the variable declaration, and LINT_INIT() usage will be
gradually deprecated. (A workaround is used for g++, pending a
patch for a g++ bug.)
      
GCC warnings for unused results (attribute warn_unused_result)
for a number of system calls (present at least in later
Ubuntus, where the usual void cast trick doesn't work) are
also fixed.


client/mysqlmanager-pwgen.c:
  A fix for warn_unused_result, adding fallback to use of
  srand()/rand() if /dev/random cannot be used. Also actually
  adds calls to rand() in the second branch so that it actually
  creates a random password.
2009-08-28 17:51:31 +02:00
Sergey Vojtovich
24e418df69 Merge mysql-5.1-innodb_plugin to mysql-5.1. 2009-08-11 18:05:25 +05:00
unknown
916f5e1ed8 Merge XtraDB 6 with latest MariaDB 5.1 2009-08-03 22:19:12 +02:00
Ignacio Galarza
09877515f2 Bug#17270 - mysql client tool could not find ../share/charsets folder and fails.
- Define and pass compile time path variables as pre-processor definitions to 
  mimic the makefile build.
- Set new CMake version and policy requirements explicitly.
- Changed DATADIR to MYSQL_DATADIR to avoid conflicting definition in 
  Platform SDK header ObjIdl.h which also defines DATADIR.
2009-07-31 15:22:02 -04:00
Ignacio Galarza
008dd95f70 Auto-merge 2009-07-31 15:28:15 -04:00
V Narayanan
0d61bd9dce Bug#45800 crash when replacing into a merge table and there is a duplicate
A REPLACE in the MERGE engine is actually a REPLACE
into one (FIRST or LAST) of the underlying MyISAM
tables. So in effect the server works on the meta
data of the MERGE table, while the real insert happens
in the MyISAM table.

The MERGE table has no index, while MyISAM has a
unique index. When a REPLACE into a MERGE table (
and the REPLACE conflicts with a duplicate in a
child table) is done, we try to access the duplicate
key information for the MERGE table. This information
actually does not exist, hence this results in a crash.

The problem can be resolved by modifying the MERGE
engine to provide us the duplicate key information
directly, instead of just returning the MyISAM index
number as the error key. Then the SQL layer (or "the
server") does not try to access the key_info of the
MERGE table, which does not exist.

The current patch modifies the MERGE engine to provide
the position for a record where a unique key violation
occurs.

include/myisammrg.h:
  Bug#45800 crash when replacing into a merge table and there is a duplicate
  
  Add a member to the st_mymerge_info structure that will
  store the duplicate key offset in the MERGE table. This
  offset will be the sum of the record offset of the MyISAM
  table within the MERGE table and the offset of the record
  within the MyISAM table.
mysql-test/r/merge.result:
  Bug#45800 crash when replacing into a merge table and there is a duplicate
  
  Result file for the test case.
mysql-test/t/merge.test:
  Bug#45800 crash when replacing into a merge table and there is a duplicate
  
  Added test case for both REPLACE and INSERT...ON DUPLICATE UPDATE.
storage/myisammrg/ha_myisammrg.cc:
  Bug#45800 crash when replacing into a merge table and there is a duplicate
  
  The info method now will process the HA_STATUS_ERRKEY flag
  and will return the index and the offset of the duplicate
  key.
storage/myisammrg/ha_myisammrg.h:
  Bug#45800 crash when replacing into a merge table and there is a duplicate
  
  Set the HA_DUPLICATE_POS flag to indicate that the duplicate
  key information is now available in the MERGE storage engine.
storage/myisammrg/myrg_info.c:
  Bug#45800 crash when replacing into a merge table and there is a duplicate
  
  We modify the myrg_status function to return the position of the
  duplicate key. The duplicate key position in the MERGE table will
  be the MyISAM file_offset and the offset within the MyISAM table
  of the start position of the records.
2009-07-30 16:04:41 +05:30
Satya B
30441aeadf merge 5.0-bugteam to 5.1-bugteam 2009-07-24 12:15:06 +05:30
Satya B
559e2f1c1e merge to mysql-5.0-bugteam 2009-07-24 11:15:31 +05:30
Staale Smedseng
9c708fdf1e Merge from 5.0 2009-07-23 13:53:28 +02:00
Staale Smedseng
1e32574c65 Bug #45770 errors reading server SSL files are printed, but
not logged
        
Errors encountered during initialization of the SSL subsystem
are printed to stderr, rather than to the error log.
        
This patch adds a parameter to several SSL init functions to
report the error (if any) out to the caller. The function
init_ssl() in mysqld.cc is moved after the initialization of
the log subsystem, so that any error messages can be logged to
the error log. Printing of messages to stderr has been 
retained to get diagnostic output in a client context.


include/violite.h:
  Adding an enumeration for the various errors that can
  occur during initialization of the SSL module.
sql/mysqld.cc:
  Adding more logging of SSL init errors, and moving
  init_ssl() till after initialization of logging 
  subsystem.
vio/viosslfactories.c:
  Define error strings, provide an access method for these
  strings, and maintain an error parameter in several funcs
  to return the error (if any) to the caller.
2009-07-23 13:38:11 +02:00
Satya B
342553252f Fix for BUG#18828 - If InnoDB runs out of undo slots,
it returns misleading 'table is full'

Innodb returns a misleading error message "table is full" 
when the number of active concurrent transactions is greater
than 1024.

Fixed by adding errorcode "ER_TOO_MANY_CONCURRENT_TRXS" to the
error codes. Innodb should return HA_TOO_MANY_CONCURRENT_TRXS
to mysql which is then mapped to ER_TOO_MANY_CONCURRENT_TRXS


Note: testcase is not written as this was reproducible only by
      changing innodb code.

extra/perror.c:
  Add error number and message for HA_ERR_TOO_MANY_CONCURRENT_TRXS
include/my_base.h:
  Add error number and message for HA_ERR_TOO_MANY_CONCURRENT_TRXS
sql/ha_innodb.cc:
  Return HA_ERR_TOO_MANY_CONCURRENT_TRXS to mysql server
sql/handler.cc:
  Add error number and message for HA_ERR_TOO_MANY_CONCURRENT_TRXS
sql/share/errmsg.txt:
  Add error message for ER_TOO_MANY_CONCURRENT_TRXS
2009-07-17 14:13:53 +05:30
Georgi Kodinov
473dfa6808 automerge 2009-07-16 10:31:00 +03:00
Georgi Kodinov
45b687c087 Bug #45287: phase 1 : 32 bit compilation warnings
Fixed the following problems:
1. cmake 2.6 warning because of a changed default on
how the dependencies to libraries with a specified 
path are resolved.
Fixed by requiring cmake 2.6.
2. Removed an obsolete pre-NT4 hack including defining
Windows system defines to alter the behavior of windows.h.
3. Disabled warning C4065 on compiling sql_yacc.cc because
of a know incompatibility in some of the newer bison binaries.
2009-07-15 16:46:25 +03:00
Sergey Vojtovich
058cd62565 Merge 5.1-bugteam -> 5.1-innodb_plugin. 2009-07-14 15:06:04 +05:00
Alexey Kopytov
5398b3ef2b Automerge. 2009-07-12 20:56:43 +06:00
Alexey Kopytov
2b26729ece Bug #45796: invalid memory reads and writes when altering merge
and base tables 

myrg_attach_children() could reuse a buffer that was allocated 
previously based on a definition of a child table. The problem 
was that the child's definition might have been changed, so 
reusing the buffer could lead to crashes or valgrind errors 
under some circumstances. 
 
Fixed by changing myrg_attach_children() so that the 
rec_per_key_part buffer is reused only when the child table
have not changed, and reallocated otherwise (the old buffer is 
deallocated if necessary).


include/myisammrg.h:
  Added a pointer to need_compat_check as an argument to
  myrg_attach_children().
mysql-test/r/merge.result:
  Added a test case for bug #45796.
mysql-test/t/merge.test:
  Added a test case for bug #45796.
storage/myisammrg/ha_myisammrg.cc:
  Pass a pointer to need_compat_check to myrg_attach_children().
storage/myisammrg/myrg_open.c:
  Changed myrg_attach_children() so that the 
  rec_per_key_part buffer is reused only when the child table
  have not changed, and reallocated otherwise (the old buffer 
  is deallocated if necessary).
2009-07-10 17:34:03 +06:00
Staale Smedseng
ab2f3dd2a2 Bug #43397 mysql headers redefine pthread_mutex_init
unnecessarily
      
The problem is that libmysqlclient.so is built with THREAD
undefined, while a client compiling against the same header
files will see THREAD as defined and definitions in
my_pthread.h will be included, possibly resulting in undefined
symbols that cannot be resolved with libmysqlclient.so.
      
The suggested solution is to require that clients wanting to
link with libmysqlclient.so should be built with
MYSQL_CLIENT_NO_THREADS defined. This requires a documentation
change, and more details for this will be supplied if this
patch is approved.
      
The MYSQL_CLIENT_NO_THREADS define was renamed from
UNDEF_THREADS_HACK, to get a more suitable (less suspicious)
name for the define. (The UNDEF_THREADS_HACK is retained for
backwards compatibility, though.)
      
This patch is also in anticipation of WL#4958, which will
remove this problem altogether by dropping the building of
libmysqlclient.
2009-07-08 16:49:45 +02:00
Georgi Kodinov
097c7b38c8 Bug #45287: phase 2 : 5.0 64 bit compilation warnings
Fixed various compilation warnings when compiling on a 
 64 bit windows.
2009-07-16 15:37:38 +03:00
Michael Widenius
9db357e2bf Added MY_CS_NONASCII marker for character sets that are not compatible with latin1 for characters 0x00-0x7f
This allows us to skip and speed up some very common character converts that MySQL is doing when sending data to the client
and this gives us a nice speed increase for most queries that uses only characters in the range 0x00-0x7f.

This code is based on Alexander Barkov's code that he has done in MySQL 6.0


include/m_ctype.h:
  Added MY_CS_NONASCII marker
libmysqld/lib_sql.cc:
  Added function net_store_data(...) that takes to and from CHARSET_INFO * as arguments
mysys/charset.c:
  Mark character sets with MY_CS_NONASCII
scripts/mysql_install_db.sh:
  Fixed messages to refer to MariaDB instead of MySQL
sql/protocol.cc:
  Added function net_store_data(...) that takes to and from CHARSET_INFO * as arguments
sql/protocol.h:
  Added function net_store_data(...) that takes to and from CHARSET_INFO * as arguments
sql/sql_string.cc:
  Quicker copy of strings with no characters above 0x7f
strings/conf_to_src.c:
  Added printing of MY_CS_NONASCII
strings/ctype-extra.c:
  Mark incompatible character sets with MY_CS_NONASCII
  Removed duplicated character set geostd
strings/ctype-sjis.c:
  Mark incompatible character sets with MY_CS_NONASCII
strings/ctype-uca.c:
  Mark incompatible character sets with MY_CS_NONASCII
strings/ctype-ucs2.c:
  Mark incompatible character sets with MY_CS_NONASCII
strings/ctype-utf8.c:
  Mark incompatible character sets with MY_CS_NONASCII
strings/ctype.c:
  Added function to check if character set is compatible with latin1 in ranges 0x00-0x7f
2009-07-02 13:15:33 +03:00
Michael Widenius
f1183fc160 Changed default thread stack to 288K to get better memory missalignment between stacks of different threads (should speed up things) and to get a bit extra safety.
In maria_open(), don't allocate big arrays on stack as this may lead to stack overflow.
This fixes a valgrind warning detected by buildbot

include/my_pthread.h:
  Changed default thread stack to 288K to get better memory missalignment between stacks of different threads (should speed up things) and to get a bit extra safety.
storage/maria/ma_open.c:
  In maria_open(), don't allocate big arrays on stack as this may lead to stack overflow.
2009-06-30 15:01:29 +03:00
Michael Widenius
bb55791994 Added some changes inspired by Zardosht Kasheff:
- Added a handler call (prepare_index_scan()) to inform storage engines that an index scan is about to take place.
- Extended the maximun key parts for an index from 16 to 32
- Extended MyISAM and Maria engines to support up to 32 parts

Added checks for return value from ha_index_init()



include/my_handler.h:
  Extended number of key parts for MyISAM and Maria from 16 to 32
include/my_pthread.h:
  Ensure we always have 256M of stack.
  (Required to be able to handle the current number of keys and key parts in MyISAM)
mysql-test/r/create.result:
  Extended to test for 32 key parts
mysql-test/r/myisam.result:
  Test that we can create 32 but not 33 key parts
mysql-test/r/ps_1general.result:
  Length of ref is now 2048 as we can have more key parts
mysql-test/r/ps_2myisam.result:
  Length of ref is now 2048 as we can have more key parts
mysql-test/r/ps_3innodb.result:
  Length of ref is now 2048 as we can have more key parts
mysql-test/r/ps_4heap.result:
  Length of ref is now 2048 as we can have more key parts
mysql-test/r/ps_5merge.result:
  Length of ref is now 2048 as we can have more key parts
mysql-test/suite/maria/r/maria.result:
  Max key length is now 1208 bytes
mysql-test/suite/maria/r/maria3.result:
  Max key length is now 1208 bytes
mysql-test/suite/maria/r/ps_maria.result:
  Max key length is now 1208 byte
mysql-test/t/create.test:
  Extended to test for 32 key parts
mysql-test/t/myisam.test:
  Test that we can create 32 but not 33 key parts
sql/handler.cc:
  Check return value from ha_index_init()
sql/handler.h:
  Added a handler call (prepare_index_scan()) to inform storage engines that an index scan is about to take place.
sql/sql_select.cc:
  Checks all return values from ha_index_init()
  Call prepare_index_scan()) to inform storage engines that an index scan is about to take place.
  Fixed indentation
sql/table.cc:
  Fixed wrong types for key_length (rest of code assumed this was 32 bit)
sql/unireg.h:
  Extended the maximun key parts for an index from 16 to 32
storage/maria/ha_maria.cc:
  Don't allocate HA_CHECK on the stack in functions where we call repair() as HA_CHECK is HUGE and will overflow stack
storage/myisam/ha_myisam.cc:
  Don't allocate HA_CHECK on the stack in functions where we call repair() as HA_CHECK is HUGE and will overflow stack
storage/myisam/mi_check.c:
  Fixed wrong check if value overflow
tests/mysql_client_test.c:
  Added fflush() to fix output in case of error
  Fixed wrong check of 'ref' length in EXPLAIN
2009-06-30 00:03:30 +03:00
V Narayanan
4662631f1d merging with mysql-5.0-bugteam 2009-06-19 17:58:46 +05:30
V Narayanan
336c810618 Bug#43572 Handle failures from hash_init
Failure to allocate memory for the hash->array element,
caused hash_init to return without initializing the other
members of the hash. Thus although the dynamic array
buffer may be allocated at a later point in the code, the
incompletely initialized hash caused fatal failures.

This patch moves the initialization of the other members
of the hash above the array allocation, so that the usage
of this hash will not result in fatal failures.

include/hash.h:
  Bug#43572 Handle failures from hash_init
  
  hash_inited is used to verify that the hash is
  valid. After the change induced by the current
  patch hash->array.buffer !=0 is not a valid check
  for this condition, since, the dynamic array can
  be allocated even at a later time. Bootstrap SQL
  script is setting some variables, which are
  actually not set due to this hash_inited issue.
  Thus we get empty grant tables.
  
  A better way to check if the hash is valid is
  to verify that hash->blength is greater than 0.
mysys/hash.c:
  Bug#43572 Handle failures from hash_init
  
  Move the initialization of the other members
  of the hash above the array allocation, so that
  the usage of this hash will not result in fatal
  failures.
2009-06-19 17:29:21 +05:30
unknown
f835970430 Cherry-pick revid:psergey@askmonty.org-20090608135546-ut1yrzbah4gdw6e6
from Sergey's table-elimination branch to get a clean Valgrind.
2009-06-15 13:01:35 +02:00
unknown
4b2aafb35c Merge of Percona XtraDB into MariaDB. 2009-06-11 19:49:51 +02:00
unknown
93bcda598b Merge latest XtraDB from lp:percona-xtradb into MariaDB.
include/my_sys.h:
  Move generic file parsing functions out to shared code, as they are used in several places.
mysys/mf_iocache2.c:
  Move generic file parsing functions out to shared code, as they are used in several places.
sql/log_event.cc:
  Fix XtraDB build with embedded server.
  XtraDB needs access to replication stuff, which is missing in embedded server.
  Solved by defining wrapper function for this which is compiled differently for normal and
  embedded case.
sql/log_event.h:
  Fix XtraDB build with embedded server.
  XtraDB needs access to replication stuff, which is missing in embedded server.
  Solved by defining wrapper function for this which is compiled differently for normal and
  embedded case.
sql/slave.cc:
  Move generic file parsing functions out to shared code, as they are used in several places.
2009-06-11 14:53:26 +02:00
unknown
d2d7b5bbb6 Fix XtraDB to build with atomic operations, for good performance.
The root of the problem is that ./configure mixed together two different things. One is the
availability of GCC atomic operation intrinsics. The other is the selection of which
primitives to use for my_atomic implementation.

Then at some point a hack was made to not use GCC intrinsics in my_atomic to work around
some test failures. But because the two things are mixed in ./configure, this as a side
effect also makes GCC intrinsics unavailable for XtraDB.

Fixed by splitting this in two in configure, so that we have HAVE_GCC_ATOMIC_BUILTINS for
GCC intrinsics availability and MY_ATOMIC_MODE_GCC_BUILTINS for use in my_atomic.
2009-06-10 11:13:53 +02:00
Vladislav Vaintroub
768bbae90e Backport WL#3653 to 5.1 to enable bundled innodb plugin.
Remove custom DLL loader code from innodb plugin code, use 
symbols exported from mysqld.


storage/innodb_plugin/handler/ha_innodb.cc:
  Remove a Win32 workaround for current_thd.
  The original  problem that innodb plugin used
  value of TLS variable across DLL boundaries is 
  solved in MySQL server (current_thd is a function
  not TLS variable now)
storage/innodb_plugin/handler/handler0alter.cc:
  Remove custom delay loader
storage/innodb_plugin/handler/handler0vars.h:
  Remove custom delay loader
storage/innodb_plugin/handler/i_s.cc:
  Remove custom delay loader
storage/innodb_plugin/handler/win_delay_loader.cc:
  Remove custom delay loader
storage/innodb_plugin/plug.in:
  Remove commented out MYSQL_PLUGIN_STATIC, 
  CMake would not parse that correctly
2009-06-10 10:59:49 +02:00
Georgi Kodinov
898443572f Bug #45286: compilation warnings on mysql-5.0-bugteam on MacOSX
Merged the 5.0 fix to 5.1 and fixed the 5.1 specific warnings.
2009-06-05 16:44:38 +03:00
Davi Arnaut
92e2fa7f17 MySQL 5.0 backport of Chad Miller's patch for Bug#34309:
Bug#34309: '_PC' macro redefinition

For reasons that are now a mystery, we had defined a CPP symbol to
help ancient compilers work better (in some way that's lost to history).
This interferes with at least one modern compiler.

Now, don't define the _PC symbol.  Those other underscore-leading
symbols are suspect also, but at least the names aren't inscrutable.
Let's leave them for now.
2009-05-30 12:38:36 -03:00
Sergey Glukhov
d31b6e4784 Bug#43940 64-bit windows myisamchk doesn't support key_buffer_size > 4G
The fix is to allow myisamchk to use >4G key_buffer_size on win64


include/myisam.h:
  use ulonglong instead of ulong for use_buffers
storage/myisam/myisamchk.c:
  use ulonglong instead of ulong for use_buffers
2009-05-27 13:11:28 +05: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
MySQL Build Team
b243283e69 Updates to build with community features enabled for community builds. 2009-05-20 23:04:34 +02: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
Chad MILLER
767501a9b1 Merge community up to enterprise, thus ending the community-server
adventure.
2009-05-06 09:06:32 -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
Davi Arnaut
6bee08c61d Merge from 5.0-pe-stage into main. 2009-05-05 20:41:58 +02:00
Vadim Tkachenko
f4ae92b2af sync rev 59 2009-05-03 21:32:30 -07:00
Vadim Tkachenko
54b69cac0e disable split_buffer_pool_mutex 2009-05-03 19:45:47 -07:00
MySQL Build Team
d64c0e1675 A few portability tweaks for Netware, SCO and QNX 2009-05-01 19:35:04 +02:00
Vadim Tkachenko
cd180bc222 sync to extension rev 58 2009-04-26 21:54:14 -07:00
Vadim Tkachenko
103e0fb90a sync to extension rev 55 2009-04-25 13:20:52 -07: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
Chad MILLER
14f923c028 Merge 5.0.80 release and 5.0 community. Version left at 5.0.80. 2009-04-14 13:20:13 -04:00
Davi Arnaut
b27261a6f7 Bug#44164: TL_WRITE has no description in lock_descriptions[]
The problem was that new lock types were being added without a
corresponding description. Since the lock types (enum values)
are used as indices to the description array, the descriptions
could be shifted depending on the lock type. The solution is to
ensure that every lock type has a correspondent description.

include/thr_lock.h:
  Add warning.
sql/sql_test.cc:
  Update lock descriptions.
2009-04-14 14:05:32 +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
Vadim Tkachenko
fee8858e13 added innodb_overwrite_relay_log_info.patch 2009-04-07 13:51:15 -07:00
Vadim Tkachenko
a992bf5adc added innodb_overwrite_relay_log_info.patch 2009-04-07 13:43:03 -07:00
Jonathan Perkin
0e531e8bb9 Apply http://lists.mysql.com/commits/70427 to fix Win32 builds with VS 2005. 2009-04-02 13:17:38 +02:00
Timothy Smith
8e0dca5be8 merge -5.0 into -5.1 (minor conflicts resolved) 2009-04-01 23:19:04 -06:00
Timothy Smith
ccbd4c0451 auto-merge -build into -bugteam 2009-04-01 22:02:04 -06:00
Guilhem Bichot
c71aae73f6 merge of 5.1-main into 5.1-maria. MyISAM changes are propagated to Maria except
those of davi.arnaut@sun.com-20090219210935-9vilvcisyyieffxl (TODO).
2009-04-01 11:34:52 +02:00
Joerg Bruehe
7bb4fe0959 Merge the main tree into 5.0-build 2009-03-30 15:42:04 +02:00
Vadim Tkachenko
107072563d porting to 1.0.3 2009-03-25 23:11:11 -07:00
Ignacio Galarza
e5ca171e2e Correct failing archive test. 2009-03-25 14:59:48 -04:00
Alexey Kopytov
4ee0f6a64c Automerge. 2009-03-25 16:19:53 +03:00
Alexey Kopytov
c4eba1edc1 Manual merge. 2009-03-25 15:48:29 +03:00
Alexey Kopytov
bbe24f03f2 Fix for bug #42965: isinf() on 32bit x86 with gcc 4.3 can
produce incorrect results for ROUND() 

Added a workaround and a configure check to test whether 
isinf() is affected by the GCC bug #39228. 
       
Since no code in MySQL server is currently affected by that 
bug, the patch is actually a safeguard for possible future 
code modifications. No test cases or changelog entries are 
needed. 


configure.in:
  Added a configure check to test whether isinf() is safe to use
  in C code.
include/my_global.h:
  Added a workaround for GCC bug #39228.
2009-03-24 11:26:22 +03:00
Michael Widenius
46db8aac44 Apply patch by Antony Dovgal:
- Move SAFE_MUTEX to be stored in config.h by configure.in (not as a flag used with compiler command line)
- Generate my_config.h in configure

BUILD/SETUP.sh:
  Remove -DSAFE_MUTEX as the following --with-debug flag will automaticly add it
BUILD/compile-ia64-debug-max:
  Remove -DSAFE_MUTEX as the following --with-debug flag will automaticly add it
configure.in:
  Move SAFE_MUTEX and SAFE_MALLOC to [my_] config.h
  Generate my_config.h as part of configure process
dbug/dbug.c:
  Include my_global.h before we undef SAFE_MUTEX
include/Makefile.am:
  Update comment. For now, lets generate my_config.h if someone deletes it after configure
mysys/my_wincond.c:
  Include my_global.h before we undef SAFE_MUTEX
mysys/my_winthread.c:
  Include my_global.h before we undef SAFE_MUTEX
2009-03-22 14:16:09 +02:00
Michael Widenius
4dc093cee4 Avoid compiler warnings on windows
include/config-win.h:
  Added missing typedef ssize_t
  Added some other useful defines from MySQL 6.0
unittest/mysys/waiting_threads-t.c:
  Fixed link failure for 'ftruncate' on Windows
2009-03-20 13:41:30 +02:00
Georgi Kodinov
07d3da54fc reverting a bogus fix into 5.1-bugteam 2009-03-20 13:18:29 +02:00
Chad MILLER
738d964e67 Merge contributed automake changes, and 5.1 upstream. 2009-03-19 16:18:10 -04:00
unknown
150b0850b3 cmd-line-utils/libedit/readline/readline.h
- Header <sys/ttydefaults.h> missing or not usable on QNX and OpenServer 6

include/my_global.h
 - Moved down definition of function rint(), as for some platforms (in
   this case Netware) 'longlong' is not defined until later in
   "my_global.h"
2009-03-19 16:40:54 +01:00
Ignacio Galarza
675c3ce2bb auto-merge 2009-03-19 09:44:58 -04:00
Ignacio Galarza
1aefa8029f auto-merge 2009-03-19 09:42:36 -04:00
Chad MILLER
9bdcb6ba6e Copy include/config.h to include/my_config.h at configure-time. Also,
continue to update it at make-time.

One shouldn't need to run "make" on server source to get the stuff we say
plugins should use.
2009-03-19 09:37:30 -04:00
Michael Widenius
4c83c570ed Added mariadb and mariadb-version as my.conf option tags
Fixed compiler error when configuring without --lib-event

include/mysql_version.h.in:
  Added mariadb-'version' as a my.cnf option tag for mysqld
sql/mysqld.cc:
  Added mariadb and mariadb-version as my.conf option tags
2009-03-18 04:14:22 +02:00
Ignacio Galarza
0d588edf61 auto-merge 2009-03-17 16:29:24 -04:00
Alexey Kopytov
15baa13f84 Manual merge of patch for bug #40552 into the team tree.
Replaced a call to load_defaults() in sql_plugin.cc with 
its thread-safe version.
2009-03-16 13:37:13 +03:00
Michael Widenius
4fe3425009 Added "pool-of-threads" handling (with libevent)
This is a backport of code from MySQL 6.0 with cleanups and extensions

The following new options are supported
configure options:
  --with-libevent                  ; Enable use of libevent, which is needed for pool of threads

mysqld options:
--thread-handling=pool-of-threads  ; Use a pool of threads to handle queries
--thread-pool-size=#               ; Define how many threads should be created to handle all queries
--extra-port=#                     ; Extra tcp port that uses the old one-thread-per-connection method
--extra-max-connections=#          ; Number of connections to accept to 'extra-port'
--test-ignore-wrong-options        ; Ignore setting an enum value to a wrong option (for mysql-test-run)



BUILD/SETUP.sh:
  Added libevents (and thus pool-of-threads) to max builds
CMakeLists.txt:
  Added libevent
Makefile.am:
  Added libevents
config/ac-macros/libevent.m4:
  Libevent code for configure
config/ac-macros/libevent_configure.m4:
  Libevent code for configure
configure.in:
  Added libevents
dbug/dbug.c:
  Added _db_is_pushed(); Needed for pool-of-threads code
extra/Makefile.am:
  Added libevents
extra/libevent:
  Libevent initial code
extra/libevent/CMakeLists.txt:
  Libevent initial code
extra/libevent/Makefile.am:
  Libevent initial code
extra/libevent/README:
  Libevent initial code
extra/libevent/WIN32-Code:
  Libevent initial code
extra/libevent/WIN32-Code/config.h:
  Libevent initial code
extra/libevent/WIN32-Code/misc.c:
  Libevent initial code
extra/libevent/WIN32-Code/misc.h:
  Libevent initial code
extra/libevent/WIN32-Code/tree.h:
  Libevent initial code
extra/libevent/WIN32-Code/win32.c:
  Libevent initial code
extra/libevent/buffer.c:
  Libevent initial code
extra/libevent/compat:
  Libevent initial code
extra/libevent/compat/sys:
  Libevent initial code
extra/libevent/compat/sys/_time.h:
  Libevent initial code
extra/libevent/compat/sys/queue.h:
  Libevent initial code
extra/libevent/compat/sys/tree.h:
  Libevent initial code
extra/libevent/devpoll.c:
  Libevent initial code
extra/libevent/epoll.c:
  Libevent initial code
extra/libevent/epoll_sub.c:
  Libevent initial code
extra/libevent/evbuffer.c:
  Libevent initial code
extra/libevent/evdns.c:
  Libevent initial code
extra/libevent/evdns.h:
  Libevent initial code
extra/libevent/event-config.h:
  Libevent initial code
extra/libevent/event-internal.h:
  Libevent initial code
extra/libevent/event.c:
  Libevent initial code
extra/libevent/event.h:
  Libevent initial code
extra/libevent/event_tagging.c:
  Libevent initial code
extra/libevent/evhttp.h:
  Libevent initial code
extra/libevent/evport.c:
  Libevent initial code
extra/libevent/evrpc-internal.h:
  Libevent initial code
extra/libevent/evrpc.c:
  Libevent initial code
extra/libevent/evrpc.h:
  Libevent initial code
extra/libevent/evsignal.h:
  Libevent initial code
extra/libevent/evutil.c:
  Libevent initial code
extra/libevent/evutil.h:
  Libevent initial code
extra/libevent/http-internal.h:
  Libevent initial code
extra/libevent/http.c:
  Libevent initial code
extra/libevent/kqueue.c:
  Libevent initial code
extra/libevent/log.c:
  Libevent initial code
extra/libevent/log.h:
  Libevent initial code
extra/libevent/min_heap.h:
  Libevent initial code
extra/libevent/poll.c:
  Libevent initial code
extra/libevent/select.c:
  Libevent initial code
extra/libevent/signal.c:
  Libevent initial code
extra/libevent/strlcpy-internal.h:
  Libevent initial code
extra/libevent/strlcpy.c:
  Libevent initial code
include/config-win.h:
  Libevent support
include/my_dbug.h:
  ADded _db_is_pushed
include/mysql.h.pp:
  Update to handle new prototypes
include/typelib.h:
  Split find_type_or_exit() into two functions
include/violite.h:
  Added vio_is_pending()
libmysqld/Makefile.am:
  Added libevent
mysql-test/include/have_pool_of_threads.inc:
  Added test for pool-of-threads
mysql-test/mysql-test-run.pl:
  Don't abort based on time and don't retry test cases when run under --gdb or --debug
mysql-test/r/crash_commit_before.result:
  USE GLOBAL for debug variable
mysql-test/r/have_pool_of_threads.require:
  Added test for pool-of-threads
mysql-test/r/pool_of_threads.result:
  Added test for pool-of-threads
mysql-test/r/subselect_debug.result:
  USE GLOBAL for debug variable
mysql-test/t/crash_commit_before.test:
  USE GLOBAL for debug variable
mysql-test/t/merge-big.test:
  USE GLOBAL for debug variable
mysql-test/t/pool_of_threads-master.opt:
  Added test for pool-of-threads
mysql-test/t/pool_of_threads.test:
  Added test for pool-of-threads
mysys/typelib.c:
  Split find_type_or_exit() into find_type_with_warning()
sql/Makefile.am:
  Added libevent
sql/handler.cc:
  Indentation fix.
  Fixed memory loss bug
  Fixed crash on exit when handler plugin failed
sql/mysql_priv.h:
  Added extra_max_connections and mysqld_extra_port
  Added extern functions from sql_connect.cc
sql/mysqld.cc:
  Added support for new mysqld options
  Added code for 'extra-port' and 'extra-max-connections'
  Split some functions into smaller pieces to be able to reuse code
  Added code for test-ignore-wrong-options
sql/scheduler.cc:
  Updated schduler code from MySQL 6.0
sql/scheduler.h:
  Updated schduler code from MySQL 6.0
sql/set_var.cc:
  Added support for changing "extra_max_connections"
sql/sql_class.cc:
  Iniitalize thread schduler options in THD
sql/sql_class.h:
  Added to extra_port and scheduler to 'THD'
sql/sql_connect.cc:
  Use thd->schduler to check number of connections and terminate connection
  Made some local functions global (for scheduler.cc)
vio/viosocket.c:
  Added 'vio_pending', needed for scheduler..c
2009-03-13 00:27:35 +02:00
Georgi Kodinov
f79cb0de91 merge of bug 42434 to 5.1-bugteam 2009-03-11 18:13:42 +02:00
Guilhem Bichot
b0fcbc84ef merge of 5.1-main into 5.1-maria; MyISAM changes are also ported to Maria. 2009-03-11 16:32:42 +01:00
Georgi Kodinov
3033ea85a2 Bug #42434: license of mysys MD5 implementation is not GPL-compatible
Took the Xfree implementation (based on the same rewrite as the NDB one)
and added it instead of the current implementation.
Added a macro to make the calls to MD5 more streamlined. 

client/mysqlmanager-pwgen.c:
  Bug #42434: changed to call the macro
include/my_md5.h:
  Bug #42434: use the Xfree implementation
mysys/md5.c:
  Bug #42434: use the Xfree implementation
sql/item_strfunc.cc:
  Bug #42434: changed to call the macro
sql/table.cc:
  Bug #42434: changed to call the macro
tools/mysqlmanager.c:
  Bug #42434: changed to call the macro
2009-03-09 20:57:03 +02:00
He Zhenxing
5229ef4ac8 Merge BUG#22082 from 5.0-bugteam to 5.1-bugteam 2009-03-06 17:38:14 +08:00
He Zhenxing
82fc35475c BUG#22082 Slave hangs(holds mutex) on "disk full"
When disk is full, server may waiting for free space while
writing binlog, relay-log or MyISAM tables. The server will 
continue after user have freed some space. But the error
message printed was not quite clear about the how often the
error message is printed, and there will be a delay before
the server continue and user freeing space. And caused users
thinking that the server was hanging forever.

This patch fixed the problem by making the error messages
printed more clear. The error message is split into two part,
the first part will only be printed once, and the second part
will be printed very 10 times.

Message first part:
Disk is full writing '<filename>' (Errcode: <errorno>). Waiting
for someone to free space... (Expect up to 60 secs delay for 
server to continue after freeing disk space)

Message second part:
Retry in 60 secs, Message reprinted in 600 secs
2009-03-06 17:32:00 +08:00
Alexey Kopytov
f7cf8e57c1 Fix for bug #40552: Race condition around default_directories
in load_defaults() 

load_defaults(), my_search_option_files() and 
my_print_default_files()  utilized a global variable 
containing  a pointer to thread local memory. This could lead 
to race conditions when those functions were called with high 
concurrency. 

Fixed by changing the interface of the said functions to avoid 
the necessity for using a global variable.

Since we cannot change load_defaults() prototype for API
compatibility reasons, it was renamed my_load_defaults().
Now load_defaults() is a thread-unsafe wrapper around
a thread-safe version, my_load_defaults().


mysys/default.c:
  1. Added a thread-safe version of load_defaults(), changed
  load_defaults() with the old interface to be a thread-unsafe
  wrapper around the thread-safe version.
  2. Always use a private MEM_ROOT in my_print_default_files, 
  don't use a global variable.
sql-common/client.c:
  Use a thread-safe version of load_defaults().
2009-02-27 11:26:06 +02:00
Alexey Kopytov
cfa529fc3f Automerge. 2009-02-25 10:49:02 +02:00
Alexey Kopytov
318f23c712 Automerge. 2009-02-25 10:39:28 +02:00
Alexey Kopytov
0f6e7f1176 Fixed a build failure on Ubuntu 8.10 introduced by the patch
for bug #15936.

On some platforms fenv.h may #undef the min/max macros
defined in my_global.h.

Fixed by moving the #include directive for fenv.h from
mysqld.cc to my_global.h before definitions for min/max.

include/my_global.h:
  Moved #include <fenv.h> from mysqld.cc.
sql/mysqld.cc:
  Moved #include <fenv.h> to my_global.h.
2009-02-25 10:36:11 +02:00
Vadim Tkachenko
08c7189cba sync rev46 2009-02-24 08:52:40 -08:00
Alexey Kopytov
315748a41d Automerge. 2009-02-25 10:48:05 +02:00
Alexey Botchkov
a34bb2b8d8 merging. 2009-02-24 15:29:49 +04:00
Chad MILLER
e2eed1c5ce Merge bug 39370 fix from bug tree. 2009-02-24 12:31:42 +02:00
Chad MILLER
00aa5ad58a Bug#39370: wrong output for error code 153
Add all HA error numbers and descriptions to perror.

Add reminder to header.

This is already fixed in smarter ways in future codebases, and this 
codebase is unlikely to change, since new development is forbidden
here.
2009-02-24 12:05:37 +02:00
Alexey Kopytov
8ae8162403 Manual merge to 5.1. 2009-02-23 14:42:31 +02:00
Alexey Kopytov
0e62c9aa63 Fix for bug #15936: "round" differs on Windows to Unix
Both of our own implementations of rint(3) were inconsistent with the
most common behavior of rint() on those platforms that have it: round
to nearest, break ties by rounding to nearest even.

Fixed by leaving just one implementation of rint() in our source tree,
and changing its behavior to match the most common native
implementations on other platforms.

configure.in:
  Added checks for fenv.h and fesetround().
include/config-win.h:
  Removed the incorrect implementation of rint() for Windows.
include/my_global.h:
  Added an rint() implementation for platforms that do not have it.
mysql-test/r/func_math.result:
  Added a test case for bug #15936.
mysql-test/t/func_math.test:
  Added a test case for bug #15936.
sql/mysqld.cc:
  Explicitly set the FPU rounding mode with fesetround().
2009-02-23 14:28:26 +02:00
Michael Widenius
945fa0d913 Merge with mysql-maria tree
mysql-test/t/variables.test:
  Reset delay_key_write, otherwise maria.maria test may fail
sql/set_var.cc:
  Reset ha_open_options if one resets the delay_key_write variable.
  Before there was no way to reset it without restarting mysqld, which caused some tests to fail
2009-02-19 11:01:25 +02:00
Michael Widenius
a8fdaa6f2c Merge with base MySQL 5.1
Contains fixes for test cases
Changed release tag to beta

configure.in:
  change release tag to beta
2009-02-15 12:58:34 +02:00
Ignacio Galarza
5b7347bda3 Bug#29125 Windows Server X64: so many compiler warnings
- Remove bothersome warning messages.  This change focuses on the warnings 
that are covered by the ignore file: support-files/compiler_warnings.supp.
- Strings are guaranteed to be max uint in length
2009-02-13 11:41:47 -05:00
Guilhem Bichot
998b4ae52d Merge of MyISAM changes done in 5.1-main, into Maria 2009-02-12 18:51:00 +01:00
Guilhem Bichot
b90ff5340f Fixing problems of previous 5.1-main->5.1-maria merge:
- adding back Serg's "mtr --list-options"
- safe_mutex deadlock detector started raising wrong deadlock warnings, fixed
here by a backport from 6.0-main.

include/my_pthread.h:
  Porting changes done to 6.0-main which satisfy the safe_mutex deadlock detector (those
  in 5.1-main don't), see chad@mysql.com-20090126155607-n0j3zbmgbfepnmmo for explanations
mysql-test/mysql-test-run.pl:
  adding back Serg's --list-options
mysys/my_init.c:
  Porting changes done to 6.0-main which satisfy the safe_mutex deadlock detector (those
  in 5.1-main don't), see chad@mysql.com-20090126155607-n0j3zbmgbfepnmmo for explanations
mysys/my_thr_init.c:
  Porting changes done to 6.0-main which satisfy the safe_mutex deadlock detector (those
  in 5.1-main don't), see chad@mysql.com-20090126155607-n0j3zbmgbfepnmmo for explanations
2009-02-12 16:27:33 +01:00
Guilhem Bichot
704b4845aa merge of 5.1-main into 5.1-maria. Myisam->Maria change propagation will follow.
There were so many changes into mtr (this is the new mtr coming) that I rather
copied mtr from 6.0-main here (at least this one knows how to run Maria tests).
I also fixed suite/maria tests to be accepted by the new mtr.

mysys/thr_mutex.c:
  adding DBUG_PRINT here, so that we can locate where the warning is issued.
2009-02-12 15:08:56 +01:00
Ignacio Galarza
54fbbf9591 Bug#29125 Windows Server X64: so many compiler warnings
- Remove bothersome warning messages.  This change focuses on the warnings 
that are covered by the ignore file: support-files/compiler_warnings.supp.
- Strings are guaranteed to be max uint in length
2009-02-10 17:47:54 -05:00
Chad MILLER
52db1b8153 Merge from bugteam team tree. 2009-02-10 10:07:54 -05:00
Alexey Botchkov
aa964b7913 merging 2009-02-05 10:33:06 +04:00
Alexey Botchkov
9036f1aa97 Bug#37995 Error message truncation in test "innodb" in embedded mode.
code backported from 6.0


per-file messages:
  include/my_global.h
    Remove SC_MAXWIDTH. This is unused and irrelevant nowadays.
  include/my_sys.h
    Remove errbuf declaration and unused definitions.
  mysys/my_error.c
    Remove errbuf definition and move and adjust ERRMSGSIZE.
  mysys/my_init.c
    Declare buffer on the stack and use my_snprintf.
  mysys/safemalloc.c
    Use size explicitly. It's more than enough for the message at hand.
  sql/sql_error.cc
    Use size explicitly. It's more than enough for the message at hand.
  sql/sql_parse.cc
    Declare buffer on the stack. Use my_snprintf as it will result in
    less stack space being used than by a system provided sprintf --
    this allows us to put the buffer on the stack without causing much
    trouble. Also, the use of errbuff here was not thread-safe as the
    function can be entered concurrently from multiple threads.
  sql/sql_table.cc
    Use MYSQL_ERRMSG_SIZE. Extra space is not needed as my_snprintf will
    nul terminate strings.
  storage/myisam/ha_myisam.cc
Use MYSQL_ERRMSG_SIZE.
  sql/share/errmsg.txt
    Error message truncation in test "innodb" in embedded mode
    filename in the error message can safely take up to 210 symbols.
2009-02-05 10:16:00 +04:00
Davi Arnaut
c9dc936a2b Bug#40536: SELECT is blocked by INSERT DELAYED waiting on
upgrading lock, even with low_priority_updates

The problem is that there is no mechanism to control whether a
delayed insert takes a high or low priority lock on a table.

The solution is to modify the delayed insert thread ("handler")
to take into account the global value of low_priority_updates
when taking table locks. The value of low_priority_updates is
retrieved when the insert delayed thread is created and will
remain the same for the duration of the thread.


include/thr_lock.h:
  Update prototype.
mysql-test/r/delayed.result:
  Add test case result for Bug#40536
mysql-test/t/delayed.test:
  Add test case for Bug#40536
mysys/thr_lock.c:
  Add function parameter which specifies the write lock type.
sql/sql_insert.cc:
  Take a low priority write lock if global value of low_priority_updates
  was ON when the thread was created.
2009-02-03 15:16:24 -02:00
Vadim Tkachenko
4ba507eff5 sync with rev41 extensions 2009-02-02 08:44:52 -08:00
Michael Widenius
37db97b0e2 Merge with mysql-maria
Changed _ma_ft_convert_to_ft2() to my_bool

storage/maria/ma_ft_update.c:
  Changed _ma_ft_convert_to_ft2() to my_bool
storage/maria/ma_fulltext.h:
  Changed _ma_ft_convert_to_ft2() to my_bool
storage/maria/ma_write.c:
  Manual merge
  Changed _ma_ft_convert_to_ft2() to my_bool
2009-01-30 23:55:42 +02:00
Georgi Kodinov
87eb2cb938 merged 5.1-main -> 5.1-bugteam 2009-01-30 15:44:49 +02:00
Vadim Tkachenko
0a073efd1a sync with rev40 extensions-1.0 2009-01-29 08:54:13 -08:00
Chad MILLER
0d2fecc977 Bug#34309: '_PC' macro redefinition
For reasons that are now a mystery, we had defined a CPP symbol to
help ancient compilers work better (in some way that's lost to history).
This interferes with at least one modern compiler.

Now, don't define the _PC symbol.  Those other underscore-leading
symbols are suspect also, but at least the names aren't inscrutable.
Let's leave them for now.
2009-01-27 09:43:55 -05:00
Ramil Kalimullin
80fe6268f7 Fix for bug #37756: enabling fulltext indexes with
myisam_repair_threads > 1 causes crash

Problem: parallel repair (myisam_repair_threads > 1) of a myisam
table with two or more fulltext keys that use the same parser may
lead to a server crash. ALTER TABLE ENABLE KEYS is affected as well.

Fix: properly initialize fulltext structures for parallel repair.

Note: 1. there's no deterministic test case.
2. now we call parser->init() for each fulltext key
(not for each fulltext parser used).


storage/myisam/ft_parser.c:
  Fix for bug #37756: enabling fulltext indexes with
    myisam_repair_threads > 1 causes crash
  
  In ftparser_call_initializer() we "group" parsers
  and allocate parameters for each unique parser used.
  In case of parallel repairing we may have a bunch
  of parsers that use the only MI_INFO structure.
  Each of these parsers must have its own parameter
  structure in order not to interfere with others.
  
  Moreover, the allocation is done without mutex
  lock so parallel ftparser_call_initializer() calls
  are unsafe.
  
  Now we don't "group" the fulltext parsers.
  Parameter allocation code moved to ftparser_alloc_param()
  function which is called from mi_repair_parallel() as well
  to allocate parameters for each parser used.
storage/myisam/ftdefs.h:
  Fix for bug #37756: enabling fulltext indexes with
    myisam_repair_threads > 1 causes crash
  
  ftparser_alloc_param(MI_INFO *info) added.
storage/myisam/mi_check.c:
  Fix for bug #37756: enabling fulltext indexes with
    myisam_repair_threads > 1 causes crash
  
  ftparser_alloc_param(info) called in case of parallel
  repair to allocate fulltext parser parameters.
storage/myisam/mi_open.c:
  Fix for bug #37756: enabling fulltext indexes with
    myisam_repair_threads > 1 causes crash
  
  set keyinfo->ftkey_nr and share->ftkeys.
2009-01-26 10:35:15 +04:00
Luis Soares
df8543868d merge: 5.1 -> 5.1-rpl
conflicts:
  Text conflict in client/mysqltest.cc
  Text conflict in mysql-test/include/wait_until_connected_again.inc
  Text conflict in mysql-test/lib/mtr_report.pm
  Text conflict in mysql-test/mysql-test-run.pl
  Text conflict in mysql-test/r/events_bugs.result
  Text conflict in mysql-test/r/log_state.result
  Text conflict in mysql-test/r/myisam_data_pointer_size_func.result
  Text conflict in mysql-test/r/mysqlcheck.result
  Text conflict in mysql-test/r/query_cache.result
  Text conflict in mysql-test/r/status.result
  Text conflict in mysql-test/suite/binlog/r/binlog_index.result
  Text conflict in mysql-test/suite/binlog/r/binlog_innodb.result
  Text conflict in mysql-test/suite/rpl/r/rpl_packet.result
  Text conflict in mysql-test/suite/rpl/t/rpl_packet.test
  Text conflict in mysql-test/t/disabled.def
  Text conflict in mysql-test/t/events_bugs.test
  Text conflict in mysql-test/t/log_state.test
  Text conflict in mysql-test/t/myisam_data_pointer_size_func.test
  Text conflict in mysql-test/t/mysqlcheck.test
  Text conflict in mysql-test/t/query_cache.test
  Text conflict in mysql-test/t/rpl_init_slave_func.test
  Text conflict in mysql-test/t/status.test
2009-01-23 13:22:05 +01:00
Chad MILLER
d3629d7489 Merge from Tim's 5.0.76-release tree to make 5.0.77 . 2009-01-21 13:45:23 -05:00
Sergei Golubchik
9aa2ada9d0 compilation fixes 2009-01-19 16:27:49 +01:00
Vadim Tkachenko
ec1ed62c1d sync rev31 extensions 2009-01-15 19:47:30 -08:00
Sergei Golubchik
9c96fde120 post-review fixes
include/atomic/generic-msvc.h:
  prevent possible compiler warnings
include/lf.h:
  comments, better definition for LF_HASH_OVERHEAD
include/maria.h:
  define MARIA_CANNOT_ROLLBACK here
include/my_pthread.h:
  avoid possible name clash
include/waiting_threads.h:
  comments, const, move WT_RESOURCE to waiting_threads.c
mysql-test/suite/maria/r/maria_notembedded.result:
  new test
mysql-test/suite/maria/t/maria_notembedded.test:
  new test - 5-way deadlock
mysys/lf_hash.c:
  better definition for LF_HASH_OVERHEAD
mysys/my_static.c:
  comment
mysys/my_thr_init.c:
  casts
mysys/waiting_threads.c:
  comments, asserts, etc
server-tools/instance-manager/parse.cc:
  fix my_init_dynamic_array() to follow new calling conventions
sql/mysqld.cc:
  call wt_init after set_proper_floating_point_mode
sql/sql_class.h:
  comment
storage/maria/ha_maria.cc:
  move MARIA_CANNOT_ROLLBACK to a common header
storage/maria/ma_commit.c:
  comment
storage/maria/ma_write.c:
  comments, check for HA_ERR_FOUND_DUPP_KEY
storage/maria/trnman.c:
  comments, assert
storage/maria/trnman.h:
  comments
storage/maria/unittest/trnman-t.c:
  be paranoid
unittest/mysys/lf-t.c:
  comments
unittest/mysys/waiting_threads-t.c:
  comments, safety, memory leak
2009-01-15 22:27:36 +01:00
Timothy Smith
2cfe32ae42 Fix Bug#32831: libmysql should be built with all charsets
Add #define HAVE_CHARSET_name in config-win.h for all character sets that MySQL
supports.  Add comments to config/ac-macros/character_sets.m4 and config-win.h
so hopefully they will be updated in sync.
2009-01-13 16:16:03 +01:00
Vadim Tkachenko
2387a1caed sync with extensions rev29 2009-01-12 15:30:38 -08:00
Michael Widenius
dd5b9fc6cd Merge with base MySQL-5.1-maria 2009-01-12 13:12:00 +02:00
Luis Soares
b2cdc3b6cb merge: 5.1 -> 5.1-rpl
conflicts:
  Text conflict in mysql-test/lib/mtr_report.pm
  Text conflict in mysql-test/mysql-test-run.pl
2009-01-08 19:03:56 +00:00
Sergei Golubchik
c45bf1b3cc Bug#40990 Maria: failure of maria.test & maria_notemebedded in deadlock detection
detect a case when a blocker has removed itself and signalled after the condition timed out
but before it (cond_wait) acquired the mutex back
2009-01-07 21:50:11 +01:00
Georgi Kodinov
f97ef7a40e merged 5.1-main -> 5.1-bugteam 2009-01-05 18:10:20 +02:00
Vadim Tkachenko
7d8db4709d sync with extensions rev 23 2008-12-23 20:45:02 -08:00
Sergey Glukhov
f42b9ad93f 5.0-bugteam->5.1-bugteam merge 2008-12-23 18:21:01 +04:00
Sergey Glukhov
c06df92af6 Bug#37575 UCASE fails on monthname
The MONTHNAME/DAYNAME functions
returns binary string, so the LOWER/UPPER functions
are not effective on the result of MONTHNAME/DAYNAME call.  
Character set of the MONTHNAME/DAYNAME function
result has been changed to connection character set.


include/m_ctype.h:
  added my_charset_repertoire function
mysql-test/r/ctype_ucs.result:
  test result
mysql-test/r/func_time.result:
  test result
mysql-test/t/ctype_ucs.test:
  test case
mysql-test/t/func_time.test:
  test case
sql/item_timefunc.cc:
  Item_func_monthname::fix_length_and_dec and
  Item_func_dayname::fix_length_and_dec methods have been
  modified to use connection character set
sql/item_timefunc.h:
  Item_func_monthname::fix_length_and_dec and
  Item_func_dayname::fix_length_and_dec methods have been
  modified to use connection character set
sql/mysql_priv.h:
  added max_month_name_length, max_day_name_length fields into MY_LOCALE struct
sql/mysqld.cc:
  The test_lc_time_sz function controls modifications
  of the locale database in debugging mode.
sql/sql_locale.cc:
  initialization of max_month_name_length, max_day_name_length fields
strings/ctype.c:
  added my_charset_repertoire function
2008-12-23 18:08:04 +04:00
Chad MILLER
926e5f6694 Merged from 5.0 (enterprise). 2008-12-17 15:01:34 -05:00
Vadim Tkachenko
b00b32c766 sync with extensions rev18 2008-12-16 14:32:47 -08:00
Alfranio Correia
19f859a27e merge 5.1 --> 5.1-rpl 2008-12-13 19:42:12 +00:00
Vadim Tkachenko
b4924e24b1 Sync optimistic_margine_count 2008-12-11 22:11:18 -08:00
Vadim Tkachenko
b89957b3d7 real sync with patches rev12 2008-12-10 20:55:47 -08:00
Vadim Tkachenko
82785bdbee sync with patches rev12 2008-12-10 20:55:10 -08:00
Joerg Bruehe
2181c95918 Merge main 5.1 into 5.1-build 2008-12-10 21:14:50 +01:00
Guilhem Bichot
926aaf4635 Merge of 5.1-main into 5.1-maria. There were no changes to storage/myisam, mysys/mf_keycache.c, mysql-test/t/*myisam*
since previous merge. MARIA_PAGECACHE_READS in maria-preload.test are down a little bit (5%), which must be a good
side-effect of some sql/ change.
2008-12-10 10:02:25 +01:00
Vadim Tkachenko
ac2d1da340 sync with patches rev10 2008-12-08 17:05:40 -08:00
Alexey Kopytov
ebff4ea3a9 Pull from mysql-5.1-bugteam. 2008-12-08 15:19:08 +03:00
Alexey Kopytov
6aa4125be3 Merge from mysql-5.0-bugteam to mysql-5.1-bugteam. 2008-12-07 17:51:22 +03:00
Vadim Tkachenko
8f3b5ebdb0 Sync with patches commit rev 8 2008-12-06 15:40:43 -08:00
Vladislav Vaintroub
8f500c522b Bug#38522: 5 seconds delay when closing application using embedded server
The problem here is that embedded server starts handle_thread manager 
thread  on mysql_library_init() does not stop it on mysql_library_end().
At shutdown, my_thread_global_end() waits for thread count to become 0,
but since we did not stop the thread it will give up after 5 seconds.
             
Solution is to move shutdown for handle_manager thread from kill_server()
(mysqld specific) to clean_up() that is used by both embedded and mysqld.
            
This patch also contains some refactorings - to avoid duplicate code,
start_handle_manager() and stop_handle_manager() functions are introduced.
Unused variables are eliminated. handle_manager does not rely on global
variable abort_loop anymore to stop (abort_loop is not set for embedded).
            
Note: Specifically on Windows and when using DBUG version of libmysqld, 
the complete solution requires removing obsolete code my_thread_init() 
from my_thread_var(). This has a side effect that a DBUG statement 
after my_thread_end() can cause thread counter to be incremented, and 
embedded will hang for some seconds. Or worse, my_thread_init() will 
crash if critical sections have been deleted by the global cleanup 
routine that runs in a different thread. 

This patch also fixes and revert prior changes for Bug#38293 
"Libmysqld crash in mysql_library_init if language file missing".

Root cause of the crash observed in Bug#38293  was bug in my_thread_init() 
described above




client/mysql.cc:
  sql_protocol_typelib is not exported from libmysqld
  (does not make sense either)
  thus excluded from embedded client
dbug/dbug.c:
  revert changes for Bug#38293
include/my_dbug.h:
  revert changes for Bug#38293
libmysql/libmysql.c:
  Removed DBUG_POP call, because when called after my_end(), will access
  THR_key_mysys that is already deleted. The result of pthread_get_specific
  is not predictable in this case and hence DBUG_POP can crash.
libmysqld/examples/CMakeLists.txt:
  Revert changes for Bug#38293.
libmysqld/lib_sql.cc:
  code to start handle manager is factored out into 
  start_handle_manager() function
libmysqld/libmysqld.def:
  Revert changes for Bug #38293
  Remove excessive exports from libmysqld, export what API documents.
mysys/my_thr_init.c:
  Remove windows-DLL-specific workaround for something (old code, no documentation for
  what specifically). The problem is that even after my_thread_end() is finished, 
  DBUG statement can initiate my_thread_init(). This does not happen anywhere else and 
  should not happen on  Windows either.
sql/mysql_priv.h:
  - new functions start_handle_manager() and stop_handle_manager()
  - move manager_thread_in_use  variable to sql_manager.cc and made
  it static
  - remove manager_status, as it is unused
sql/mysqld.cc:
  Code to start/stop handle_manager thread is factored out into start_handle_manager()
2008-12-04 19:41:53 +01:00
Vadim Tkachenko
bf05180b97 innodb_io_patches.patch merged 2008-12-04 09:38:09 -08:00
Alexey Kopytov
91f0c94c23 Fix for bug #27483: Casting 'scientific notation type' to 'unsigned
bigint' fails on windows.

Visual Studio does not take into account some x86 hardware limitations
which leads to incorrect results when converting large DOUBLE values
to BIGINT UNSIGNED ones.

Fixed by adding a workaround for double->ulonglong conversion on
Windows.


include/config-win.h:
  Added double2ulonglong(double) function implementing a workaround for
  broken double->ulonglong conversion on Windows/x86.
include/my_global.h:
  Define double2ulonglong() as a simple typecast for anything but
  Windows.
mysql-test/r/type_float.result:
  Added a test case for bug #27483.
mysql-test/t/type_float.test:
  Added a test case for bug #27483.
2008-12-03 19:15:39 +03:00
Vadim Tkachenko
2ed4d6349d 1.0.2 version imported 2008-12-02 21:06:00 -08:00
Michael Widenius
fb68158856 Merge with base MySQL-5.1-maria 2008-12-03 06:07:50 +02:00
Michael Widenius
32f81bab7d WL#3262 add mutex lock order checking to safemutex (also called safe_mutex_deadlock_detector)
This writes a warning on stderr if one uses mutex in different order,
like if one in one case would lock mutex in the order A,B and in another case
would lock mutex in the order B,A
This is inspired by and loosely based on the LOCKDEP patch by Jonas
Wrong mutex order is either fixed or mutex are marked with MYF_NO_DEADLOCK_DETECTION
if used inconsistently (need to be fixed by server team)

KNOWN_BUGS.txt:
  Added information that one need to dump and restore Maria tables
include/hash.h:
  Added prototype function for walking over all elements in a hash
include/my_pthread.h:
  Added my_pthread_mutex_init() and my_pthread_mutex_lock(); These should be used if one wants to disable mutex order checking.
  Changed names of the nonposix mutex_init functions to not conflict with my_phread_mutex_init()
  Added and extended structures for mutex deadlock detection.
  New arguments to sage_mutex_init() and safe_mutex_lock() to allow one to disable mutex order checking.
  Added variable 'safe_mutex_deadlock_detector' to enable/disable deadlock detection for all pthread_mutex_init()
mysys/Makefile.am:
  Added cleaning of test files
  Added test_thr_mutex
mysys/hash.c:
  Added hash_iterate() to iterate over all elements in a hash
  More comments
mysys/my_init.c:
  Added calls to destory all mutex uses by mysys()
  Added waiting for threads to end before calling TERMINATE() to list not freed memory
mysys/my_pthread.c:
  Changed names to free my_pthread_mutex_init() for mutex-lock-order-checking
mysys/my_sleep.c:
  Fixed too long wait if using 1000000L as argument
mysys/my_thr_init.c:
  Mark THR_LOCK_threads and THR_LOCK_malloc to not have mutex deadlock detection.
  (We can't have it enabled for this as these are internal mutex used by the detector  
  Call my_thread_init() early as we need thread specific variables enabled for the following pthread_mutex_init()
  Move code to wait for threads to end to my_wait_for_other_threads_to_die()
  Don't destroy mutex and conditions unless all threads have died
  Added my_thread_destroy_mutex() to destroy all mutex used by the mysys thread system
  Name the thread specific mutex as "mysys_var->mutex"
  Added my_thread_var_mutex_in_use() to return pointer to mutex in use or 0 if thread variables are not initialized
mysys/mysys_priv.h:
  Added prototypes for functions used internally with mutex-wrong-usage detection
mysys/thr_mutex.c:
  Added runtime detection of mutex used in conflicting order
  See WL#3262 or test_thr_mutex.c for examples
  The base idea is for each mutex have two hashes:
  - mutex->locked_mutex points to all mutex used after this one
  - mutex->used_mutex points to all mutex which has this mutex in it's mutex->locked_mutex
  There is a wrong mutex order if any mutex currently locked before this mutex is in the mutex->locked_mutex hash
sql/event_queue.cc:
  Mark mutex used inconsistently (need to be fixed by server team)
sql/event_scheduler.cc:
  Declare the right order to take the mutex
sql/events.cc:
  Mark mutex used inconsistently (need to be fixed by server team)
sql/ha_ndbcluster_binlog.cc:
  Mark mutex used inconsistently (need to be fixed by server team)
sql/log.cc:
  Mark mutex used inconsistently (need to be fixed by server team)
sql/mysqld.cc:
  Use pthread_mutex_trylock instead of pthread_mutex_unlock() when sending kill signal to thread
  This is needed to avoid wrong mutex order as normally one takes 'current_mutex' before mysys_var->mutex.
  Added call to free sp cache.
  Add destruction of LOCK_server_started and COND_server_started.
  Added register_mutex_order() function to register in which order mutex should be taken
  (to initiailize mutex_deadlock_detector).
  Added option to turn off safe_mutex_deadlock_detector
sql/protocol.cc:
  Fixed wrong argument to DBUG_PRINT (found by valgrind)
sql/rpl_mi.cc:
  Mark mutex used inconsistently (need to be fixed by server team)
sql/set_var.cc:
  Remove wrong locking of LOCK_global_system_variables when reading and setting log variables
  (would cause inconsistent mutex order).
  Update global variables outside of logger.unlock() as LOCK_global_system_variables has to be taken before logger locks
  Reviewed by gluh
sql/sp_cache.cc:
  Added function to destroy mutex used by sp cache
sql/sp_cache.h:
  Added function to destroy mutex used by sp cache
sql/sql_class.cc:
  Use pthread_mutex_trylock instead of pthread_mutex_unlock() when sending kill signal to thread
  This is needed to avoid wrong mutex order as normally one takes 'current_mutex' before mysys_var->mutex.
  Register order in which LOCK_delete and mysys_var->mutex is taken
sql/sql_insert.cc:
  Give a name for Delayed_insert::mutex
  Mark mutex used inconsistently (need to be fixed by server team)
  Move closing of tables outside of di->mutex (to avoid wrong mutex order)
sql/sql_show.cc:
  Don't keep LOCK_global_system_variables locked over value->show_type() as this leads to wrong mutex order
storage/innobase/handler/ha_innodb.cc:
  Disable safe_muted_deadlock_detector for innobase intern mutex (to speed up page cache initialization)
storage/maria/ha_maria.cc:
  Added flag to ha_maria::info() to signal if we need to lock table share or not.
  This is needed to avoid locking mutex in wrong order
storage/maria/ha_maria.h:
  Added flag to ha_maria::info() to signal if we need to lock table share or not.
storage/maria/ma_close.c:
  Destroy key_del_lock
  Simplify freeing ftparser_param
storage/maria/ma_key.c:
  Better comment
storage/maria/ma_loghandler.c:
  Mark mutex used inconsistently (need to be fixed by sanja)
storage/maria/ma_state.c:
  More comments
storage/maria/ma_test1.c:
  Ensure that safe_mutex_deadlock_detector is always on (should be, this is just for safety)
storage/maria/ma_test2.c:
  Ensure that safe_mutex_deadlock_detector is always on (should be, this is just for safety)
2008-12-03 00:02:52 +02:00
Vadim Tkachenko
84f733afa7 rw_locks applied 2008-11-30 22:47:37 -08:00
Vadim Tkachenko
d6c7789c34 Initial import of InnoDB-plugin 1.0.1 source tree 2008-11-30 22:10:29 -08:00
unknown
96e0bf50d9 Merge from mysql-5.1.30-release 2008-11-27 00:02:10 +01:00
Guilhem Bichot
33b194c36e Merge of 5.1-main into 5.1-maria. There were no changes to storage/myisam, or mysql-test/t/*myisam*.
However there were three new tests mysql-test/suite/parts/t/partition*myisam.test, of which I make here
copies for Maria.
2008-11-21 15:21:50 +01:00
Alexey Botchkov
9ac2f96015 merging 2008-11-19 14:01:21 +04:00
Alexey Botchkov
4d3f05b09b Bug#38293 Libmysqld crash in mysql_library_init if language file missing
That's a Win-specific error.
    When we create libmysqld.dll we have many libraries like mysys, dbug,
    strings, etc linked into that dll, so the application built upon
    this library shouldn't link these libraries to itself, rather use
    those inside the dll.

    Fixed by redirecting calls into the libmysqld.dll

per-file comments:
  dbug/dbug.c
Bug#38293 Libmysqld crash in mysql_library_init if language file missing
    fake _db_something definitions added

  include/my_dbug.h
Bug#38293 Libmysqld crash in mysql_library_init if language file missing
  fake _db_something declarations added

  libmysqld/examples/CMakeLists.txt
Bug#38293 Libmysqld crash in mysql_library_init if language file missing
    superfluous libraries removed from linking

  libmysqld/libmysqld.def
Bug#38293 Libmysqld crash in mysql_library_init if language file missing
    set of mysys functions added to the export section
2008-11-19 13:57:23 +04:00
Alexey Botchkov
2512923c56 merging 2008-11-19 13:29:45 +04:00
Andrei Elkin
ca2d184695 merging 5.1 -> 5.1 rpl. 3 of 4 conflicts are resolved similarly to 6.0->6.0-rpl merging.
mysql_upgrade results changed due to the error messesge of mysqlcheck has changed.
2008-11-12 19:51:47 +02:00
Build Team
e85fe79430 Added "Sun Microsystems, Inc." to copyright headers on files modified
since Oct 1st
2008-11-10 21:21:49 +01:00
Build Team
2639b27d27 Added the default configure COMMUNITY_SERVER and ENABLED_PROFILING to
the Windows configuration file "include/config-win.h".
2008-11-09 03:14:35 +01:00
Sergei Golubchik
8a655c6042 comment
include/waiting_threads.h:
  comment with a deadlock example
2008-11-04 14:09:32 +01:00