Commit graph

72 commits

Author SHA1 Message Date
Vladislav Vaintroub
4dfbf2ec93 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
2008-12-04 19:41:53 +01:00
davi@mysql.com/endora.local
cdd5eae9b6 Bug#34424 query_cache_debug.test leads to valgrind warnings
Bug#34678 @@debug variable's incremental mode

The problem is that the per-thread debugging settings stack wasn't
being deallocated before the thread termination, leaking the stack
memory. The chosen solution is to push a new state if the current
is set to the initial settings and pop it (free) once the thread
finishes.
2008-02-26 12:03:59 -03:00
jani@hynda.mysql.fi
f8db7bac5b Merge hynda.mysql.fi:/home/my/mysql-5.0-marvel
into  hynda.mysql.fi:/home/my/mysql-5.1-marvel
2007-08-21 19:09:46 +03:00
jani@hynda.mysql.fi
c31c8fc93d Fix for Bug#27970 "Fix for bug 24507 makes mysql_install_db fail" 2007-08-16 17:25:48 +03:00
monty@mysql.com/nosik.monty.fi
b16289a5e0 Slow query log to file now displays queries with microsecond precission
--long-query-time is now given in seconds with microseconds as decimals
--min_examined_row_limit added for slow query log
long_query_time user variable is now double with 6 decimals
Added functions to get time in microseconds
Added faster time() functions for system that has gethrtime()  (Solaris)
We now do less time() calls.
Added field->in_read_set() and field->in_write_set() for easier field manipulation by handlers
set_var.cc and my_getopt() can now handle DOUBLE variables.
All time() calls changed to my_time()
my_time() now does retry's if time() call fails.
Added debug function for stopping in mysql_admin_table() when tables are locked
Some trivial function and struct variable renames to avoid merge errors.
Fixed compiler warnings
Initialization of some time variables on windows moved to my_init()
2007-07-30 11:33:50 +03:00
msvensson@pilot.(none)
5ca0edd73f Merge pilot.(none):/data/msvensson/mysql/bug28690/my50-bug28690
into  pilot.(none):/data/msvensson/mysql/bug28690/my51-bug28690
2007-06-07 09:50:53 +02:00
msvensson@pilot.(none)
b5ebfe45ed Bug#28690 mysql-enterprise-gpl-5.0.40-linux-i686-glibc won't start on Debian Sarge
- Only use the "hack for bug in NTPL" if using NTPL, by dynamically
   checking the thd_lib_detected flag
2007-06-07 09:48:37 +02:00
cmiller@zippy.cornsilk.net
bd31322626 Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-maint
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.1-new-maint
2007-04-20 13:52:57 -04:00
cmiller@zippy.cornsilk.net
0b69216315 Avoid compiler warnings. 2007-04-20 13:49:06 -04:00
cmiller@zippy.cornsilk.net
dfdc475a57 Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-maint--pthreadkeycreate
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.1-new-maint
2007-04-19 17:23:41 -04:00
cmiller@zippy.cornsilk.net
28b3218e45 Bug #27964: pthread_key_create doesn't set errno, so don't report \
errno

Vasil Dimov (at Oracle) noted that pthread_key_create() does not
set errno, so if it fails then we return the wrong error code.

Instead, capture the return value, which is the real error value, 
and instead report that.
2007-04-19 17:07:11 -04:00
joerg@trift-lap.fambruehe
385526f768 mysys/my_thr_init.c : Avoid warnings of "unused variable" by extending a '#ifdef'. 2007-03-28 19:01:49 +02:00
serg@janus.mylan
e5b660487b restored run-time thread lib detection 2007-03-28 15:33:29 +02:00
monty@mysql.com/narttu.mysql.fi
f0ae3ce9b9 Fixed compiler warnings
Fixed compile-pentium64 scripts
Fixed wrong estimate of update_with_key_prefix in sql-bench
Merge bk-internal.mysql.com:/home/bk/mysql-5.1 into mysql.com:/home/my/mysql-5.1
Fixed unsafe define of uint4korr()
Fixed that --extern works with mysql-test-run.pl
Small trivial cleanups
This also fixes a bug in counting number of rows that are updated when we have many simultanous queries
Move all connection handling and command exectuion main loop from sql_parse.cc to sql_connection.cc
Split handle_one_connection() into reusable sub functions.
Split create_new_thread() into reusable sub functions.
Added thread_scheduler; Preliminary interface code for future thread_handling code.

Use 'my_thread_id' for internal thread id's
Make thr_alarm_kill() to depend on thread_id instead of thread
Make thr_abort_locks_for_thread() depend on thread_id instead of thread
In store_globals(), set my_thread_var->id to be thd->thread_id.
Use my_thread_var->id as basis for my_thread_name()
The above changes makes the connection we have between THD and threads more soft.

Added a lot of DBUG_PRINT() and DBUG_ASSERT() functions
Fixed compiler warnings
Fixed core dumps when running with --debug
Removed setting of signal masks (was never used)
Made event code call pthread_exit() (portability fix)
Fixed that event code doesn't call DBUG_xxx functions before my_thread_init() is called.
Made handling of thread_id and thd->variables.pseudo_thread_id uniform.
Removed one common 'not freed memory' warning from mysqltest
Fixed a couple of usage of not initialized warnings (unlikely cases)
Suppress compiler warnings from bdb and (for the moment) warnings from ndb
2007-02-23 13:13:55 +02:00
monty@mysql.com/narttu.mysql.fi
e5cc397f33 Fixed compiler warnings (for linux and win32 and win64)
Fixed a couple of usage of not initialized warnings (unlikely cases)
2007-02-22 16:59:57 +02:00
istruewing@chilla.local
0f4a84f002 Fixed a bad merge. Got a duplicate symbol on OSX. 2007-02-20 10:01:54 +01:00
antony@ppcg5.local
18ce758819 thd_lib_detected moved so that it is correctly declared as a data
section symbol and not a common symbol on gcc 4.0.1 on darwin 8.8.0
PowerPC MacOS X 10.4.8
2007-02-06 15:19:01 -08:00
svoj@mysql.com/april.(none)
db8a7b513c Excluded wrongly merged changeset. 2007-02-07 01:37:21 +04:00
istruewing@chilla.local
80ca34c3a8 Merge chilla.local:/home/mydev/mysql-5.0-axmrg
into  chilla.local:/home/mydev/mysql-5.1-axmrg
2007-02-02 11:34:22 +01:00
istruewing@chilla.local
1616e201d8 Merge chilla.local:/home/mydev/mysql-4.1-axmrg
into  chilla.local:/home/mydev/mysql-5.0-axmrg
2007-02-02 10:03:22 +01:00
istruewing@chilla.local
3a664472de After merge fix 2007-02-02 10:01:44 +01:00
istruewing@chilla.local
ed09987083 Merge chilla.local:/home/mydev/mysql-5.0-axmrg
into  chilla.local:/home/mydev/mysql-5.1-axmrg
2007-02-01 19:41:04 +01:00
istruewing@chilla.local
1c34270464 Merge chilla.local:/home/mydev/mysql-4.1-axmrg
into  chilla.local:/home/mydev/mysql-5.0-axmrg
2007-02-01 10:19:22 +01:00
istruewing@chilla.local
73e61944f7 Merge chilla.local:/home/mydev/mysql-4.0-axmrg
into  chilla.local:/home/mydev/mysql-4.1-axmrg
2007-02-01 08:09:36 +01:00
jani@ua141d10.elisa.omakaista.fi
b3523e398c Cleanup of thread-type (linuxthread or NTPL) detection code
Move get_thread_lib to mysys/my_pthread.c
Set 'thr_client_alarm' to signal number used by thr_alarm to give alarms
2007-01-30 18:52:26 +02:00
lars/lthalmann@dl145j.mysql.com
1e356251a0 Merge mysql.com:/nfsdisk1/lars/bkroot/mysql-5.1-new-rpl
into  mysql.com:/nfsdisk1/lars/MERGE/mysql-5.1-merge
2007-01-12 12:31:44 +01:00
lars/lthalmann@mysql.com/dl145j.mysql.com
c380de50ef Merge mysql.com:/nfsdisk1/lars/bkroot/mysql-5.0-rpl
into  mysql.com:/nfsdisk1/lars/MERGE/mysql-5.0-merge
2007-01-12 12:22:54 +01:00
kent@kent-amd64.(none)
be15e3bc15 Merge mysql.com:/home/kent/bk/main/mysql-5.0
into  mysql.com:/home/kent/bk/main/mysql-5.1
2006-12-23 20:20:40 +01:00
kent@mysql.com/kent-amd64.(none)
226a5c833f Many files:
Changed header to GPL version 2 only
2006-12-23 20:17:15 +01:00
lars@black.(none)
4d25b1e1c2 Merge mysql.com:/home/bk/MERGE/mysql-5.0-merge
into  mysql.com:/home/bk/MERGE/mysql-5.1-merge
2006-12-08 23:54:45 +01:00
lars@mysql.com/black.(none)
e2e3f0e5c3 Merge mysql.com:/home/bkroot/mysql-5.0-rpl
into  mysql.com:/home/bk/MERGE/mysql-5.0-merge
2006-12-08 23:33:39 +01:00
rafal@quant.(none)
5d7af856f7 BUG#24507 (rpl_log.test crash slave):
The problem was located to lie inside current NPTL pthread_exit() 
implementation. Race conditions in this code can lead to segmentation
fault. Hovewer, this can happen only in a race between first thread 
calling pthread_exit() and other threads. 

Workaround implemented in this patch spawns a dummy thread, which
exits immediately, during thread lib initialization. This will exclude
segment violations when further threads exit.
2006-12-08 11:41:12 +01:00
monty@mysql.com/narttu.mysql.fi
0a673596a2 Don't abort if we call my_thread_end() multiple times
Fixed new introduced bug in my_time.c
2006-11-30 22:00:05 +02:00
monty@mysql.com/narttu.mysql.fi
601e6f4b2a Fixed compiler warnings
Don't assert if my_thread_end() is called twice (common case)
2006-11-30 21:56:03 +02:00
monty@mysql.com/narttu.mysql.fi
3d40956039 Fixed portability issue in my_thr_init.c (was added in my last push)
Fixed compiler warnings (detected by VC++):
- Removed not used variables
- Added casts
- Fixed wrong assignments to bool
- Fixed wrong calls with bool arguments
- Added missing argument to store(longlong), which caused wrong store method to be called.
2006-11-30 18:25:05 +02:00
monty@mysql.com/narttu.mysql.fi
3a35c30027 Fixed compiler warnings (Mostly VC++):
- Removed not used variables
- Changed some ulong parameters/variables to ulonglong (possible serious bug)
- Added casts to get rid of safe assignment from longlong to long (and similar)
- Added casts to function parameters
- Fixed signed/unsigned compares
- Added some constructores to structures
- Removed some not portable constructs

Better fix for bug Bug #21428 "skipped 9 bytes from file: socket (3)" on "mysqladmin shutdown"
(Added new parameter to net_clear() to define when we want the communication buffer to be emptied)
2006-11-30 03:40:42 +02:00
monty@narttu.mysql.fi
717284b85c Merge mysql.com:/home/my/mysql-5.0
into  mysql.com:/home/my/mysql-5.1
2006-11-29 23:07:15 +02:00
monty@mysql.com/narttu.mysql.fi
0bee93e038 Ignore some generated files
Don't return from my_thread_global_end() until all threads have called my_thread_end()
Bug#24387: Valgrind: my_thread_init (handle_sl sql, handle_one_conn, handle_slave_io)
2006-11-29 22:14:08 +02:00
brian@zim.(none)
f6f03576c6 This completes the work done in 5.0 to remove mit_pthread support (most was pulled in 5.0, but there were some pieces left in the tree) 2006-04-16 01:50:25 -07:00
brian@zim.(none)
ba2502b9c3 Another long patch to remove the rest of the OS2 support. 2006-04-15 08:49:00 -07:00
serg@serg.mylan
63cfd11859 dbug changes:
1. dbug state is now local to a thread
2. new macros: DBUG_EXPLAIN, DBUG_EXPLAIN_INITIAL,
   DBUG_SET, DBUG_SET_INITIAL, DBUG_EVALUATE, DBUG_EVALUATE_IF
3. macros are do{}while(0) wrapped
4. incremental modifications to the dbug state (e.g. "+d,info:-t")
5. dbug code cleanup, style fixes
6. _db_on_ and DEBUGGER_ON/OFF removed
7. rest of MySQL code fixed because of 3 (missing ;) and 6
8. dbug manual updated
9. server variable @@debug (global and local) to control dbug from SQL!
a. -#T to print timestamps in the log
2006-02-14 22:36:11 +01:00
monty@mishka.local
a9f6aab4c9 Fixes while reviewing new code
Added option --count to mysqlshow (to show number of rows)
Fixed possible core dump in information schema
2005-05-06 11:39:30 +03:00
msvensson@neptunus.(none)
565e660bd4 Bug #9954 mysql-4.1.11/cmd-line-utils/libedit/makelist.sh is not portable
- Reverted removal of errorcheck mutex initialise, used in safe_mutex_init.
2005-04-27 13:29:37 +02:00
msvensson@neptunus.(none)
f3c72cc891 Bug #9954 mysql-4.1.11/cmd-line-utils/libedit/makelist.sh is not portable
- Changed makelist.sh
  - Bump up required version of autoconf
  - Use new style to init mutex in my_thr_init
2005-04-27 09:59:12 +02:00
monty@mysql.com
3afecef4df Fix compiler warnings (detected by Intel's C++ compiler)
Fixed checking of privilege handling in CREATE ... SELECT (Bug #6094)
2004-10-22 18:44:51 +03:00
monty@mysql.com
f96c4941d8 Fixed problems noticed with last build 2004-04-09 07:12:41 +03:00
monty@mysql.com
ce14578909 Merge with 4.0.18 2004-02-11 00:06:46 +01:00
konstantin@mysql.com
5def5b6853 typo fixed PPTHREAD -> PTHREAD 2004-01-16 21:01:58 +03:00
monty@mysql.com
e0cc6799ec Merge with 4.0.17 2003-12-17 17:35:34 +02:00
monty@mysql.com
64d7e0162c Merge bk-internal.mysql.com:/home/bk/mysql-4.0
into mysql.com:/my/mysql-4.0
2003-12-11 06:24:32 +02:00