Commit graph

81 commits

Author SHA1 Message Date
Oleksandr Byelkin
763bdee81b MDEV-26637: (explicit length) ASAN: main.metadata and user_variables.basic MTR failures after MDEV-26572
Use explicit length for hash record length
2021-10-12 10:01:07 +02:00
Vladislav Vaintroub
3d6eb7afcf MDEV-25602 get rid of __WIN__ in favor of standard _WIN32
This fixed the MySQL bug# 20338 about misuse of double underscore
prefix __WIN__, which was old MySQL's idea of identifying Windows
Replace it by _WIN32 standard symbol for targeting Windows OS
(both 32 and 64 bit)

Not that connect storage engine is not fixed in this patch (must be
fixed in "upstream" branch)
2021-06-06 13:21:03 +02:00
Monty
3ef65f2783 Added DBUG_PUSH_EMPTY and DBUG_POP_EMPTY to speed up DBUG 2020-08-20 19:34:11 +03:00
Monty
f9f33b85be Handle errors from external_unlock & mysql_unlock_tables
Other things:
- Handler errors from ha_maria::implict_commit
- Disable DBUG in safe_mutex_lock to get trace file easier to read
2020-04-19 17:33:51 +03:00
Sergei Golubchik
c1c5222cae cleanup: PSI key is *always* the first argument 2020-03-10 19:24:23 +01:00
Sergei Golubchik
7c58e97bf6 perfschema memory related instrumentation changes 2020-03-10 19:24:22 +01:00
Eugene Kosov
7db999322c MDEV-20183 data race at safe_mutex_lock()
fix is simple: just move mp->file under mp->global protection
2019-07-26 12:36:06 +03:00
Marko Mäkelä
be85d3e61b Merge 10.2 into 10.3 2019-05-14 17:18:46 +03:00
Marko Mäkelä
26a14ee130 Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
Vicențiu Ciorbaru
cb248f8806 Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
Vicențiu Ciorbaru
5543b75550 Update FSF Address
* Update wrong zip-code
2019-05-11 21:29:06 +03:00
Otto Kekäläinen
c9c28bef3c Minor spelling fixes in code comments, docs and output
This commit does not touch any variable names or any other actual code,
and thus should not in any way affect how the code works.
2018-01-12 16:49:02 +02:00
Michael Widenius
458d5ed8aa Lots of small cleanups
- Simplified use_trans_cache() to return at once if is_transactional is set
- Indentation and spelling errors fixed
- Don't call signal_update() if update_binlog_end_pos() is called as the
  function already calls signal_update()
- Removed not used function wait_for_update_bin_log(), which would cause
  errors if ever used.
- Simplified handler::clone() by always allocating 'ref' in ha_open(). To do
  this I added an optional MEM_ROOT argument to ha_open() to be used when
  allocating 'ref'
- Changed arguments to get_system_var() from LEX_CSTRING to LEX_CSTRING*
- Added THD as argument to create_select_for_variable(). Changed also char*
  argument to LEX_CSTRING to avoid strlen() call.
- Change calls to append() to use LEX_CSTRING
2017-08-24 01:05:49 +02:00
Marko Mäkelä
2a3fe45dd2 Remove XtraDB
The XtraDB storage engine was already replaced by InnoDB
and disabled in MariaDB Server 10.2. Let us remove it altogether
to avoid dragging dead code around.

Replace some references to XtraDB with references to InnoDB.

rpl_get_position_info(): Remove.

Remove the mysql-test-run --suite=percona, because it only contains
tests specific to XtraDB, many of which were disabled already in
earlier MariaDB versions.
2017-06-21 13:44:16 +03:00
Monty
3d4a7390c1 MDEV-6150 Speed up connection speed by moving creation of THD to new thread
Creating a CONNECT object on client connect and pass this to the working thread which creates the THD.
Split LOCK_thread_count to different mutexes
Added LOCK_thread_start to syncronize threads
Moved most usage of LOCK_thread_count to dedicated functions
Use next_thread_id() instead of thread_id++

Other things:
- Thread id now starts from 1 instead of 2
- Added cast for thread_id as thread id is now of type my_thread_id
- Made THD->host const (To ensure it's not changed)
- Removed some DBUG_PRINT() about entering/exiting mutex as these was already logged by mutex code
- Fixed that aborted_connects and connection_errors_internal are counted in all cases
- Don't take locks for current_linfo when we set it (not needed as it was 0 before)
2016-02-07 10:34:03 +02:00
Sergey Vojtovich
e562b43222 MDEV-8111 - remove "fast mutexes"
They aren't faster than normal mutexes. They're disabled by default for years,
so de facto it's dead code, never used.
2015-11-26 11:34:17 +04:00
Sergey Vojtovich
b95c8ce530 MDEV-5675 - Performance: my_hash_sort_bin is called too often
Reduced number of my_hash_sort_bin() calls from 4 to 1 per query.
Reduced number of memory accesses done by my_hash_sort_bin().

Details:
- let MDL subsystem use pre-calculated hash value for hash
  inserts and deletes
- let table cache use pre-calculated MDL hash value
- MDL namespace is excluded from hash value calculation, so that
  hash value can be used by table cache as is
- hash value for MDL is calculated as resulting hash value + MDL
  namespace
- extended hash implementation to accept user defined hash function
2014-03-06 16:19:12 +04:00
Michael Widenius
5cf5a9a1e8 Fixed timing failure in myisam-metadata.test
mysql-test/include/wait_show_condition.inc:
  Print failing statement if timeout
mysql-test/r/myisam-metadata.result:
  Updated DBUG_SYNC
mysql-test/t/myisam-metadata.test:
  Updated DBUG_SYNC.
  Removed wait_show_condtion, as this is not needed when we use DBUG_SYNC
  This should fix timing issues with the test
mysys/thr_mutex.c:
  Added comments
sql/sql_acl.cc:
  atoi -> atoll()  (Safety)
storage/myisam/ha_myisam.cc:
  Send signal before mi_repair_by_sort.
2013-06-06 15:51:36 +03:00
Sergei Golubchik
0117a92fed MDEV-419 ensure that all HAVE_XXX constants can be set by cmake
add missing checks to configure.cmake
remove dead code and unused HAVE_xxx constants from the sources
2012-07-31 19:29:07 +02:00
Sergei Golubchik
4f435bddfd 5.3 merge 2012-01-13 15:50:02 +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
86a2d70779 safe_mutex deadlock detector post-merge fixes 2011-10-19 21:53:14 +02: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
Michael Widenius
13e4d54795 Fixed lp:814238 "safe_mutex issues must be assertions in debug binary"
Added --debug-assert-on-error variable which, if set, will cause safe_mutex to assert if it founds an error.

include/my_sys.h:
  Added my_assert_on_error
mysys/my_static.c:
  Added my_assert_on_error
mysys/thr_mutex.c:
  Assert when found wrong mutex usage if my_assert_on_error is set
sql/mysqld.cc:
  Added setting of my_assert_on_error
2011-09-02 12:41:20 +03: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
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
Michael Widenius
e6c45f5e1f - Reduced memory requirements for mysqltest to 1/4.th This also gave a speedup for 5x for some tests.
- Reduced memory usage from safe_mutex.
- Fixed problem with failing tests that could not restart mysqld becasue the port was reserved
- More DBUG information
- Fixed bug where bitmap_set_prefix() wrote over buffer area.
- Initialize n_pages_flushed in xtradb which was used uninitialized.

client/mysqltest.cc:
  Reduced memory usage (400K -> 80 for simple test;  400M -> 70M for some other tests)
  - Smaller dynamic arrays at start
  - Made 'st_connection' significantly smaller by allocation 'mysql' on demand in mysql_init() and storing require_file in a mem_root.
  - Fixed that when one does --debug we get information from safemalloc in the trace
  (Most of changes are changing &connect->mysql to connect->mysql
libmysql/libmysql.c:
  Don't call mysql_thread_end() if my_init() was called outside of mysql_server_init()
  This is needed to get information from my_end() into the DBUG log
mysql-test/README:
  Fixed wrong comment
mysql-test/mysql-test-run.pl:
  Reserv 20 ports / mysql-test-run thread.
  (Needed as some tests uses 9 mysqld servers)
mysys/hash.c:
  More DBUG information
mysys/my_bitmap.c:
  Fixed bug where bitmap_set_prefix() wrote over buffer area.
mysys/safemalloc.c:
  More DBUG information
mysys/thr_mutex.c:
  Initialize smaller arrays be default.
sql-common/client.c:
  More DBUG_PRINT
storage/xtradb/srv/srv0srv.c:
  Initialize n_pages_flushed which was used uninitialized.
2011-02-24 02:36:32 +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
Sergei Golubchik
65ca700def merge.
checkpoint.
does not compile.
2010-11-25 18:17:28 +01:00
Michael Widenius
1a6373e8e2 Merge with MySQL 5.1.53
Open issues:
- A better fix for #57688; Igor is working on this
- Test failure in index_merge_innodb.test ; Igor promised to look at this
- Some Innodb tests fails (need to merge with latest xtradb) ; Kristian promised to look at this.
 - Failing tests: innodb_plugin.innodb_bug56143 innodb_plugin.innodb_bug56632 innodb_plugin.innodb_bug56680 innodb_plugin.innodb_bug57255 
- Werror is disabled;  Should be enabled after merge with xtradb.
2010-11-25 00:57:34 +02:00
Davi Arnaut
785bcc173d Merge of mysql-5.1-bugteam into mysql-5.5-bugteam. 2010-10-20 12:48:19 -02:00
Davi Arnaut
b5bb13ec03 Bug#45288: pb2 returns a lot of compilation warnings
Fix assorted compiler warnings.

include/my_pthread.h:
  Like for pthread_cond_timedwait, the abstime is constant.
mysys/my_gethwaddr.c:
  Instead of using a manual copy that introduce warnings due to
  type mismatch, copy the buffer using memcpy and use memcmp to
  check whether all bytes of the buffer are zeroed.
mysys/thr_mutex.c:
  Like for pthread_cond_timedwait, the abstime is constant.
unittest/mytap/tap.h:
  Introduce a ok() variant that does not take a format argument.
  Since ok() is tagged with a printf attribute, GCC complains if
  the fmt argument is NULL.
2010-10-20 11:40:04 -02:00
Marc Alff
c082955f06 WL#2360 Performance schema
Part III: mysys instrumentation
2009-12-09 20:19:51 -07:00
Michael Widenius
069eec35ae Fixed LPBUG#485443 --with-fast-mutexes and without safe mutexes (debug build) maria do not builds
Added 'mariadb_SERVER' as extra config group for MariaDB embedded server


client/mysql.cc:
  Cleanup
  Added 'mariadb_SERVER' as extra config group for MariaDB embedded server
mysys/thr_mutex.c:
  Fixed LPBUG#485443 --with-fast-mutexes and without safe mutexes (debug build) maria do not builds
2009-11-26 01:18:23 +02:00
unknown
7c5e321bb8 More XtraDB after-merge fixes following review and buildbot runs:
- Better fix for --innodb-use-sys-malloc causing Valgrind warnings.
 - Different fix for INNODB_IBUF_MAX_SIZE variable changing default value.
 - Fix some problems with the safe mutex lazy init patch.

mysql-test/include/mtr_check.sql:
  Do not check INNODB_IBUF_MAX_SIZE for changes. It is not a dynamic variable, so cannot
  be changed by a test case anyway, and the value may vary slightly from one start of the
  server to the next.
mysql-test/lib/mtr_cases.pm:
  Even just starting and stopping the server with --innodb-use-sys-malloc to check for
  disabled test case under valgrind will cause valgrind leak warnings. So add not_valgrind
  to the list of conditions also tested for directly in mysql-test-run.pl.
mysql-test/mysql-test-run.pl:
  Even just starting and stopping the server with --innodb-use-sys-malloc to check for
  disabled test case under valgrind will cause valgrind leak warnings. So add not_valgrind
  to the list of conditions also tested for directly in mysql-test-run.pl.
mysys/thr_mutex.c:
  Fix a few problems found during review of the lazy init safe mutex patch.
storage/xtradb/ibuf/ibuf0ibuf.c:
  Revert previous fix of INNODB_IBUF_MAX_SIZE default varying slightly between server starts.
  (Fixed instead by ignoring that variable in the test suite).
2009-06-22 10:06:35 +02:00
unknown
bb9a3f0c2b XtraDB after-merge fixes.
Fixes to get the test suite to run without failures.

mysql-test/r/information_schema.result:
  Additional variables available now.
  Sort output to avoid depending on engine order.
mysql-test/r/information_schema_all_engines.result:
  More variables now.
mysql-test/r/innodb-autoinc.result:
  Avoid picking up pbxt variables in result
mysql-test/r/innodb-index.result:
  Save state to not corrupt following testcases.
  Suppress an expected warning.
mysql-test/r/innodb-zip.result:
  Work around a problem with dependency on zlib version
mysql-test/r/innodb.result:
  Checksums have changed in Maria.
  Save and restore server state to not corrupt following testcases.
mysql-test/r/innodb_bug36169.result:
  Save and restore server state to not corrupt following testcases.
mysql-test/r/innodb_xtradb_bug317074.result:
  Save and restore server state to not corrupt following testcases.
mysql-test/r/row-checksum-old.result:
  Update result file
mysql-test/r/row-checksum.result:
  Update result file
mysql-test/t/information_schema.test:
  Sort output to avoid depending on engine order.
mysql-test/t/innodb-analyze.test:
  Save and restore server state to not corrupt following testcases.
mysql-test/t/innodb-autoinc.test:
  Save and restore server state to not corrupt following testcases.
mysql-test/t/innodb-index.test:
  Save state to not corrupt following testcases.
  Suppress an expected warning.
mysql-test/t/innodb-zip.test:
  Work around a problem with dependency on zlib version
mysql-test/t/innodb.test:
  Save and restore server state to not corrupt following testcases.
  Update --replace statements for new mysql-test-run
mysql-test/t/innodb_bug34300.test:
  Save and restore server state to not corrupt following testcases.
mysql-test/t/innodb_bug36169.test:
  Save and restore server state to not corrupt following testcases.
mysql-test/t/innodb_bug36172.test:
  Save and restore server state to not corrupt following testcases.
mysql-test/t/innodb_xtradb_bug317074.test:
  Save and restore server state to not corrupt following testcases.
mysql-test/t/partition_innodb.test:
  Fix regexps to work with new SHOW INNODB STATUS output.
mysys/thr_mutex.c:
  Initialize mutex deadlock detection lazily.
  This allows to test XtraDB, which initializes huge amounts of mutexes without using any but a few of them.
storage/xtradb/ibuf/ibuf0ibuf.c:
  Fix problem where value of INNODB_IBUF_MAX_SIZE would depend on the alignment of memory
  allocated by the buffer pool.
storage/xtradb/include/sync0rw.h:
  Fix XtraDB to compile without GCC atomic operation intrinsics (performance may suffer
  when they are not available though).
storage/xtradb/include/sync0rw.ic:
  Fix XtraDB to compile without GCC atomic operation intrinsics (performance may suffer
  when they are not available though).
storage/xtradb/include/univ.i:
  Fix for MariaDB
storage/xtradb/setup.sh:
  Remove no longer needed file from XtraDB.
storage/xtradb/srv/srv0start.c:
  Fix for MariaDB
2009-06-09 17:08:46 +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
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
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
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
Davi Arnaut
e405ab1626 Bug#38941: fast mutexes in MySQL 5.1 have mutex contention when calling random()
The problem is that MySQL's 'fast' mutex implementation uses the
random() routine to determine the spin delay. Unfortunately, the
routine interface is not thead-safe and some implementations (eg:
glibc) might use a internal lock to protect the RNG state, causing
excessive locking contention if lots of threads are spinning on
a MySQL's 'fast' mutex. The code was also misusing the value
of the RAND_MAX macro, this macro represents the largest value
that can be returned from the rand() function, not random().

The solution is to use the quite simple Park-Miller random number
generator. The initial seed is set to 1 because the previously used
generator wasn't being seeded -- the initial seed is 1 if srandom()
is not called.

Futhermore, the 'fast' mutex implementation has several shortcomings
and provides no measurable performance benefit. Therefore, its use is
not recommended unless it provides directly measurable results.


include/my_pthread.h:
  Add field to keep the RNG state.
mysys/thr_mutex.c:
  Use a palliative per-mutex rng state to determine the spin delay.
  The RNG is not thread-safe but jumping a few sequences in the RNG
  is harmless.
2008-10-15 19:21:00 -03:00
unknown
dd3bba09f2 Merge a88-113-38-195.elisa-laajakaista.fi:/home/my/bk/mysql-5.1-main
into  a88-113-38-195.elisa-laajakaista.fi:/home/my/bk/mysql-maria.new


BitKeeper/etc/ignore:
  auto-union
BUILD/compile-dist:
  Auto merged
client/mysqladmin.cc:
  Auto merged
client/mysqldump.c:
  Auto merged
config/ac-macros/plugins.m4:
  Auto merged
configure.in:
  Auto merged
dbug/dbug.c:
  Auto merged
include/keycache.h:
  Auto merged
include/m_string.h:
  Auto merged
include/my_global.h:
  Auto merged
include/my_pthread.h:
  Auto merged
include/my_sys.h:
  Auto merged
include/mysql_com.h:
  Auto merged
libmysql/CMakeLists.txt:
  Auto merged
libmysql/Makefile.shared:
  Auto merged
mysql-test/lib/mtr_cases.pl:
  Auto merged
mysql-test/lib/mtr_report.pl:
  Auto merged
mysql-test/mysql-test-run.pl:
  Auto merged
mysql-test/r/innodb.result:
  Auto merged
mysql-test/r/merge.result:
  Auto merged
mysql-test/r/myisam.result:
  Auto merged
mysql-test/r/mysqldump.result:
  Auto merged
mysql-test/r/ps_2myisam.result:
  Auto merged
mysql-test/r/ps_3innodb.result:
  Auto merged
mysql-test/r/ps_4heap.result:
  Auto merged
mysql-test/r/ps_5merge.result:
  Auto merged
mysql-test/r/query_cache.result:
  Auto merged
mysql-test/r/subselect.result:
  Auto merged
mysql-test/r/view.result:
  Auto merged
mysql-test/suite/ndb/r/ps_7ndb.result:
  Auto merged
mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result:
  Auto merged
mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test:
  Auto merged
mysql-test/t/delayed.test:
  Auto merged
mysql-test/t/disabled.def:
  Auto merged
mysql-test/t/myisam.test:
  Auto merged
mysql-test/t/mysqldump.test:
  Auto merged
mysql-test/t/query_cache.test:
  Auto merged
mysql-test/t/query_cache_notembedded.test:
  Auto merged
mysql-test/t/subselect.test:
  Auto merged
mysql-test/t/variables.test:
  Auto merged
mysql-test/t/view.test:
  Auto merged
mysys/CMakeLists.txt:
  Auto merged
mysys/Makefile.am:
  Auto merged
mysys/mf_keycache.c:
  Auto merged
mysys/my_delete.c:
  Auto merged
mysys/my_init.c:
  Auto merged
mysys/my_symlink2.c:
  Auto merged
mysys/safemalloc.c:
  Auto merged
mysys/thr_lock.c:
  Auto merged
sql/field.h:
  Auto merged
sql/filesort.cc:
  Auto merged
sql/ha_ndbcluster.cc:
  Auto merged
sql/ha_partition.cc:
  Auto merged
sql/handler.cc:
  Auto merged
sql/handler.h:
  Auto merged
sql/item.h:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_func.h:
  Auto merged
sql/item_strfunc.cc:
  Auto merged
sql/item_xmlfunc.cc:
  Auto merged
sql/lock.cc:
  Auto merged
sql/log.cc:
  Auto merged
sql/log_event_old.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/net_serv.cc:
  Auto merged
sql/opt_range.cc:
  Auto merged
sql/set_var.h:
  Auto merged
sql/slave.cc:
  Auto merged
sql/slave.h:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_delete.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_plugin.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/share/errmsg.txt:
  Auto merged
sql/table.cc:
  Auto merged
sql/table.h:
  Auto merged
sql/udf_example.c:
  Auto merged
storage/csv/ha_tina.cc:
  Auto merged
storage/myisam/ft_boolean_search.c:
  Auto merged
storage/myisam/ft_nlq_search.c:
  Auto merged
storage/myisam/ft_parser.c:
  Auto merged
storage/myisam/ha_myisam.cc:
  Auto merged
storage/myisam/ha_myisam.h:
  Auto merged
storage/myisam/mi_check.c:
  Auto merged
storage/myisam/mi_dynrec.c:
  Auto merged
storage/myisam/mi_open.c:
  Auto merged
storage/myisam/mi_packrec.c:
  Auto merged
storage/myisam/mi_write.c:
  Auto merged
storage/myisam/myisamchk.c:
  Auto merged
storage/myisam/myisampack.c:
  Auto merged
storage/myisam/rt_index.c:
  Auto merged
storage/myisam/sort.c:
  Auto merged
storage/myisammrg/ha_myisammrg.cc:
  Auto merged
storage/myisammrg/ha_myisammrg.h:
  Auto merged
strings/llstr.c:
  Auto merged
support-files/compiler_warnings.supp:
  Auto merged
Makefile.am:
  Manual merge from 5.1 to maria.
client/mysqltest.c:
  Manual merge from 5.1 to maria.
include/my_base.h:
  Manual merge from 5.1 to maria.
mysql-test/t/merge.test:
  Manual merge from 5.1 to maria.
mysys/my_getopt.c:
  Manual merge from 5.1 to maria.
mysys/thr_mutex.c:
  Manual merge from 5.1 to maria.
sql/mysqld.cc:
  Manual merge from 5.1 to maria.
sql/set_var.cc:
  Manual merge from 5.1 to maria.
sql/sql_table.cc:
  Manual merge from 5.1 to maria.
sql/sql_yacc.yy:
  Manual merge from 5.1 to maria.
sql/unireg.cc:
  Manual merge from 5.1 to maria.
2007-12-16 17:03:44 +02:00
unknown
8224c76fbd Removed MARIA_BASE min_row_length (duplicate of min_block_length)
Cleanup of recent code changes in dbug and my_thr_init
Added name for each safe_mutex (for better DBUG and error reporting)
Fixed that sort_info.max_records is calculated correctly. This fixed a bug in maria_chk
Removed duplicate printing of mutex address in dbug log


dbug/dbug.c:
  Cleanup of recent code changes
include/my_pthread.h:
  Added name for each safe_mutex (for better DBUG and error reporting)
mysys/my_thr_init.c:
  Cleanup of recent code changes
mysys/thr_mutex.c:
  Added name for each safe_mutex (for better DBUG and error reporting)
mysys/wqueue.c:
  Removed some mutex printing (as it's done now when we take mutex)
storage/maria/Makefile.am:
  Fixed that 'make tags' works with xemacs
storage/maria/ma_blockrec.c:
  base.min_row_length -> base.min_block_length
  (As they where basicly the same variable)
storage/maria/ma_check.c:
  Moved more common stuff to initialize_variables_for_repair
  Fixed that sort_info.max_records is calculated correctly. This fixed a bug in maria_chk
storage/maria/ma_create.c:
  More comments
  Fixed that min_pack_length is calculated more correctly
  Removed duplicate variable base.min_row_length
storage/maria/ma_loghandler.c:
  Removed duplicate printing of mutex address
storage/maria/ma_open.c:
  Removed base.min_row_length
storage/maria/ma_packrec.c:
  Removed not anymore needed code
  (One should not change any .base variables as this will affect repair with unpack)
storage/maria/maria_def.h:
  Removed base.min_row_length
2007-12-12 23:57:28 +02:00