Commit graph

169 commits

Author SHA1 Message Date
Sergei Golubchik
4f435bddfd 5.3 merge 2012-01-13 15:50:02 +01:00
Michael Widenius
e6f5fc1c02 Fixed lp:909051 Options --debug and --disable-debug are known but ambiguous in RelWithDebInfo build
Fixed memory leak printing when doing 'mysqld --version', 'mysqld --debug --help' and 'mysqld --debug --help --verbose'


mysys/my_init.c:
  Moved checking if we should call DBUG_END() before my_thread_end() as otherwise we will not free DBUG variables and files.
mysys/thr_lock.c:
  Fixed compiler warning
sql/mysqld.cc:
  Fixed memory leaks when using mysqld --help and mysqld --version
  Added --debug as an option that works for all builds. For non debug builds we now get a warning.
strings/dtoa.c:
  Fixed valgrind warning (c could contain data outside of the given string)
2011-12-27 20:55:21 +02:00
Michael Widenius
6d4224a31c Merge with 5.2.
no_error handling for select (used by INSERT ... SELECT) still needs to be fixed, but I will do that in a separate commit
2011-12-11 11:34:44 +02:00
Sergei Golubchik
c753bedcb1 win64 sysvar portability fixes 2011-12-02 19:49:05 +01:00
Michael Widenius
6920457142 Merge with MariaDB 5.1 2011-11-24 18:48:58 +02:00
Sergei Golubchik
d2755a2c9c 5.3->5.5 merge 2011-11-22 18:04:38 +01:00
Michael Widenius
a8d03ab235 Initail merge with MySQL 5.1 (XtraDB still needs to be merged)
Fixed up copyright messages.
2011-11-21 19:13:14 +02:00
Sergei Golubchik
0e007344ea mysql-5.5.18 merge 2011-11-03 19:17:05 +01:00
Sergei Golubchik
76f0b94bb0 merge with 5.3
sql/sql_insert.cc:
  CREATE ... IF NOT EXISTS may do nothing, but
  it is still not a failure. don't forget to my_ok it.
  ******
  CREATE ... IF NOT EXISTS may do nothing, but
  it is still not a failure. don't forget to my_ok it.
sql/sql_table.cc:
  small cleanup
  ******
  small cleanup
2011-10-19 21:45:18 +02:00
unknown
b152c4c71d Merge 5.2->5.3 2011-09-02 15:10:10 +03:00
Michael Widenius
31c8c95bb2 Added logging of all errors from my_read/my_write/my_pread/my_pwrite/my_open & my_malloc to mysqld error log if one sets log-warning to 10 or 11
The idea is that my_global_flags is ored to the MyFlags parameter for the above functions if the MY_WME flag is not set.
As the my_global_flags has ME_JUST_INFO (mark error as 'note') and possible ME_NOREFRESH (write error to log) this will force mysqld to log the not critical error to the log as a note.


 

include/my_sys.h:
  Moved MY_SYNC_DIR to ensure it never clashes with ME_JUST_INFO
  Added my_global_flags
mysql-test/Makefile.am:
  Removed not used bugs directory
mysys/my_init.c:
  Added my_global_flags, a variable that is ored to MyFlags in a those mysys functions we want extra logging.
mysys/my_malloc.c:
  Added support for my_global_flags
mysys/my_open.c:
  Added support for my_global_flags
mysys/my_pread.c:
  Added support for my_global_flags
mysys/my_read.c:
  Added support for my_global_flags
mysys/my_static.c:
  Added my_global_flags
mysys/my_write.c:
  Added support for my_global_flags
sql/mysqld.cc:
  Set my_global_flags for warning levels 10 & 11
sql/sql_base.cc:
  Don't increment unhandled errors for notes or warnings.
2011-09-02 01:22:34 +03:00
Jon Olav Hauglid
aee88a4cc6 Bug#12779790 COMPILATION FAILS OS X 10.7 - IMPLICIT DECLARATION OF
FUNCTION 'PTHREAD_INIT' 

The problem was that compilation would fail with a warning:
Implicit declaration of function 'pthread_init' if MySQL was
compiled on OS X 10.7 (Lion). The reason was that pthread_init()
is now part of an internal OS X pthread library so it was found
by CMake.

This patch fixes the problem by removing HAVE_PTHREAD_INIT and
related code. pthread_init() was specific to MIT-pthreads which
has not been supported since 4.1 and was therefore no longer
relevant.

No test case added.
2011-07-21 17:45:38 +02:00
Sergei Golubchik
a844635637 use PSI wrappers in aria and other non-MySQL code 2011-07-13 21:10:18 +02:00
Sergei Golubchik
49501b4ccb fix memory leaks and other problems found by safemalloc
client/mysql_upgrade.c:
  missing DBUG_RETURN
client/mysqladmin.cc:
  client plugin memory wasn't freed
client/mysqlcheck.c:
  client plugin memory, defaults, a result set, a command-line option value were not freed.
  missing DBUG_RETURN.
client/mysqldump.c:
  client plugin memory wasn't freed
client/mysqlslap.c:
  client plugin memory wasn't freed
client/mysqltest.cc:
  hopeless. cannot be fixed.
mysql-test/valgrind.supp:
  Bug#56666 is now fixed.
mysys/array.c:
  really, don't allocate if the caller didn't ask to.
mysys/my_init.c:
  safemalloc checks must be done at the very end
mysys/my_thr_init.c:
  not needed anymore
sql-common/client.c:
  memory leak
sql/log.cc:
  log_file was not closed, memory leak.
sql/mysqld.cc:
  fix bug#56666 (causing many P_S related memory leaks).
  close_active_mi() not called for --bootstrap, memory leak.
sql/sql_lex.cc:
  redo Lex->mi handling
sql/sql_lex.h:
  redo Lex->mi handling
sql/sql_plugin.cc:
  plugins having PLUGIN_VAR_MEMALLOC string variables have this variables allocated in every THD.
  The memory was freed in ~THD but only if plugin was still active. If plugin was unloaded the
  variable was not found and the memory was lost. By loading and unloading plugins an arbitrary
  amount of memory can be lost.
sql/sql_repl.cc:
  redo Lex->mi handling
sql/sql_yacc.yy:
  completely wrong handling of Lex->mi - run-time memory leak, by repeating the statement
  arbitrary amount of memory can be lost.
  
  Lex->mi.repl_ignore_server_ids_opt was allocated when parsing CHANGE MASTER,
  and freed after executing the statement. if parser failed on syntax (or another)
  error the statement was never executed. Lex->mi was simply bzero-ed for the next
  CHANGE MASTER  statement.
sql/table.cc:
  didn't compile
storage/perfschema/pfs_lock.h:
  Bug#56666 is fixed
2011-07-10 20:09:17 +02:00
Vladislav Vaintroub
f9cb1467b8 merge Windows performance patches into 5.3 2011-07-05 21:46:53 +02:00
Sergei Golubchik
9809f05199 5.5-merge 2011-07-02 22:08:51 +02:00
Kent Boortz
68f00a5686 Updated/added copyright headers 2011-06-30 17:37:13 +02:00
Kent Boortz
44135d4725 Updated/added copyright headers 2011-06-30 17:31:31 +02:00
Vladislav Vaintroub
4171483b53 Backport Fix for Bug#24509 - 2048 file descriptor limit on windows needs increasing.
The patch replaces the use of the POSIX I/O interfaces in mysys on Windows with 
the Win32 API calls (CreateFile, WriteFile, etc). The Windows HANDLE for the open
 file is stored in the my_file_info struct, along with a flag for append mode 
(because the Windows API does not support opening files in append mode in all cases)
The default max open files has been increased to 16384 and can be increased further
by setting --max-open-files=<value> during the server start.

Noteworthy benefit of this patch is that it removes limits from the table_cache size - 
allowing for more simultaneus users
2011-06-12 15:52:07 +02:00
Michael Widenius
f197991f41 Merge with 5.1-microseconds
A lot of small fixes and new test cases.

client/mysqlbinlog.cc:
  Cast removed
client/mysqltest.cc:
  Added missing DBUG_RETURN
include/my_pthread.h:
  set_timespec_time_nsec() now only takes one argument
mysql-test/t/date_formats.test:
  Remove --disable_ps_protocl as now also ps supports microseconds
mysys/my_uuid.c:
  Changed to use my_interval_timer() instead of my_getsystime()
mysys/waiting_threads.c:
  Changed to use my_hrtime()
sql/field.h:
  Added bool special_const_compare() for fields that may convert values before compare (like year)
sql/field_conv.cc:
  Added test to get optimal copying of identical temporal values.
sql/item.cc:
  Return that item_int is equal if it's positive, even if unsigned flag is different.
  Fixed Item_cache_str::save_in_field() to have identical null check as other similar functions
  Added proper NULL check to Item_cache_int::save_in_field()
sql/item_cmpfunc.cc:
  Don't call convert_constant_item() if there is nothing that is worth converting.
  Simplified test when years should be converted
sql/item_sum.cc:
  Mark cache values in Item_sum_hybrid as not constants to ensure they are not replaced by other cache values in compare_datetime()
sql/item_timefunc.cc:
  Changed sec_to_time() to take a my_decimal argument to ensure we don't loose any sub seconds.
  Added Item_temporal_func::get_time() (This simplifies some things)
sql/mysql_priv.h:
  Added Lazy_string_decimal()
sql/mysqld.cc:
  Added my_decimal constants max_seconds_for_time_type, time_second_part_factor
sql/table.cc:
  Changed expr_arena to be of type CONVENTIONAL_EXECUTION to ensure that we don't loose any items that are created by fix_fields()
sql/tztime.cc:
  TIME_to_gmt_sec() now sets *in_dst_time_gap in case of errors
  This is needed to be able to detect if timestamp is 0
storage/maria/lockman.c:
  Changed from my_getsystime() to set_timespec_time_nsec()
storage/maria/ma_loghandler.c:
  Changed from my_getsystime() to my_hrtime()
storage/maria/ma_recovery.c:
  Changed from my_getsystime() to mmicrosecond_interval_timer()
storage/maria/unittest/trnman-t.c:
  Changed from my_getsystime() to mmicrosecond_interval_timer()
storage/xtradb/handler/ha_innodb.cc:
  Added support for new time,datetime and timestamp
unittest/mysys/thr_template.c:
  my_getsystime() -> my_interval_timer()
unittest/mysys/waiting_threads-t.c:
  my_getsystime() -> my_interval_timer()
2011-05-28 05:11:32 +03:00
Kent Boortz
02e07e3b51 Updated/added copyright headers 2011-06-30 17:46:53 +02:00
Sergei Golubchik
0accbd0364 lots of post-merge changes 2011-04-25 17:22:25 +02:00
Davi Arnaut
8aadfb4065 Remove some leftovers from the removal of the gethostbyname wrappers. 2011-04-13 16:05:26 -03:00
Magne Mahre
a4481d3222 Post-push cleanup, for Bug#11763065 et al. 2011-03-01 14:36:47 +01:00
Sergei Golubchik
a8a757c6bb wl#173 - temporal types with sub-second resolution
and collateral changes.

* introduce my_hrtime_t, my_timediff_t, and conversion macros
* inroduce TIME_RESULT, but it can only be returned from Item::cmp_type(),
  never from Item::result_type()
* pack_time/unpack_time function for "packed" representation of
  MYSQL_TIME in a longlong that can be compared
* ADDTIME()/SUBTIME()/+- INTERVAL now work with TIME values
* numbers aren't quoted in EXPLAIN EXTENDED
* new column I_S.COLUMNS.DATETIME_PRECISION
* date/time values are compares to anything as date/time, not as strings or numbers.
* old timestamp(X) is no longer supported
* MYSQL_TIME to string conversion functions take precision as an argument
* unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
* Field_timestamp_hires, Field_datetime_hires, Field_time_hires
* Field_temporal
* Lazy_string class to pass a value (string, number, time) polymorphically down the stack
* make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
* removed Field::can_be_compared_as_longlong(). Use Field::cmp_type() == INT_RESULT instead
* introduced Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
* in many cases date/time types are treated like other types, not as special cases
* greatly simplified Arg_comparator (regarding date/time/year code)
* SEC_TO_TIME is real function, not integer.
* microsecond precision in NOW, CURTIME, etc
* Item_temporal. All items derived from it only provide get_date, but no val* methods
* replication of NOW(6)
* Protocol::store(time) now takes the precision as an argument
* @@TIMESTAMP is a double

client/mysqlbinlog.cc:
  remove unneded casts
include/my_sys.h:
  introduce my_hrtime_t, my_timediff_t, and conversion macros
include/my_time.h:
  pack_time/unpack_time, etc.
  convenience functions to work with MYSQL_TIME::second_part
libmysql/libmysql.c:
  str_to_time() is gone. str_to_datetime() does it now.
  my_TIME_to_str() takes the precision as an argument
mysql-test/include/ps_conv.inc:
  time is not equal to datetime anymore
mysql-test/r/distinct.result:
  a test for an old MySQL bug
mysql-test/r/explain.result:
  numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_default.result:
  numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_sapdb.result:
  when decimals=NOT_FIXED_DEC it means "not fixed" indeed
mysql-test/r/func_test.result:
  numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/func_time.result:
  ADDTIME()/SUBTIME()/+- INTERVAL now work with TIME values
mysql-test/r/having.result:
  numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/information_schema.result:
  new column I_S.COLUMNS.DATETIME_PRECISION
mysql-test/r/join_outer.result:
  numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/metadata.result:
  TIMESTAMP no longer has zerofill flag
mysql-test/r/range.result:
  invalid datetime is not compared with as a string
mysql-test/r/select.result:
  NO_ZERO_IN_DATE, etc only affect storage - according to the manual
  numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/subselect.result:
  numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/sysdate_is_now.result:
  when decimals=NOT_FIXED_DEC it means "not fixed" indeed
mysql-test/r/type_blob.result:
  TIMESTAMP(N) is not deprecated
mysql-test/r/type_timestamp.result:
  old TIMESTAMP(X) semantics is not supported anymore
mysql-test/r/union.result:
  numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/r/varbinary.result:
  numbers aren't quoted in EXPLAIN EXTENDED
mysql-test/t/distinct.test:
  test for an old MySQL bug
mysql-test/t/func_time.test:
  +- INTERVAL now works with TIME values
mysql-test/t/select.test:
  typo
mysql-test/t/subselect.test:
  only one error per statement, please
mysql-test/t/system_mysql_db_fix40123.test:
  old timestamp(X) is no longer supported
mysql-test/t/system_mysql_db_fix50030.test:
  old timestamp(X) is no longer supported
mysql-test/t/system_mysql_db_fix50117.test:
  old timestamp(X) is no longer supported
mysql-test/t/type_blob.test:
  old timestamp(X) is no longer supported
mysql-test/t/type_timestamp.test:
  old timestamp(X) is no longer supported
mysys/my_getsystime.c:
  functions to get the time with microsecond precision
mysys/my_init.c:
  move the my_getsystime.c initialization code to my_getsystime.c
mysys/my_static.c:
  no need to make these variables extern
mysys/my_static.h:
  no need to make these variables extern
scripts/mysql_system_tables.sql:
  old timestamp(X) is no longer supported
scripts/mysql_system_tables_fix.sql:
  old timestamp(X) is no longer supported
scripts/mysqlhotcopy.sh:
  old timestamp(X) is no longer supported
sql-common/my_time.c:
  * call str_to_time from str_to_datetime, as appropriate
  * date/time to string conversions take precision as an argument
  * number_to_time()
  * TIME_to_double()
  * pack_time() and unpack_time()
sql/event_data_objects.cc:
  cast is not needed
  my_datetime_to_str() takes precision as an argument
sql/event_db_repository.cc:
  avoid dangerous downcast (because the pointer is
  not always Field_timestamp, see events_1.test)
sql/event_queue.cc:
  avoid silly double-work for cond_wait
  (having an endpoint of wait, subtract the current time to get the timeout,
  and use set_timespec() macro to fill in struct timespec, by adding the current
  time to the timeout)
sql/field.cc:
  * remove virtual Field::get_time(), everyone should use only Field::get_date()
  * remove lots of #ifdef WORDS_BIGENDIAN
  * unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
  * Field_timestamp_hires, Field_datetime_hires, Field_time_hires
  * Field_temporal
  * make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
sql/field.h:
  * remove virtual Field::get_time(), everyone should use only Field::get_date()
  * remove lots of #ifdef WORDS_BIGENDIAN
  * unified the warnings from Field_timestamp/datetime/time/date/newdate store methods
  * Field_timestamp_hires, Field_datetime_hires, Field_time_hires
  * Field_temporal
  * make_truncated_value_warning and Field::set_datetime_warning use Lazy_string as an argument, removed char*/int/double variants
  * removed Field::can_be_compared_as_longlong(). Use Field::cmp_type() == INT_RESULT instead
sql/filesort.cc:
  TIME_RESULT, cmp_time()
sql/item.cc:
  * numbers aren't quoted in EXPLAIN EXTENDED
  * Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
  * virtual Item::get_time() is gone
  * Item_param::field_type() is set correctly
  * Item_datetime, for a datetime constant
  * time to anything is compared as a time
  * Item_cache::print() prints the value is available
  * bug fixed in Item_cache_int::val_str()
sql/item.h:
  * Item::print_value(), to be used from Item_xxx::print() when needed
  * Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
  * virtual Item::get_time() is gone
  * Item_datetime, for a datetime constant
  * better default for cast_to_int_type()
  * Item_cache objects now *always* have the field_type() set
sql/item_cmpfunc.cc:
  * get_year_value, get_time_value are gone. get_datetime_value does it all
  * get_value_a_func, get_value_b_func are gone
  * can_compare_as_dates() is gone too, TIME_RESULT is used instead
  * cmp_type() instead or result_type() when doing a comparison
  * compare_datetime and compate_e_datetime in the comparator_matrix, is_nulls_eq is gone
  * Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
sql/item_cmpfunc.h:
  greatly simplified Arg_comparator
sql/item_create.cc:
  * fix a bug in error messages in CAST
sql/item_func.cc:
  Item::cmp_result() instead of Item::is_datetime() and Item::result_as_longlong()
  mention all possibitiles in switch over Item_result values, or use default:
sql/item_row.h:
  overwrite the default cmp_type() for Item_row,
  as no MYSQL_TYPE_xxx value corresponds to ROW_RESULT
sql/item_timefunc.cc:
  rewrite make_datetime to support precision argument
  SEC_TO_TIME is real function, not integer.
  many functions that returned temporal values had duplicate code in val_* methods,
  some of them did not have get_date() which resulted in unnecessary date->str->date conversions. 
  Now they all are derived from Item_temporal_func and *only* provide get_date, not val* methods.
  many fixes to set decimals (datetime precision) correctly.
sql/item_timefunc.h:
  SEC_TO_TIME is real function, not integer.
  many functions that returned temporal values had duplicate code in val_* methods,
  some of them did not have get_date() which resulted in unnecessary date->str->date conversions. 
  Now they all are derived from Item_temporal_func and *only* provide get_date, not val* methods.
  many fixes to set decimals (datetime precision) correctly.
sql/log_event.cc:
  replication of NOW(6)
sql/log_event.h:
  replication of NOW(6)
sql/mysql_priv.h:
  Lazy_string class to pass a value (string, number, time) polymorphically down the stack.
  make_truncated_value_warning() that uses it.
sql/mysqld.cc:
  datetime in Arg_comparator::comparator_matrix
sql/opt_range.cc:
  cleanup: don't disable warnings before calling save_in_field_no_warnings()
sql/protocol.cc:
  Protocol::store(time) now takes the precision as an argument
sql/protocol.h:
  Protocol::store(time) now takes the precision as an argument
sql/rpl_rli.cc:
  small cleanup
sql/set_var.cc:
  SET TIMESTAMP=double
sql/set_var.h:
  @@TIMESTAMP is a double
sql/share/errmsg.txt:
  precision and scale are unsigned
sql/slave.cc:
  replication of NOW(6)
sql/sp_head.cc:
  cleanup
sql/sql_class.cc:
  support for NOW(6)
sql/sql_class.h:
  support for NOW(6)
sql/sql_insert.cc:
  support for NOW(6)
sql/sql_select.cc:
  use item->cmp_type().
  move a comment where it belongs
sql/sql_show.cc:
  new column I_S.COLUMNS.DATETIME_PRECISION
sql/sql_yacc.yy:
  TIME(X), DATETIME(X), cast, NOW(X), CURTIME(X), etc
sql/time.cc:
  fix date_add_interval() to support MYSQL_TIMESTAMP_TIME argument
storage/myisam/ha_myisam.cc:
  TIMESTAMP no longer carries ZEROFIELD flag, still we keep MYI file compatible.
strings/my_vsnprintf.c:
  warnings
tests/mysql_client_test.c:
  old timestamp(X) does not work anymore
  datetime is no longer equal to time
2011-03-01 13:24:36 +01:00
Magne Mahre
c4715a8076 Bug#11765237 - 58179: CANNOT START MYSQLD WITH APP VERIFIER
Bug#11763065 - 55730: KILL_SERVER() CALLS SETEVENT ON A NULL 
               HANDLE, SMEM_EVENT_CONNECT_REQUEST
      
Application Verifier is a Microsoft tool used for
detecting certain classes of programming errors.
In particular, MS Windows OS resource usage is
monitored for wrong usage (handles, thread local
storage, critical sections, ...)
      
In MySQL 5.5.x, an error was introduced where an
object on thread local storage was used before the
TLS and the object was created.
      
The fix has been to move the mysys initialization
to an earlier stage in the boot process when built for
Windows.  For non-win builds, the init already happens
early.

Some un-tangling of calls to my_init(), my_basic_init()
and my_thread_global_init() was done.  There is no
longer a need to do init in steps, so the full my_init()
is called instead of my_init_basic().
      
In addition,  Bug#11763065 was fixed.  The event handle
'smem_event_connect_request' is only created if
'opt_enable_shared_memory' is set.  When killing the
server, an event was flagged on the handle
unconditionally.  Added a test, so it will only be
flagged if created.


include/my_pthread.h:
  my_thread_basic_global_init is no longer
  necessary, and the my_thread_basic_global_reinit 
  function is renamed to reflect that it now
  reinits mutexes and condvars originating from
  my_thread_global_init
mysys/my_thr_init.c:
  Reorganized code.
2011-03-01 13:03:31 +01:00
Davi Arnaut
eb58939395 Bug#42054: SELECT CURDATE() is returning bad value
The problem from a user point of view was that on Solaris the
time related functions (e.g. NOW(), SYSDATE(), etc) would always
return a fixed time.

This bug was happening due to a logic in the time retrieving
wrapper function which would only call the time() function every
half second. This interval between calls would be calculated
using the gethrtime() and the logic relied on the fact that time
returned by it is monotonic.

Unfortunately, due to bugs in the gethrtime() implementation,
there are some cases where the time returned by it can drift
(See Solaris bug id 6600939), potentially causing the interval
calculation logic to fail.

Since newer versions of Solaris (10+) have alleviated the
performance degradation associated with time(2), the solution is
to simply directly rely on time() at each invocation.

This simplification has an upside that it allows us to eliminate
a lock which was used to control access to the variables used
to track the half second interval, thus improving the overall
scalability of timekeeping related functions (e.g. NOW()).

Benchmarks runs have shown no significant degradation associated
with this change. With this, there are actually improvements in
performance for cases involving many connections.

In summary, the changes introduced by this patch are:

a) my_time() and my_micro_time_and_time() no longer use gethrtime().
   Instead, time() and gettimeofdate() are used correspondingly.

b) my_micro_time() is changed to not use gethrtime() so as to
   have the same time source as my_micro_time_and_time().
   There shouldn't be any performance impact from this change
   since this function is used only a few times during statement
   execution and, on Solaris, gettimeofday() shows acceptable
   performance.

mysys/my_getsystime.c:
  Use time() even if gethrtime() is available. Remove logic which
  relied on gethrtime() to only call time() every half second.
  Since gethrtime() is not used anymore, also remove it from
  my_micro_time() to keep a common time source.
  
  Also, function comments are cleaned up (fixed typos and wrong
  information) and converted to doxygen.
mysys/my_thr_init.c:
  Remove mutex which is no longer used.
mysys/mysys_priv.h:
  Remove mutex which is no longer used.
2011-01-12 18:36:39 -02:00
Magne Mahre
8ede0759c3 Remove configuration preprocessor symbols 'THREAD'
and 'THREAD_SAFE_CLIENT'.
  
As of MySQL 5.5, we no longer support non-threaded
builds.   This patch removes all references to the
obsolete THREAD and THREAD_SAFE_CLIENT preprocessor
symbols.  These were used to distinguish between
threaded and non-threaded builds.
2011-01-11 10:07:37 +01:00
Davi Arnaut
7941c7eaaf Cleanup my_win_init by moving time and registry related
initialization to specific functions. Also, remove a large
block of white space. There shouldn't be any functional
change.
2010-12-15 18:00:54 -02:00
Sergei Golubchik
65ca700def merge.
checkpoint.
does not compile.
2010-11-25 18:17:28 +01:00
Mats Kindahl
b0836bd309 Merging with mysql-5.5-stage. 2010-08-16 14:50:27 +02:00
Davi Arnaut
75e2212397 WL#5498: Remove dead and unused source code
Remove unused macros or macro which are always defined.

include/my_global.h:
  Remove unused macros and move macros which aren't used globally.
2010-07-23 17:16:29 -03:00
Davi Arnaut
7a221fc9a3 WL#5498: Remove dead and unused source code
Remove unused source code and associated paraphernalia.
2010-07-23 17:14:35 -03:00
Davi Arnaut
6420d6dc4a WL#5486: Remove code for unsupported platforms
Remove VMS specific code.
2010-07-15 08:26:38 -03:00
Davi Arnaut
07e7b4d6fe WL#5486: Remove code for unsupported platforms
Remove Netware specific code.
2010-07-15 08:13:30 -03:00
Davi Arnaut
f56dd32bf7 Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled
Essentially, the problem is that safemalloc is excruciatingly
slow as it checks all allocated blocks for overrun at each
memory management primitive, yielding a almost exponential
slowdown for the memory management functions (malloc, realloc,
free). The overrun check basically consists of verifying some
bytes of a block for certain magic keys, which catches some
simple forms of overrun. Another minor problem is violation
of aliasing rules and that its own internal list of blocks
is prone to corruption.

Another issue with safemalloc is rather the maintenance cost
as the tool has a significant impact on the server code.
Given the magnitude of memory debuggers available nowadays,
especially those that are provided with the platform malloc
implementation, maintenance of a in-house and largely obsolete
memory debugger becomes a burden that is not worth the effort
due to its slowness and lack of support for detecting more
common forms of heap corruption.

Since there are third-party tools that can provide the same
functionality at a lower or comparable performance cost, the
solution is to simply remove safemalloc. Third-party tools
can provide the same functionality at a lower or comparable
performance cost. 

The removal of safemalloc also allows a simplification of the
malloc wrappers, removing quite a bit of kludge: redefinition
of my_malloc, my_free and the removal of the unused second
argument of my_free. Since free() always check whether the
supplied pointer is null, redudant checks are also removed.

Also, this patch adds unit testing for my_malloc and moves
my_realloc implementation into the same file as the other
memory allocation primitives.

client/mysqldump.c:
  Pass my_free directly as its signature is compatible with the
  callback type -- which wasn't the case for free_table_ent.
2010-07-08 18:20:08 -03:00
Daniel Fischer
073943cd7d merge 2010-06-18 17:04:15 +02:00
Alexander Nozdrin
14182ec917 Revert a patch for Bug#54334 (Double initialization of mysys mutexes).
Revision ID of the patch: marc.alff@oracle.com-20100608124148-lr1ult7lwo75niev
2010-06-10 17:44:19 +04:00
Marc Alff
be9c400638 Bug#54334 Double initialization of mysys mutexes
Prior to this fix, mysys mutexes such as THR_LOCK_lock could be initialized
twice by a call to my_init().
The root cause was out of place initialization in my_basic_init(),
calling my_thread_global_init().

With this fix,
- my_basic_init() properly initializes the mutex implementation itself,
for SAFE or FAST mutexes, and for platform dependent initializations,
before initialiazing a mutex.
- my_init() properly initializes mysys mutexes once,
when making the first call to my_thread_global_init().
2010-06-08 06:41:48 -06:00
Mats Kindahl
aaf2bdde94 WL#5363: Thread Pool Service Interface
In order to allow thread schedulers to be dynamically loaded,
it is necessary to make the following changes to the server:

- Two new service interfaces

- Modifications to InnoDB to inform the thread scheduler of state changes.

- Changes to the VIO subsystem for checking if data is available on a socket.

- Elimination of remains of the old thread pool implementation.

The two new service interfaces introduces are:

my_thread_scheduler
  A service interface to register a thread
  scheduler.

thd_wait
  A service interface to inform thread scheduler
  that the thread is about to start waiting.

In addition, the patch adds code that:

- Add a call to thd_wait for table locks in mysys
  thd_lock.c by introducing a set function that
  can be used to set a callback to be used when
  waiting on a lock and resuming from waiting.

- Calling the mysys set function from the server
  to set the callbacks correctly.
2010-06-07 16:01:39 +02:00
Davi Arnaut
a1b8e4dc7e Backport: remove dead code.
Reorganize function to reflect that it does not actually uses curses
and that there is no curses variant.
2010-05-28 19:53:26 -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
Alexey Kopytov
d95c1e3b47 Manual merge of mysql-trunk into mysql-trunk-merge.
Conflicts:

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

Text conflict in .bzr-mysql/default.conf
Text conflict in mysql-test/r/explain.result
Text conflict in mysql-test/r/having.result
Text conflict in mysql-test/suite/rpl/t/disabled.def
Text conflict in mysql-test/suite/rpl/t/rpl_slave_skip.test
Text conflict in storage/federated/ha_federated.cc
2010-03-07 19:40:59 +03:00
unknown
4bf849c23c Merge MySQL 5.1.44 into MariaDB. 2010-03-04 09:03:07 +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
Marc Alff
3694c5a928 Bug#50337 --defaults-file=~/something doesn't work anymore
Before this fix, opening a configuration file located under "~" failed.
To evaluate the "~" path, home_dir needs to be initialized.
The 'home_dir' variable was initialized too late in my_init().

This fix:
- moved the home_dir initialization from my_init() to my_basic_init(),
  using getenv("HOME"))
- moved the initialization of my_umask / my_umask_dir also to
  my_basic_init(), to have all the my_umask / my_umask_dir init code in the
  same place.

The second part is not strictly required, but makes the code more
maintainable.

Tested the fix manually.

No MTR tests added, because MTR should not access or modify the $HOME
directory of the user running tests.
2010-01-25 20:50:31 -07:00
Marc Alff
3d91522561 WL#2360 Performance schema
Part IV: sql instrumentation
2010-01-06 22:42:07 -07:00
Alexander Nozdrin
6e5c7b80bd Manual merge from mysql-next-mr.
Conflicts:
  - mysys/charset.c
  - mysys/my_thr_init.c
2009-12-17 23:02:52 +03:00