Commit graph

74 commits

Author SHA1 Message Date
Konstantin Osipov
41d95c5049 A pre-requisite for WL#5419 "LOCK_open scalability:
make tdc_refresh_version an 
atomic counter".
Backport the trivial changes from mysql-trunk-iplus.
2010-06-10 15:43:32 +04:00
Jon Olav Hauglid
f2587df7ba merge from mysql-trunk-bugfixing 2010-04-20 10:51:50 +02:00
Jon Olav Hauglid
7e6eddd374 Bug #52367 Deadlock involving SET GLOBAL EVENT_SCHEDULER = OFF
during rqg_mdl_deadlock test

The problem was that if two connection threads simultaneously tries
to execute "SET GLOBAL EVENT_SCHEDULER = OFF", one of them could
hang waiting for the scheduler to stop.

The first connection thread would kill the event scheduler thread
and then start waiting for it to exit. The second connection thread
would then find the event scheduler thread in the process of exiting
and also wait for it to exit. However, since the event scheduler 
thread used signal to wake only one waiting thread, the other connection
thread would be left waiting.

This bug was a regression introduced by the fix for Bug#51160.
Before #51160 it was not possible for two connection threads to 
try to stop the event scheduler thread simultaneously.

This patch fixes the problem my making sure the event scheduler
thread uses broadcast to notify all waiters that it is exiting.

No test case added as this would require adding debug sync points
to parts of the code where sync points are currently not used.
The patch has been tested with the non-deterministic test case
from the bug description as well as using the RQG.
2010-04-14 09:30:57 +02:00
Mats Kindahl
e409d6f69c WL#5030: Split and remove mysql_priv.h
This patch:

- Moves all definitions from the mysql_priv.h file into
  header files for the component where the variable is
  defined
- Creates header files if the component lacks one
- Eliminates all include directives from mysql_priv.h
- Eliminates all circular include cycles
- Rename time.cc to sql_time.cc
- Rename mysql_priv.h to sql_priv.h
2010-03-31 16:05:33 +02:00
Jon Olav Hauglid
dd42aab840 Followup to Bug#45225 Locking: hang if drop table with no timeout
This patch prevents system threads and system table accesses from
using user-specified values for "lock_wait_timeout". Instead all
such accesses are done using the default value (1 year).

This prevents background tasks (such as replication, events, 
accessing stored function definitions, logging, reading time-zone
information, etc.) from failing in cases where the global value
of "lock_wait_timeout" is set very low.

The patch also simplifies the open tables API. Rather than adding
another convenience function for opening and locking system tables,
this patch removes most of the existing convenience functions for
open_and_lock_tables_derived(). Before, open_and_lock_tables() was
a convenience function that enforced derived tables handling, while
open_and_lock_tables_derived() was the main function where derived
tables handling was optional. Now, this convencience function is
gone and the main function is renamed to open_and_lock_tables(). 

No test case added as it would have required the use of --sleep to
check that system threads and system tables have a different timeout
value from the user-specified "lock_wait_timeout" system variable.
2010-02-24 18:04:00 +01:00
Alexander Nozdrin
9dc8347c1e Manual merge from mysql-trunk-merge.
Conflicts:
  - mysql-test/t/bug46080.test
2010-02-03 19:21:17 +03:00
Alexander Nozdrin
31ba3bf5cb Manual merge from mysql-5.1-bugteam.
Conflicts:
  - mysql-test/collections/default.experimental
  - mysql-test/suite/rpl/r/rpl_sp.result
2010-02-03 17:01:48 +03:00
Georgi Kodinov
be89d30f36 fixed various pb2 test failures on windows. 2010-02-02 14:17:21 +02:00
Marc Alff
67a48e1a4c WL#2360 Performance schema
Part V: performance schema implementation
2010-01-11 18:47:27 -07:00
Marc Alff
a4c3bc618b WL#2360 Performance schema
Part IV: sql instrumentation
2010-01-06 22:42:07 -07:00
Sergei Golubchik
ae2768ce9c WL#4738 streamline/simplify @@variable creation process
Bug#16565 mysqld --help --verbose does not order variablesBug#20413 sql_slave_skip_counter is not shown in show variables
Bug#20415 Output of mysqld --help --verbose is incomplete
Bug#25430 variable not found in SELECT @@global.ft_max_word_len;
Bug#32902 plugin variables don't know their names
Bug#34599 MySQLD Option and Variable Reference need to be consistent in formatting!
Bug#34829 No default value for variable and setting default does not raise error
Bug#34834 ? Is accepted as a valid sql mode
Bug#34878 Few variables have default value according to documentation but error occurs  
Bug#34883 ft_boolean_syntax cant be assigned from user variable to global var.
Bug#37187 `INFORMATION_SCHEMA`.`GLOBAL_VARIABLES`: inconsistent status
Bug#40988 log_output_basic.test succeeded though syntactically false.
Bug#41010 enum-style command-line options are not honoured (maria.maria-recover fails)
Bug#42103 Setting key_buffer_size to a negative value may lead to very large allocations 
Bug#44691 Some plugins configured as MYSQL_PLUGIN_MANDATORY in can be disabled
Bug#44797 plugins w/o command-line options have no disabling option in --help
Bug#46314 string system variables don't support expressions
Bug#46470 sys_vars.max_binlog_cache_size_basic_32 is broken
Bug#46586 When using the plugin interface the type "set" for options caused a crash.
Bug#47212 Crash in DBUG_PRINT in mysqltest.cc when trying to print octal number
Bug#48758 mysqltest crashes on sys_vars.collation_server_basic in gcov builds
Bug#49417 some complaints about mysqld --help --verbose output
Bug#49540 DEFAULT value of binlog_format isn't the default value
Bug#49640 ambiguous option '--skip-skip-myisam' (double skip prefix)
Bug#49644 init_connect and \0
Bug#49645 init_slave and multi-byte characters
Bug#49646 mysql --show-warnings crashes when server dies
2009-12-22 10:35:56 +01:00
Mikael Ronstrom
5a31a8f619 Merge 2009-12-14 17:08:30 +01:00
Mikael Ronstrom
9d625dca13 WL#5138, fixed review comments 2009-11-23 17:57:21 +01:00
Mikael Ronstrom
31d01ce301 WL#5138, review fixes 2009-11-20 16:43:21 +01:00
Mikael Ronstrom
a849487229 WL#5138 merged to mysql-next-mr 2009-11-20 16:23:32 +01:00
Mattias Jonsson
92bfebb66e Bug#32115: Bad use of Name_resolution_context from current LEX in partitioning
port from mysql-next (5.4) to mysql-next-mr-bugfixing (5.5/5.6?)

2755 Konstantin Osipov	2008-11-27
Bug#32115 will remove the pre-requisite to initialize LEX to open tables.
This dependency was added in 5.1 and was supposed to be removed in 6.0.
Remove asserts and initialization of LEX in places where we don't deal
with partitioned tables.
2009-11-20 00:13:54 +01:00
Konstantin Osipov
3dd1d5983b Backport of the following revision from 6.0-codebase:
----------------------------------------------------------
revno: 2617.1.12
committer: kostja@bodhi.(none)
timestamp: Sun 2008-04-20 11:18:52 +0400
message:
  A fix for Bug#32771 "events_bugs.test fails randomly".
  In Event_scheduler::stop(), which may be called from destructor,
  wait synchronously for the parallel Event_scheduler::stop() to
  complete before returning. This fixes a race between
  MySQL shutdown thread and the scheduler thread who could call
  stop() in parallel.
2009-10-13 22:29:28 +04:00
Mikael Ronstrom
c4ce446f19 Backported my_atomic from 6.0-codebase and added support for 64-bit atomics to enable removal of LOCK_thread_count from every query, removed LOCK_thread_count from use in dispatch_command and close of query which is used in every query, now uses atomic increments/decrements instead 2009-10-12 11:00:39 +02:00
Marc Alff
d5fd452d7c WL#2110 (SIGNAL)
WL#2265 (RESIGNAL)

Manual merge of SIGNAL and RESIGNAL to mysql-trunk-signal,
plus required dependencies.
2009-09-10 03:18:29 -06:00
Davi Arnaut
97ff334b37 Bug#43587: Putting event_scheduler=1 in init SQL file crashes
mysqld

The problem was that enabling the event scheduler inside a init
file caused the server to crash upon start-up. The crash occurred
because the event scheduler wasn't being initialized before the
commands in the init-file are processed.

The solution is to initialize the event scheduler before the init
file is read. The patch also disables the event scheduler during
bootstrap and makes the bootstrap operation robust in the
presence of background threads.
2009-07-24 15:45:42 -03:00
Konstantin Osipov
31997022d7 Code review for Bug#43587 Putting event_scheduler=1 in init SQL file crashes
mysqld
2009-07-24 20:20:46 +04:00
Gleb Shchepa
9c72a7bfea Merge from 5.0
******
manual merge 5.0-bugteam --> 5.1-bugteam (bug 38816)
2009-07-24 21:04:55 +05:00
Kristofer Pettersson
f7247addd6 Bug#38066 Events log 'note' level messages by default in the error log
The event scheduler logged start-, stop-execution messages in the error log
on lowest log-warning level which would lead to very large log files in 
a short time.
    
This patch changes this behavior so that no start-/stop-messages are logged.
Log messages stating successful execution are also removed.
2008-10-07 19:20:13 +02:00
mattiasj@mattiasj-laptop.(none)
32d7dd8679 Merge mattiasj-laptop.(none):/home/mattiasj/clones/mysql-5.1-main
into  mattiasj-laptop.(none):/home/mattiasj/clones/mysql-5.1-last_with_main
2007-11-12 21:09:48 +01:00
istruewing@stella.local
3eaf82a175 Bug#31210 - INSERT DELAYED crashes server when used on
partitioned table

Trying INSERT DELAYED on a partitioned table, that has not been
used right before, crashes the server. When a table is used for
select or update, it is kept open for some time. This period I
mean with "right before".

Information about partitioning of a table is stored in form of
a string in the .frm file. Parsing of this string requires a
correctly set up lexical analyzer (lex). The partitioning code
uses a new temporary instance of a lex. But it does still refer
to the previously active lex. The delayd insert thread does not
initialize its lex though...

Added initialization for thd->lex before open table in the delayed
thread and at all other places where it is necessary to call
lex_start() if all tables would be partitioned and need to parse
the .frm file.
2007-11-05 16:25:40 +01:00
anozdrin/alik@station.
c60397ef19 Patch for BUG#31111: --read-only crashes MySQL (events fail to load).
There actually were several problems here:
  - WRITE-lock is required to load events from the mysql.event table,
    but in the read-only mode an ordinary user can not acquire it;
  - Security_context::master_access attribute was not properly
    initialized in Security_context::init(), which led to differences
    in behavior with and without debug configure options.
  - if the server failed to load events from mysql.event, it forgot to
    close the mysql.event table, that led to the coredump, described
    in the bug report.

The patch is to fix all these problems:
  - Use the super-user to acquire WRITE-lock on the mysql.even table;
  - The WRITE-lock is acquired by the event scheduler in two cases:
    - on initial loading of events from the database;
    - when an event has been executed, so its attributes should
      be updated.
    Other cases when WRITE-lock is needed for the mysql.event table
    happen under the user account. So, nothing should be changed there
    for the read-only mode. The user is able to create/update/drop
    an event only if he is a super-user.
  - Initialize Security_context::master_access;
  - Close the mysql.event table in case something went wrong.
2007-10-19 19:57:08 +04:00
kostja@bodhi.(none)
2537a87fb5 Provide initial module structure to Doxygen. 2007-08-15 19:08:44 +04: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
kostja@bodhi.(none)
5005ae3656 Fix for Bug#28963 "Missing DBUG_RETURN message when stopping event
scheduler".
Add missing DBUG_VOID_RETURN
2007-06-10 13:16:02 +04:00
andrey@whirlpool.mysql.com
ce856126d9 Fix for bug#28075 COM_DEBUG crashes mysqld
Uninitialized in the constructor member variables were
pointing to nirvana and causing a crash when debug information
of the Event Scheduler was dumped in result to COM_DEBUG
packet sent to the server.
2007-05-21 10:51:11 +02:00
kostja@vajra.(none)
eccd5ae201 An attempt to fix a sporadic valgrind memory leak in Event Scheduler:
streamline the event worker thread work flow and try to eliminate
possibilities for memory corruptions that might have been
lurking in previous (complicated) code.
This patch: 
 * removes Event_job_data::compile that was never used
 * cleans up Event_job_data::execute to minimize juggling with
   thread context and eliminate unneded code paths
 * Implements Security_context::change/restore_security_context
   to be able to re-use these methods in all stored programs
This is to maybe fix Bug#27733 "Valgrind failures in 
remove_table_from_cache".
Review comments applied.
2007-04-13 16:35:56 -04:00
kostja@vajra.(none)
e974ea5ec9 Remove a race between Event Scheduler shutdown and SHOW PROCESSLIST.
This will hopefully fix events.test failure on vmware-win32, 
where scheduling is very primitive.
2007-04-06 19:44:14 +04:00
kostja@vajra.(none)
00b85c49da Post-merge and post-review fixes for the patch for
Bug#23631 "Events: SHOW VARIABLES doesn't work when mysql.event 
is damaged:
2007-04-05 20:47:22 +04:00
kostja@vajra.(none)
98db230086 A set of changes aiming to make the Event Scheduler more user-friendly
when there are no up-to-date system tables to support it:
 - initialize the scheduler before reporting "Ready for connections".
   This ensures that warnings, if any, are printed before "Ready for
   connections", and this message is not mangled.
 - do not abort the scheduler if there are no system tables
 - check the tables once at start up, remember the status and disable
   the scheduler if the tables are not up to date.
   If one attempts to use the scheduler with bad tables,
   issue an error message.
 - clean up the behaviour of the module under LOCK TABLES and pre-locking
   mode
 - make sure implicit commit of Events DDL works as expected.
 - add more tests


Collateral clean ups in the events code.

This patch fixes Bug#23631 Events: SHOW VARIABLES doesn't work 
when mysql.event is damaged
2007-04-05 15:24:34 +04:00
kostja@bodhi.local
bf6210bed5 Change module prefix in error messages: SCHEDULER -> Event Scheduler,
to not collide with the recently introduced thread scheduler module.
2007-03-23 19:14:08 +03:00
kostja@bodhi.local
094612854d Trivial cleanups and whitespace change in Event Scheduler code.
A larger patch is to come, this is to exclude rudimentary changes
from it.
2007-03-23 18:14:03 +03:00
kroki/tomash@moonlight.home
6d8f6b5bfd BUG#16420: Events: timestamps become UTC
BUG#26429: SHOW CREATE EVENT is incorrect for an event that
           STARTS NOW()
BUG#26431: Impossible to re-create an event from backup if its
           STARTS clause is in the past
WL#3698: Events: execution in local time zone

The problem was that local times specified by the user in AT, STARTS
and ENDS of CREATE EVENT/ALTER EVENT statement were converted to UTC,
and the original time zone was forgotten.  This way, event scheduler
couldn't honor Daylight Saving Time shifts, and times shown to the
user were also in UTC.  Additionally, CREATE EVENT didn't allow times
in the past, thus preventing straightforward event restoration from
old backups.

This patch reworks event scheduler time computations, performing them
in the time zone associated with the event.  Also it allows times to
be in the past.

The patch adds time_zone column to mysql.event table.

NOTE: The patch is almost final, but the bug#9953 should be pushed
first.
2007-03-16 17:31:07 +03:00
malff/marcsql@weblab.(none)
86c6eb7089 Fixed compiler warnings 2007-03-01 16:39:00 -07:00
malff/marcsql@weblab.(none)
e46083c9cf Manual merge of 5.1 into 5.1-runtime 2007-03-01 13:47:28 -07:00
kroki/tomash@moonlight.home
84ca9c72ca Fix for memory leaks introduced with the push of patch for bug#22740.
Original patch did not have these leaks, they were introduced later
during manual applying of the patch.
2007-01-31 21:16:48 +03:00
kroki/tomash@moonlight.home
c06c7356e3 Fix for bug#22740 Events: Decouple Event_queue from Event_db_repository
This patch implements the idea of the bug report by making Event_queue
unaware of Event_db_repository by making a higher level class - Events,
which is aware of most of all classes, responsible for passing all data
needed for adding/updating/deleting an event to/from the queue.

Introduces few new classes :
 - Event_worker_thread
 - Event_queue_element_for_exec
2007-01-29 20:46:29 +03:00
kent@mysql.com/kent-amd64.(none)
1e3237fefa Many files:
Changed header to GPL version 2 only
2006-12-27 02:23:51 +01: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@mysql.com/nosik.monty.fi
0e149b7170 Removed compiler warnings
Ensure that my_size_t is always unsigned (to get predictiable results from system to system)
Removed some %lld, as these are not portable
2006-11-27 18:16:08 +02:00
monty@mysql.com/nosik.monty.fi
fa81a82e7f Fixed a LOT of compiler warnings
Added missing DBUG_RETURN statements (in mysqldump.c)
Added missing enums
Fixed a lot of wrong DBUG_PRINT() statements, some of which could cause crashes
Removed usage of %lld and %p in printf strings as these are not portable or produces different results on different systems.
2006-11-27 01:47:38 +02:00
andrey@example.com
25862a8671 WL#3337 (Event scheduler new architecture)
Remove SHOW SCHEDULER STATUS command and migrate the
information output to `mysqladmin debug` (COM_DEBUG)

SHOW SCHEDULER STATUS was introduced in 5.1.11, provided
some debug information about event scheduler internals and
was enabled only in debug builds.
2006-09-12 12:26:12 +02:00
andrey@example.com
4e6cfdcf11 remove unused artifacts 2006-09-01 14:25:29 +02:00
andrey@example.com
d97ee5fee4 fix build failure on SLES9 2006-09-01 14:15:47 +02:00
andrey@example.com
af07dcd335 post-merge fix 2006-09-01 14:08:50 +02:00
andrey@fifo.vaih.whnetz
7b5916a26c WL#3337 (Event scheduler new architecture)
This patch makes the relationship between Event_scheduler and Event_queue
unidirectional from the former to the latter.




The change is that the conditional on which the scheduler sleeped has been
moved to the Event_queue and the latter does not call anymore
Event_scheduler::queue_changed(), which in turn has be removed.
2006-08-31 17:18:39 +02:00