Commit graph

119 commits

Author SHA1 Message Date
Konstantin Osipov
ce5c87a3d3 Backport of:
----------------------------------------------------------
revno: 2617.69.20
committer: Konstantin Osipov <kostja@sun.com>
branch nick: 5.4-4284-1-assert
timestamp: Thu 2009-08-13 18:29:55 +0400
message:
  WL#4284 "Transactional DDL locking"
  A review fix.
  Since WL#4284 implementation separated MDL_request and MDL_ticket,
  MDL_request becamse a utility object necessary only to get a ticket.
  Store it by-value in TABLE_LIST with the intent to merge
  MDL_request::key with table_list->table_name and table_list->db
  in future.
  Change the MDL subsystem to not require MDL_requests to
  stay around till close_thread_tables().
  Remove the list of requests from the MDL context.
  Requests for shared metadata locks acquired in open_tables()
  are only used as a list in recover_from_failed_open_table_attempt(),
  which calls mdl_context.wait_for_locks() for this list.
  To keep such list for recover_from_failed_open_table_attempt(),
  introduce a context class (Open_table_context), that collects
  all requests.
  A lot of minor cleanups and simplications that became possible
  with this change.


sql/event_db_repository.cc:
  Remove alloc_mdl_requests(). Now MDL_request instance is a member
  of TABLE_LIST, and init_one_table() initializes it.
sql/ha_ndbcluster_binlog.cc:
  Remove now unnecessary declaration and initialization
  of binlog_mdl_request.
sql/lock.cc:
  No need to allocate MDL requests in lock_table_names() now.
sql/log.cc:
  Use init_one_table() method, remove alloc_mdl_requests(),
  which is now unnecessary.
sql/log_event.cc:
  No need to allocate mdl_request separately now.
  Use init_one_table() method.
sql/log_event_old.cc:
  Update to the new signature of close_tables_for_reopen().
sql/mdl.cc:
  Update try_acquire_exclusive_lock() to be more easy to use.
  Function lock_table_name_if_not_cached() has been removed.
  Make acquire_shared_lock() signature consistent with
  try_acquire_exclusive_lock() signature.
  Remove methods that are no longer used.
  Update comments.
sql/mdl.h:
  Implement an assignment operator that doesn't
  copy MDL_key (MDL_key::operator= is private and
  should remain private).
  This is a hack to work-around assignment of TABLE_LIST
  by value in several places. Such assignments violate
  encapsulation, since only perform a shallow copy.
  In most cases these assignments are a hack on their own.
sql/mysql_priv.h:
  Update signatures of close_thread_tables() and close_tables_for_reopen().
sql/sp.cc:
  Allocate TABLE_LIST in thd->mem_root.
  Use init_one_table().
sql/sp_head.cc:
  Use init_one_table().
  Remove thd->locked_tables_root, it's no longer needed.
sql/sql_acl.cc:
  Use init_mdl_requests() and init_one_table().
sql/sql_base.cc:
  Update to new signatures of try_acquire_shared_lock() and
  try_acquire_exclusive_lock().
  Remove lock_table_name_if_not_cached().
  Fix a bug in open_ltable() that would not return ER_LOCK_DEADLOCK
  in case of a failed lock_tables() and a multi-statement
  transaction.
  Fix a bug in open_and_lock_tables_derived() that would
  not return ER_LOCK_DEADLOCK in case of a multi-statement
  transaction and a failure of lock_tables().
  Move assignment of enum_open_table_action to a method of Open_table_context, a new class that maintains information
  for backoff actions.
  Minor rearrangements of the code.
  Remove alloc_mdl_requests() in functions that work with system
  tables: instead the patch ensures that callers always initialize
  TABLE_LIST argument.
sql/sql_class.cc:
  THD::locked_tables_root is no more.
sql/sql_class.h:
  THD::locked_tables_root is no more.
  Add a declaration for Open_table_context class.
sql/sql_delete.cc:
  Update to use the simplified MDL API.
sql/sql_handler.cc:
  TABLE_LIST::mdl_request is stored by-value now.
  Ensure that mdl_request.ticket is NULL for every request
  that is passed into MDL, to satisfy MDL asserts.
  @ sql/sql_help.cc
  Function open_system_tables_for_read() no longer initializes
  mdl_requests.
  Move TABLE_LIST::mdl_request initialization closer to
  TABLE_LIST initialization.
sql/sql_help.cc:
  Function open_system_tables_for_read() no longer initializes
  mdl_requests.
  Move TABLE_LIST::mdl_request initialization closer to
  TABLE_LIST initialization.
sql/sql_insert.cc:
  Remove assignment by-value of TABLE_LIST in
  TABLEOP_HOOKS. We can't carry over a granted
  MDL ticket from one table list to another.
sql/sql_parse.cc:
  Change alloc_mdl_requests() -> init_mdl_requests().
  @todo We can remove init_mdl_requests() altogether
  in some places: all places that call add_table_to_list()
  already have mdl requests initialized.
sql/sql_plugin.cc:
  Use init_one_table().
  THD::locked_tables_root is no more.
sql/sql_servers.cc:
  Use init_one_table().
sql/sql_show.cc:
  Update acquire_high_priority_shared_lock() to use
  TABLE_LIST::mdl_request rather than allocate an own.
  Fix get_trigger_table_impl() to use init_one_table(),
  check for out of memory, follow the coding style.
sql/sql_table.cc:
  Update to work with TABLE_LIST::mdl_request by-value.
  Remove lock_table_name_if_not_cached().
  The code that used to delegate to it is quite simple and
  concise without it now.
sql/sql_udf.cc:
  Use init_one_table().
sql/sql_update.cc:
  Update to use the new signature of close_tables_for_reopen().
sql/table.cc:
  Move re-setting of mdl_requests for prepared statements
  and stored procedures from close_thread_tables() to
  reinit_stmt_before_use().
  Change alloc_mdl_requests() to init_mdl_requests().
  init_mdl_requests() is a hack that can't be deleted
  until we don't have a list-aware TABLE_LIST constructor.
  Hopefully its use will be minimal
sql/table.h:
  Change alloc_mdl_requests() to init_mdl_requests()
  TABLE_LIST::mdl_request is stored by value.
sql/tztime.cc:
  We no longer initialize mdl requests in open_system_tables_for*()
  functions. Move this initialization closer to initialization
  of the rest of TABLE_LIST members.
storage/myisammrg/ha_myisammrg.cc:
  Simplify mdl_request initialization.
2009-12-08 12:57:07 +03:00
Konstantin Osipov
f477e66ec5 Backport of:
------------------------------------------------------------
revno: 2617.23.18
committer: Davi Arnaut <Davi.Arnaut@Sun.COM>
branch nick: 4284-6.0
timestamp: Mon 2009-03-02 18:18:26 -0300
message:
Bug#989: If DROP TABLE while there's an active transaction, wrong binlog order
WL#4284: Transactional DDL locking

This is a prerequisite patch:

These changes are intended to split lock requests from granted
locks and to allow the memory and lifetime of granted locks to
be managed within the MDL subsystem. Furthermore, tickets can
now be shared and therefore are used to satisfy multiple lock
requests, but only shared locks can be recursive.

The problem is that the MDL subsystem morphs lock requests into
granted locks locks but does not manage the memory and lifetime
of lock requests, and hence, does not manage the memory of
granted locks either. This can be problematic because it puts the
burden of tracking references on the users of the subsystem and
it can't be easily done in transactional contexts where the locks
have to be kept around for the duration of a transaction.

Another issue is that recursive locks (when the context trying to
acquire a lock already holds a lock on the same object) requires
that each time the lock is granted, a unique lock request/granted
lock structure structure must be kept around until the lock is
released. This can lead to memory leaks in transactional contexts
as locks taken during the transaction should only be released at
the end of the transaction. This also leads to unnecessary wake
ups (broadcasts) in the MDL subsystem if the context still holds
a equivalent of the lock being released.

These issues are exacerbated due to the fact that WL#4284 low-level
design says that the implementation should "2) Store metadata locks
in transaction memory root, rather than statement memory root" but
this is not possible because a memory root, as implemented in mysys,
requires all objects allocated from it to be freed all at once.

This patch combines review input and significant code contributions
from Konstantin Osipov (kostja) and Dmitri Lenev (dlenev).


mysql-test/r/mdl_sync.result:
  Add test case result.
mysql-test/t/mdl_sync.test:
  Add test case for shared lock upgrade case.
sql/event_db_repository.cc:
  Rename mdl_alloc_lock to mdl_request_alloc.
sql/ha_ndbcluster_binlog.cc:
  Use new function names to initialize MDL lock requests.
sql/lock.cc:
  Rename MDL functions.
sql/log_event.cc:
  The MDL request now holds the table and database name data (MDL_KEY).
sql/mdl.cc:
  Move the MDL key to the MDL_LOCK structure in order to make the
  object suitable for allocation from a fixed-size allocator. This
  allows the simplification of the lists in the MDL_LOCK object,
  which now are just two, one for granted tickets and other for
  waiting (upgraders) tickets.
  
  Recursive requests for a shared lock on the same object can now
  be granted using the same lock ticket. This schema is only used
  for shared locks because that the only case that matters. This
  is used to avoid waste of resources in case a context (connection)
  already holds a shared lock on a object.
sql/mdl.h:
  Introduce a metadata lock object key which is used  to uniquely
  identify lock objects.
  
  Separate the structure used to represent pending lock requests
  from the structure used to represent granted metadata locks.
  
  Rename functions used to manipulate locks requests in order to
  have a more consistent function naming schema.
sql/sp_head.cc:
  Rename mdl_alloc_lock to mdl_request_alloc.
sql/sql_acl.cc:
  Rename alloc_mdl_locks to alloc_mdl_requests.
sql/sql_base.cc:
  Various changes to accommodate that lock requests are separated
  from lock tickets (granted locks).
sql/sql_class.h:
  Last acquired lock before the savepoint was set.
sql/sql_delete.cc:
  Various changes to accommodate that lock requests are separated
  from lock tickets (granted locks).
sql/sql_handler.cc:
  Various changes to accommodate that lock requests are separated
  from lock tickets (granted locks).
sql/sql_insert.cc:
  Rename alloc_mdl_locks to alloc_mdl_requests.
sql/sql_parse.cc:
  Rename alloc_mdl_locks to alloc_mdl_requests.
sql/sql_plist.h:
  Typedef for iterator type.
sql/sql_plugin.cc:
  Rename alloc_mdl_locks to alloc_mdl_requests.
sql/sql_servers.cc:
  Rename alloc_mdl_locks to alloc_mdl_requests.
sql/sql_show.cc:
  Various changes to accommodate that lock requests are separated
  from lock tickets (granted locks).
sql/sql_table.cc:
  Various changes to accommodate that lock requests are separated
  from lock tickets (granted locks).
sql/sql_trigger.cc:
  Save reference to the lock ticket so it can be downgraded later.
sql/sql_udf.cc:
  Rename alloc_mdl_locks to alloc_mdl_requests.
sql/table.cc:
  Rename mdl_alloc_lock to mdl_request_alloc.
sql/table.h:
  Separate MDL lock requests from lock tickets (granted locks).
storage/myisammrg/ha_myisammrg.cc:
  Rename alloc_mdl_locks to alloc_mdl_requests.
2009-12-04 02:29:40 +03:00
Konstantin Osipov
b7e8b01644 Backport of:
----------------------------------------------------------
revno: 2630.4.31
committer: Konstantin Osipov <konstantin@mysql.com>
branch nick: mysql-6.0-3726
timestamp: Thu 2008-06-12 06:23:08 +0400
message:
  Extend the signature of TABLE_LIST::init_one_table() to 
  initialize lengths

This is part of WL#3726 post-review fixes.
2009-12-02 18:37:10 +03:00
Konstantin Osipov
1ed585adff Backport of:
---------------------------------------------
2630.7.3 Konstantin Osipov       2008-06-02
        Various style changes preceding the removal of reopen_table().
(Post-review fixes for WL#3726).


sql/event_db_repository.cc:
  Update to use the new signature of TABLE_LIST::init_one_table().
sql/mysql_priv.h:
  Move close_cached_table() and wait_while_table_is_used()
  to sql_base.cc.
sql/sql_base.cc:
  Move close_cached_table() and wait_while_table_is_used()
  from sql_table.cc.
sql/sql_table.cc:
  Move close_cached_table() and wait_while_table_is_used()
  to sql_base.cc.
sql/table.h:
  Update the signature of TABLE_LIST::init_one_table().
2009-12-01 16:27:03 +03:00
Konstantin Osipov
eff3780dd8 Initial import of WL#3726 "DDL locking for all metadata objects".
Backport of:
------------------------------------------------------------
revno: 2630.4.1
committer: Dmitry Lenev <dlenev@mysql.com>
branch nick: mysql-6.0-3726-w
timestamp: Fri 2008-05-23 17:54:03 +0400
message:
  WL#3726 "DDL locking for all metadata objects".

  After review fixes in progress.
------------------------------------------------------------

This is the first patch in series. It transforms the metadata 
locking subsystem to use a dedicated module (mdl.h,cc). No 
significant changes in the locking protocol. 
The import passes the test suite with the exception of 
deprecated/removed 6.0 features, and MERGE tables. The latter
are subject to a fix by WL#4144.
Unfortunately, the original changeset comments got lost in a merge,
thus this import has its own (largely insufficient) comments.

This patch fixes Bug#25144 "replication / binlog with view breaks".
Warning: this patch introduces an incompatible change:
Under LOCK TABLES, it's no longer possible to FLUSH a table that 
was not locked for WRITE.
Under LOCK TABLES, it's no longer possible to DROP a table or
VIEW that was not locked for WRITE.

******
Backport of:
------------------------------------------------------------
revno: 2630.4.2
committer: Dmitry Lenev <dlenev@mysql.com>
branch nick: mysql-6.0-3726-w
timestamp: Sat 2008-05-24 14:03:45 +0400
message:
  WL#3726 "DDL locking for all metadata objects".

  After review fixes in progress.

******
Backport of:
------------------------------------------------------------
revno: 2630.4.3
committer: Dmitry Lenev <dlenev@mysql.com>
branch nick: mysql-6.0-3726-w
timestamp: Sat 2008-05-24 14:08:51 +0400
message:
  WL#3726 "DDL locking for all metadata objects"

  Fixed failing Windows builds by adding mdl.cc to the lists
  of files needed to build server/libmysqld on Windows.

******
Backport of:
------------------------------------------------------------
revno: 2630.4.4
committer: Dmitry Lenev <dlenev@mysql.com>
branch nick: mysql-6.0-3726-w
timestamp: Sat 2008-05-24 21:57:58 +0400
message:
  WL#3726 "DDL locking for all metadata objects".

  Fix for assert failures in kill.test which occured when one
  tried to kill ALTER TABLE statement on merge table while it
  was waiting in wait_while_table_is_used() for other connections
  to close this table.

  These assert failures stemmed from the fact that cleanup code
  in this case assumed that temporary table representing new
  version of table was open with adding to THD::temporary_tables
  list while code which were opening this temporary table wasn't
  always fulfilling this.

  This patch changes code that opens new version of table to
  always do this linking in. It also streamlines cleanup process
  for cases when error occurs while we have new version of table
  open.

******
WL#3726 "DDL locking for all metadata objects"
Add libmysqld/mdl.cc to .bzrignore.
******
Backport of:
------------------------------------------------------------
revno: 2630.4.6
committer: Dmitry Lenev <dlenev@mysql.com>
branch nick: mysql-6.0-3726-w
timestamp: Sun 2008-05-25 00:33:22 +0400
message:
  WL#3726 "DDL locking for all metadata objects".

  Addition to the fix of assert failures in kill.test caused by
  changes for this worklog.


Make sure we close the new table only once.

.bzrignore:
  Add libmysqld/mdl.cc
libmysqld/CMakeLists.txt:
  Added mdl.cc to the list of files needed for building of libmysqld.
libmysqld/Makefile.am:
  Added files implementing new meta-data locking subsystem to the server.
mysql-test/include/handler.inc:
  Use separate connection for waiting while threads performing DDL
  operations conflicting with open HANDLER tables reach blocked
  state. This is required because now we check and close tables open
  by HANDLER statements in this connection conflicting with DDL in
  another each time open_tables() is called and thus select from I_S
  which is used for waiting will unblock DDL operations if issued
  from connection with open HANDLERs.
mysql-test/r/create.result:
  Adjusted test case after change in implementation of CREATE TABLE
  ... SELECT.  We no longer have special check in open_table() which
  catches the case when we select from the table created. Instead we
  rely on unique_table() call which happens after opening and
  locking all tables.
mysql-test/r/flush.result:
  FLUSH TABLES WITH READ LOCK can no longer happen under LOCK
  TABLES.  Updated test accordingly.
mysql-test/r/flush_table.result:
  Under LOCK TABLES we no longer allow to do FLUSH TABLES for tables
  locked for read. Updated test accordingly.
mysql-test/r/handler_innodb.result:
  Use separate connection for waiting while threads performing DDL
  operations conflicting with open HANDLER tables reach blocked
  state. This is required because now we check and close tables open
  by HANDLER statements in this connection conflicting with DDL in
  another each time open_tables() is called and thus select from I_S
  which is used for waiting will unblock DDL operations if issued
  from connection with open HANDLERs.
mysql-test/r/handler_myisam.result:
  Use separate connection for waiting while threads performing DDL
  operations conflicting with open HANDLER tables reach blocked
  state. This is required because now we check and close tables open
  by HANDLER statements in this connection conflicting with DDL in
  another each time open_tables() is called and thus select from I_S
  which is used for waiting will unblock DDL operations if issued
  from connection with open HANDLERs.
mysql-test/r/information_schema.result:
  Additional test for WL#3726 "DDL locking for all metadata
  objects".  Check that we use high-priority metadata lock requests
  when filling I_S tables.
  
  Rearrange tests to match 6.0 better (fewer merge conflicts).
mysql-test/r/kill.result:
  Added tests checking that DDL and DML statements waiting for
  metadata locks can be interrupted by KILL command.
mysql-test/r/lock.result:
  One no longer is allowed to do DROP VIEW under LOCK TABLES even if
  this view is locked by LOCK TABLES. The problem is that in such
  situation write locks on view are not mutually exclusive so
  upgrading metadata lock which is required for dropping of view
  will lead to deadlock.
mysql-test/r/partition_column_prune.result:
  Update results (same results in 6.0), WL#3726
mysql-test/r/partition_pruning.result:
  Update results (same results in 6.0), WL#3726
mysql-test/r/ps_ddl.result:
  We no longer invalidate prepared CREATE TABLE ... SELECT statement
  if target table changes. This is OK since it is not strictly
  necessary.
  
  
  The first change is wrong, is caused by FLUSH TABLE
  now flushing all unused tables. This is a regression that
  Dmitri fixed in 6.0 in a follow up patch.
mysql-test/r/sp.result:
  Under LOCK TABLES we no longer allow accessing views which were
  not explicitly locked. To access view we need to obtain metadata
  lock on it and doing this under LOCK TABLES may lead to deadlocks.
mysql-test/r/view.result:
  One no longer is allowed to do DROP VIEW under LOCK TABLES even if
  this view is locked by LOCK TABLES. The problem is that in such
  situation even "write locks" on view are not mutually exclusive so
  upgrading metadata lock which is required for dropping of view
  will lead to deadlock
mysql-test/r/view_grant.result:
  ALTER VIEW implementation was changed to open a view only after
  checking that user which does alter has appropriate privileges on
  it. This means that in case when user's privileges are
  insufficient for this we won't check that new view definer is the
  same as original one or user performing alter has SUPER privilege.
  Adjusted test case accordingly.
mysql-test/r/view_multi.result:
  Added test case for bug#25144 "replication / binlog with view
  breaks".
mysql-test/suite/rpl/t/disabled.def:
  Disable test for deprecated features (they don't work with new MDL).
mysql-test/t/create.test:
  Adjusted test case after change in implementation of CREATE TABLE
  ... SELECT.  We no longer have special check in open_table() which
  catches the case when we select from the table created. Instead we
  rely on unique_table() call which happens after opening and
  locking all tables.
mysql-test/t/disabled.def:
  Disable merge.test, subject of WL#4144
mysql-test/t/flush.test:
  
  FLUSH TABLES WITH READ LOCK can no longer happen under LOCK
  TABLES.  Updated test accordingly.
mysql-test/t/flush_table.test:
  Under LOCK TABLES we no longer allow to do FLUSH TABLES for tables
  locked for read. Updated test accordingly.
mysql-test/t/information_schema.test:
  Additional test for WL#3726 "DDL locking for all metadata
  objects".  Check that we use high-priority metadata lock requests
  when filling I_S tables.
  
  Rearrange the results for easier merges with 6.0.
mysql-test/t/kill.test:
  Added tests checking that DDL and DML statements waiting for
  metadata locks can be interrupted by KILL command.
mysql-test/t/lock.test:
  One no longer is allowed to do DROP VIEW under LOCK TABLES even if
  this view is locked by LOCK TABLES. The problem is that in such
  situation write locks on view are not mutually exclusive so
  upgrading metadata lock which is required for dropping of view
  will lead to deadlock.
mysql-test/t/lock_multi.test:
  Adjusted test case to the changes of status in various places
  caused by change in implementation FLUSH TABLES WITH READ LOCK,
  which is now takes global metadata lock before flushing tables and
  therefore waits on at these places.
mysql-test/t/ps_ddl.test:
  We no longer invalidate prepared CREATE TABLE ... SELECT statement
  if target table changes. This is OK since it is not strictly
  necessary.
  
  
  The first change is wrong, is caused by FLUSH TABLE
  now flushing all unused tables. This is a regression that
  Dmitri fixed in 6.0 in a follow up patch.
mysql-test/t/sp.test:
  Under LOCK TABLES we no longer allow accessing views which were
  not explicitly locked. To access view we need to obtain metadata
  lock on it and doing this under LOCK TABLES may lead to deadlocks.
mysql-test/t/trigger_notembedded.test:
  Adjusted test case to the changes of status in various places
  caused by change in implementation FLUSH TABLES WITH READ LOCK,
  which is now takes global metadata lock before flushing tables and
  therefore waits on at these places.
mysql-test/t/view.test:
  One no longer is allowed to do DROP VIEW under LOCK TABLES even if
  this view is locked by LOCK TABLES. The problem is that in such
  situation even "write locks" on view are not mutually exclusive so
  upgrading metadata lock which is required for dropping of view
  will lead to deadlock.
mysql-test/t/view_grant.test:
  ALTER VIEW implementation was changed to open a view only after
  checking that user which does alter has appropriate privileges on
  it. This means that in case when user's privileges are
  insufficient for this we won't check that new view definer is the
  same as original one or user performing alter has SUPER privilege.
  Adjusted test case accordingly.
mysql-test/t/view_multi.test:
  Added test case for bug#25144 "replication / binlog with view
  breaks".
sql/CMakeLists.txt:
  Added mdl.cc to the list of files needed for building of server.
sql/Makefile.am:
  Added files implementing new meta-data locking subsystem to the
  server.
sql/event_db_repository.cc:
  
  Allocate metadata lock requests objects (MDL_LOCK) on execution
  memory root in cases when TABLE_LIST objects is also allocated
  there or on stack.
sql/ha_ndbcluster.cc:
  Adjusted code to work nicely with new metadata locking subsystem.
  close_cached_tables() no longer has wait_for_placeholder argument.
  Instead of relying on this parameter and related behavior FLUSH
  TABLES WITH READ LOCK now takes global shared metadata lock.
sql/ha_ndbcluster_binlog.cc:
  Adjusted code to work with new metadata locking subsystem.
  close_cached_tables() no longer has wait_for_placeholder argument.
  Instead of relying on this parameter and related behavior FLUSH
  TABLES WITH READ LOCK now takes global shared metadata lock.
sql/handler.cc:
  update_frm_version():
    Directly update TABLE_SHARE::mysql_version member instead of
    going through all TABLE instances for this table (old code was a
    legacy from pre-table-definition-cache days).
sql/lock.cc:
  Use new metadata locking subsystem. Threw away most of functions
  related to name locking as now one is supposed to use metadata
  locking API instead.  In lock_global_read_lock() and
  unlock_global_read_lock() in order to avoid problems with global
  read lock sneaking in at the moment when we perform FLUSH TABLES
  or ALTER TABLE under LOCK TABLES and when tables being reopened
  are protected only by metadata locks we also have to take global
  shared meta data lock.
sql/log_event.cc:
  Adjusted code to work with new metadata locking subsystem.  For
  tables open by slave thread for applying RBR events allocate
  memory for lock request object in the same chunk of memory as
  TABLE_LIST objects for them. In order to ensure that we keep these
  objects around until tables are open always close tables before
  calling Relay_log_info::clear_tables_to_lock(). Use new auxiliary
  Relay_log_info::slave_close_thread_tables() method to enforce
  this.
sql/log_event_old.cc:
  Adjusted code to work with new metadata locking subsystem.  Since
  for tables open by slave thread for applying RBR events memory for
  lock request object is allocated in the same chunk of memory as
  TABLE_LIST objects for them we have to ensure that we keep these
  objects around until tables are open. To ensure this we always
  close tables before calling
  Relay_log_info::clear_tables_to_lock(). To enfore this we use
  new auxiliary Relay_log_info::slave_close_thread_tables()
  method.
sql/mdl.cc:
  Implemented new metadata locking subsystem and API described in
  WL3726 "DDL locking for all metadata objects".
sql/mdl.h:
  Implemented new metadata locking subsystem and API described in
  WL3726 "DDL locking for all metadata objects".
sql/mysql_priv.h:
  - close_thread_tables()/close_tables_for_reopen() now has one more
    argument which indicates that metadata locks should be released
    but not removed from the context in order to be used later in
    mdl_wait_for_locks() and tdc_wait_for_old_version().
  - close_cached_table() routine is no longer public.
  - Thread waiting in wait_while_table_is_used() can be now killed
    so this function returns boolean to make caller aware of such
    situation.
  - We no longer have  table cache as separate entity instead used
    and unused TABLE instances are linked to TABLE_SHARE objects in
    table definition cache.
  - Now third argument of open_table() is also used for requesting
    table repair or auto-discovery of table's new definition. So its
    type was changed from bool to enum.
  - Added tdc_open_view() function for opening view by getting its
    definition from disk (and table cache in future).
  - reopen_name_locked_table() no longer needs "link_in" argument as
    now we have exclusive metadata locks instead of dummy TABLE
    instances when this function is called.
  - find_locked_table() now takes head of list of TABLE instances
    instead of always scanning through THD::open_tables list. Also
    added find_write_locked_table() auxiliary.
  - reopen_tables(), close_cached_tables() no longer have
    mark_share_as_old and wait_for_placeholder arguments. Instead of
    relying on this parameters and related behavior FLUSH TABLES
    WITH READ LOCK now takes global shared metadata lock.
  - We no longer need drop_locked_tables() and
    abort_locked_tables().
  - mysql_ha_rm_tables() now always assume that LOCK_open is not
    acquired by caller.
  - Added notify_thread_having_shared_lock() callback invoked by
    metadata locking subsystem when acquiring an exclusive lock, for
    each thread that has a conflicting shared metadata lock.
  - Introduced expel_table_from_cache() as replacement for
    remove_table_from_cache() (the main difference is that this new
    function assumes that caller follows metadata locking protocol
    and never waits).
  - Threw away most of functions related to name locking. One should
    use new metadata locking subsystem and API instead.
sql/mysqld.cc:
  Got rid of call initializing/deinitializing table cache since now
  it is embedded into table definition cache. Added calls for
  initializing/ deinitializing metadata locking subsystem.
sql/rpl_rli.cc:
  Introduced auxiliary Relay_log_info::slave_close_thread_tables()
  method which is used for enforcing that we always close tables
  open for RBR before deallocating TABLE_LIST elements and MDL_LOCK
  objects for them.
sql/rpl_rli.h:
  Introduced auxiliary Relay_log_info::slave_close_thread_tables()
  method which is used for enforcing that we always close tables
  open for RBR before deallocating TABLE_LIST elements and MDL_LOCK
  objects for them.
sql/set_var.cc:
  close_cached_tables() no longer has wait_for_placeholder argument.
  Instead of relying on this parameter and related behavior FLUSH
  TABLES WITH READ LOCK now takes global shared metadata lock.
sql/sp_head.cc:
  For tables added to the statement's table list by prelocking
  algorithm we allocate these objects either on the same memory as
  corresponding table list elements or on THD::locked_tables_root
  (if we are building table list for LOCK TABLES).
sql/sql_acl.cc:
  Allocate metadata lock requests objects (MDL_LOCK) on execution
  memory root in cases when we use stack TABLE_LIST objects to open
  tables.  Got rid of redundant code by using unlock_locked_tables()
  function.
sql/sql_base.cc:
  Changed code to use new MDL subsystem. Got rid of separate table
  cache.  Now used and unused TABLE instances are linked to the
  TABLE_SHAREs in table definition cache.
  
  check_unused():
    Adjusted code to the fact that we no longer have separate table
    cache.  Removed dead code.
  table_def_free():
    Free TABLE instances referenced from TABLE_SHARE objects before
    destroying table definition cache.
  get_table_share():
    Added assert which ensures that noone will be able to access
    table (and its share) without acquiring some kind of metadata
    lock first.
  close_handle_and_leave_table_as_lock():
    Adjusted code to the fact that TABLE instances now are linked to
    list in TABLE_SHARE.
  list_open_tables():
    Changed this function to use table definition cache instead of
    table cache.
  free_cache_entry():
    Unlink freed TABLE elements from the list of all TABLE instances
    for the table in TABLE_SHARE.
  kill_delayed_thread_for_table():
    Added auxiliary for killing delayed insert threads for
    particular table.
  close_cached_tables():
    Got rid of wait_for_refresh argument as we now rely on global
    shared metadata lock to prevent FLUSH WITH READ LOCK sneaking in
    when we are reopening tables. Heavily reworked this function to
    use new MDL code and not to rely on separate table cache entity.
  close_open_tables():
    We no longer have separate table cache.
  close_thread_tables():
    Release metadata locks after closing all tables. Added skip_mdl
    argument which allows us not to remove metadata lock requests
    from the context in case when we are going to use this requests
    later in mdl_wait_for_locks() and tdc_wait_for_old_versions().
  close_thread_table()/close_table_for_reopen():
    Since we no longer have separate table cache and all TABLE
    instances are linked to TABLE_SHARE objects in table definition
    cache we have to link/unlink TABLE object to/from appropriate
    lists in the share.
  name_lock_locked_table():
   Moved redundant code to find_write_locked_table() function and
    adjusted code to the fact that wait_while_table_is_used() can
    now return with an error if our thread is killed.
  reopen_table_entry():
    We no longer need "link_in" argument as with MDL we no longer
    call this function with dummy TABLE object pre-allocated and
    added to the THD::open_tables. Also now we add newly-open TABLE
    instance to the list of share's used TABLE instances.
  table_cache_insert_placeholder():
    Got rid of name-locking legacy.
  lock_table_name_if_not_cached():
    Moved to sql_table.cc the only place where it is used. It was
    also reimplemented using new MDL API.
  open_table():
    - Reworked this function to use new MDL subsystem.
    - Changed code to deal with table definition cache directly
      instead of going through separate table cache.
    - Now third argument is also used for requesting table repair
      or auto-discovery of table's new definition. So its type was
      changed from bool to enum.
  find_locked_table()/find_write_locked_table():
    Accept head of list of TABLE objects as first argument and use
    this list instead of always searching in THD::open_tables list.
    Also added auxiliary for finding write-locked locked tables.
  reopen_table():
    Adjusted function to work with new MDL subsystem and to properly
    manuipulate with lists of used/unused TABLE instaces in
    TABLE_SHARE.
  reopen_tables():
    Removed mark_share_as_old parameter. Instead of relying on it
    and related behavior FLUSH TABLES WITH READ LOCK now takes
    global shared metadata lock. Changed code after removing
    separate table cache.
  drop_locked_tables()/abort_locked_tables():
    Got rid of functions which are no longer needed.
    unlock_locked_tables():
    Moved this function from sql_parse.cc and changed it to release
    memory which was used for allocating metadata lock requests for
    tables open and locked by LOCK TABLES.
  tdc_open_view():
    Intoduced function for opening a view by getting its definition
    from disk (and table cache in future).
  reopen_table_entry():
    Introduced function for opening table definitions while holding
    exclusive metatadata lock on it.
  open_unireg_entry():
   Got rid of this function. Most of its functionality is relocated
    to open_table() and open_table_fini() functions, and some of it
    to reopen_table_entry() and tdc_open_view(). Also code
    resposible for auto-repair and auto-discovery of tables was
    moved to separate function.
  open_table_entry_fini():
    Introduced function which contains common actions which finalize
    process of TABLE object creation.
  auto_repair_table():
    Moved code responsible for auto-repair of table being opened
    here.
  handle_failed_open_table_attempt()
    Moved code responsible for handling failing attempt to open
    table to one place (retry due to lock conflict/old version,
    auto-discovery and repair).
  open_tables():
    - Flush open HANDLER tables if they have old version of if there
      is conflicting metadata lock against them (before this moment
      we had this code in open_table()).
    - When we open view which should be processed via derived table
      on the second execution of prepared statement or stored
      routine we still should call open_table() for it in order to
      obtain metadata lock on it and prepare its security context.
    - In cases when we discover that some special handling of
      failure to open table is needed call
      handle_failed_open_table_attempt() which handles all such
      scenarios.
  open_ltable():
    Handling of various special scenarios of failure to open a table
    was moved to separate handle_failed_open_table_attempt()
    function.
  remove_db_from_cache():
    Removed this function as it is no longer used.
  notify_thread_having_shared_lock():
    Added callback which is invoked by MDL subsystem when acquiring
    an exclusive lock, for each thread that has a conflicting shared
    metadata lock.
  expel_table_from_cache():
    Introduced function for removing unused TABLE instances. Unlike
    remove_table_from_cache() it relies on caller following MDL
    protocol and having appropriate locks when calling it and thus
    does not do any waiting if table is still in use.
  tdc_wait_for_old_version():
    Added function which allows open_tables() to wait in cases when
    we discover that we should back-off due to presence of old
    version of table.
  abort_and_upgrade_lock():
    Use new MDL calls.
  mysql_wait_completed_table():
    Got rid of unused function.
  open_system_tables_for_read/for_update()/performance_schema_table():
    Allocate MDL_LOCK objects on execution memory root in cases when
    TABLE_LIST objects for corresponding tables is allocated on
    stack.
  close_performance_schema_table():
    Release metadata locks after closing tables.
  ******
  Use I_P_List for free/used tables list in the table share.
sql/sql_binlog.cc:
  Use Relay_log_info::slave_close_thread_tables() method to enforce
  that we always close tables open for RBR before deallocating
  TABLE_LIST elements and MDL_LOCK objects for them.
sql/sql_class.cc:
  Added meta-data locking contexts as part of Open_tables_state
  context.  Also introduced THD::locked_tables_root memory root
  which is to be used for allocating MDL_LOCK objects for tables in
  LOCK TABLES statement (end of lifetime for such objects is UNLOCK
  TABLES so we can't use statement or execution root for them).
sql/sql_class.h:
  Added meta-data locking contexts as part of Open_tables_state
  context.  Also introduced THD::locked_tables_root memory root
  which is to be used for allocating MDL_LOCK objects for tables in
  LOCK TABLES statement (end of lifetime for such objects is UNLOCK
  TABLES so we can't use statement or execution root for them).
  
  Note: handler_mdl_context and locked_tables_root and
  mdl_el_root will be removed by subsequent patches.
sql/sql_db.cc:
  mysql_rm_db() does not really need to call remove_db_from_cache()
  as it drops each table in the database using
  mysql_rm_table_part2(), which performs all necessary operations on
  table (definition) cache.
sql/sql_delete.cc:
  Use the new metadata locking API for TRUNCATE.
sql/sql_handler.cc:
  Changed HANDLER implementation to use new metadata locking
  subsystem.  Note that MDL_LOCK objects for HANDLER tables are
  allocated in the same chunk of heap memory as TABLE_LIST object
  for those tables.
sql/sql_insert.cc:
  mysql_insert():
    find_locked_table() now takes head of list of TABLE object as
    its argument instead of always scanning through THD::open_tables
    list.
  handle_delayed_insert():
    Allocate metadata lock request object for table open by delayed
    insert thread on execution memroot.  create_table_from_items():
    We no longer allocate dummy TABLE objects for tables being
    created if they don't exist. As consequence
    reopen_name_locked_table() no longer has link_in argument.
    open_table() now has one more argument which is not relevant for
    temporary tables.
sql/sql_parse.cc:
  - Moved unlock_locked_tables() routine to sql_base.cc and made
    available it in other files. Got rid of some redundant code by
    using this function.
  - Replaced boolean TABLE_LIST::create member with enum
    open_table_type member.
  - Use special memory root for allocating MDL_LOCK objects for
    tables open and locked by LOCK TABLES (these object should live
    till UNLOCK TABLES so we can't allocate them on statement nor
    execution memory root). Also properly set metadata lock
    upgradability attribure for those tables.
  - Under LOCK TABLES it is no longer allowed to flush tables which
    are not write-locked as this breaks metadata locking protocol
    and thus potentially might lead to deadlock.
  - Added auxiliary adjust_mdl_locks_upgradability() function.
sql/sql_partition.cc:
  Adjusted code to the fact that reopen_tables() no longer has
  "mark_share_as_old" argument. Got rid of comments which are no
  longer true.
sql/sql_plist.h:
  Added I_P_List template class for parametrized intrusive doubly
  linked lists and I_P_List_iterator for corresponding iterator.
  Unlike for I_List<> list elements of such list can participate in
  several lists. Unlike List<> such lists are doubly-linked and
  intrusive.
sql/sql_plugin.cc:
  Allocate metadata lock requests objects (MDL_LOCK) on execution
  memory root in cases when we use stack TABLE_LIST objects to open
  tables.
sql/sql_prepare.cc:
  Replaced boolean TABLE_LIST::create member with enum
  open_table_type member.  This allows easily handle situation in
  which instead of opening the table we want only to take exclusive
  metadata lock on it.
sql/sql_rename.cc:
  Use new metadata locking subsystem in implementation of RENAME
  TABLE.
sql/sql_servers.cc:
  Allocate metadata lock requests objects (MDL_LOCK) on execution
  memory root in cases when we use stack TABLE_LIST objects to open
  tables. Got rid of redundant code by using unlock_locked_tables()
  function.
sql/sql_show.cc:
  Acquire shared metadata lock when we are getting information for
  I_S table directly from TABLE_SHARE without doing full-blown table
  open.  We use high priority lock request in this situation in
  order to avoid deadlocks.
  Also allocate metadata lock requests objects (MDL_LOCK) on
  execution memory root in cases when TABLE_LIST objects are also
  allocated there
sql/sql_table.cc:
  mysql_rm_table():
    Removed comment which is no longer relevant.
  mysql_rm_table_part2():
    Now caller of mysql_ha_rm_tables() should not own LOCK_open.
    Adjusted code to use new metadata locking subsystem instead of
    name-locks.
  lock_table_name_if_not_cached():
    Moved this function from sql_base.cc to this file and
    reimplemented it using metadata locking API.
  mysql_create_table():
    Adjusted code to use new MDL API.
  wait_while_table_is_used():
    Changed function to use new MDL subsystem. Made thread waiting
    in it killable (this also led to introduction of return value so
    caller can distinguish successful executions from situations
    when waiting was aborted).
  close_cached_tables():
    Thread waiting in this function is killable now. As result it
    has return value for distinguishing between succes and failure.
    Got rid of redundant boradcast_refresh() call.
  prepare_for_repair():
    Use MDL subsystem instead of name-locks.
  mysql_admin_table():
    mysql_ha_rm_tables() now always assumes that caller doesn't own
    LOCK_open.
  mysql_repair_table():
    We should mark all elements of table list as requiring
    upgradable metadata locks.
  mysql_create_table_like():
    Use new MDL subsystem instead of name-locks.
  create_temporary_tables():
    We don't need to obtain metadata locks when creating temporary
    table.
  mysql_fast_or_online_alter_table():
    Thread waiting in wait_while_table_is_used() is now killable.
  mysql_alter_table():
    Adjusted code to work with new MDL subsystem and to the fact
    that threads waiting in what_while_table_is_used() and
    close_cached_table() are now killable.
sql/sql_test.cc:
  We no longer have separate table cache. TABLE instances are now
  associated with/linked to TABLE_SHARE objects in table definition
  cache.
sql/sql_trigger.cc:
  Adjusted code to work with new metadata locking subsystem.  Also
  reopen_tables() no longer has mark_share_as_old argument (Instead
  of relying on this parameter and related behavior FLUSH TABLES
  WITH READ LOCK now takes global shared metadata lock).
sql/sql_udf.cc:
  Allocate metadata lock requests objects (MDL_LOCK) on execution
  memory root in cases when we use stack TABLE_LIST objects to open
  tables.
sql/sql_update.cc:
  Adjusted code to work with new meta-data locking subsystem.
sql/sql_view.cc:
  Added proper meta-data locking to implementations of
  CREATE/ALTER/DROP VIEW statements. Now we obtain exclusive
  meta-data lock on a view before creating/ changing/dropping it.
  This ensures that all concurrent statements that use this view
  will finish before our statement will proceed and therefore we
  will get correct order of statements in the binary log.
  Also ensure that TABLE_LIST::mdl_upgradable attribute is properly
  propagated for underlying tables of view.
sql/table.cc:
  Added auxiliary alloc_mdl_locks() function for allocating metadata
  lock request objects for all elements of table list.
sql/table.h:
  TABLE_SHARE:
    Got rid of unused members. Introduced members for storing lists
    of used and unused TABLE objects for this share.
  TABLE:
    Added members for linking TABLE objects into per-share lists of
    used and unused TABLE instances. Added member for holding
    pointer to metadata lock for this table.
  TABLE_LIST:
    Replaced boolean TABLE_LIST::create member with enum
    open_table_type member.  This allows easily handle situation in
    which instead of opening the table we want only to take
    exclusive meta-data lock on it (we need this in order to handle
    ALTER VIEW and CREATE VIEW statements).
    Introduced new mdl_upgradable member for marking elements of
    table list for which we need to take upgradable shared metadata
    lock instead of plain shared metadata lock.  Added pointer for
    holding pointer to MDL_LOCK for the table.
  Added auxiliary alloc_mdl_locks() function for allocating metadata
  lock requests objects for all elements of table list.  Added
  auxiliary set_all_mdl_upgradable() function for marking all
  elements in table list as requiring upgradable metadata locks.
storage/myisammrg/ha_myisammrg.cc:
  Allocate MDL_LOCK objects for underlying tables of MERGE table.
  To be reworked once Ingo pushes his patch for WL4144.
2009-11-30 18:55:03 +03:00
Davi Arnaut
c70a9fa1e3 Bug#41726: upgrade from 5.0 to 5.1.30 crashes if you didn't run mysql_upgrade
The problem is that the server could crash when attempting
to access a non-conformant proc system table. One such case
was a crash when invoking stored procedure related statements
on a 5.1 server with a proc system table in the 5.0 format.

The solution is to validate the proc system table format
before attempts to access it are made. If the table is not
in the format that the server expects, a message is written
to the error log and the statement that caused the table to
be accessed fails.

mysql-test/r/sp-destruct.result:
  Add test case result for Bug#41726
mysql-test/t/sp-destruct.test:
  Add test case for Bug#41726
sql/event_db_repository.cc:
  Update code to use new structures.
sql/sp.cc:
  Describe the proc table format and use it to validate when
  opening a instance of the table.
  Add a check to insure that a error message is written to
  the error log only once.
sql/sql_acl.cc:
  Remove unused variable and use new structure.
sql/sql_acl.h:
  Export field definition.
sql/table.cc:
  Accept the field count and definition in a single structure.
sql/table.h:
  Combine the field count and definition in a single structure.
  Transform function into a class in order to support different
  ways of reporting a error.
  Add a pointer cache to TABLE_SHARE.
2009-11-21 09:18:21 -02:00
Andrei Elkin
7eb789a723 merging 5.1 main -> 5.1-rep+2 -> 5.1-rep+3; binlog_unsafe , rpl_mysql_upgrade fail and are under treatment 2009-11-10 20:45:15 +02:00
Michael Widenius
ab0905c6d7 This is based on the userstatv2 patch from Percona and OurDelta.
The original code comes, as far as I know, from Google (Mark Callaghan's team) with additional work from Percona, Ourdelta and Weldon Whipple.

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

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

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

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

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

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

Added support for all new flush commands to mysqladmin

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

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

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

client/mysqladmin.cc:
  Added support for all new flush commmands and some common combinations:
  
  flush-slow-log
  flush-table-statistics
  flush-index-statistics
  flush-user-statistics
  flush-client-statistics
  flush-all-status
  flush-all-statistics
configure.in:
  Added checking if clock_gettime needs the librt.
  (Fixes Bug #37639 clock_gettime is never used/enabled in Linux/Unix)
include/my_sys.h:
  Added my_getcputime()
include/mysql_com.h:
  Added LIST_PROCESS_HOST_LEN & new REFRESH target defines
mysql-test/r/information_schema.result:
  New information schema tables added
mysql-test/r/information_schema_all_engines.result:
  New information schema tables added
mysql-test/r/information_schema_db.result:
  New information schema tables added
mysql-test/r/log_slow.result:
  Added testing that flosh slow query logs is accepted
mysql-test/r/status_user.result:
  Basic testing of user, client, table and index statistics
mysql-test/t/log_slow.test:
  Added testing that flosh slow query logs is accepted
mysql-test/t/status_user-master.opt:
  Ensure that we get a fresh restart before running status_user.test
mysql-test/t/status_user.test:
  Basic testing of user, client, table and index statistics
mysys/my_getsystime.c:
  Added my_getcputime()
  Returns cpu time used by this thread.
sql/authors.h:
  Updated authors to have core and original MySQL developers first.
sql/event_data_objects.cc:
  Updated call to mysql_reset_thd_for_next_command()
sql/event_db_repository.cc:
  Changed to use new ha_... calls
sql/filesort.cc:
  Changed to use new ha_... calls
sql/ha_partition.cc:
  Changed to use new ha_... calls
  Fixed comment syntax
sql/handler.cc:
  Changed to use new ha_... calls
  Reset table statistics
  Added code to update global table and index status
  Added counting of rows changed
sql/handler.h:
  Added table and index statistics variables
  Added function reset_statistics()
  Added handler::ha_... wrappers for all handler read calls to do statistics counting
  Protected all normal read calls to ensure we use the new calls in the server.
  Made ha_partition a friend class so that partition code can call the old read functions
sql/item_subselect.cc:
  Changed to use new ha_... calls
sql/lex.h:
  Added keywords for new information schema tables and flush commands
sql/log.cc:
  Added flush_slow_log()
  Added counting of number of bytes sent to binary log
  Removed not needed test of thd (It's used before, so it's safe to use)
  Added THD object to MYSQL_BIN_LOG::write_cache() to simplify statistics counting
sql/log.h:
  Added new parameter to write_cache()
  Added flush_slow_log() functions.
sql/log_event.cc:
  Updated call to mysql_reset_thd_for_next_command()
  Changed to use new ha_... calls
sql/log_event_old.cc:
  Updated call to mysql_reset_thd_for_next_command()
  Changed to use new ha_... calls
sql/mysql_priv.h:
  Updated call to mysql_reset_thd_for_next_command()
  Added new statistics functions and variables needed by these.
sql/mysqld.cc:
  Added new statistics variables and structures to handle these
  Added new status variables:
  - Com_show_client_statistics, Com_show_index_statistics, Com_show_table_statistics, Com_show_user_statistics
  - Access_denied_errors, Busy_time (clock time), Binlog_bytes_written, Cpu_time, Empty_queries, Rows_set, Rows_read
  Added new option 'userstat' to control if user statistics should be enabled or not
sql/opt_range.cc:
  Changed to use new ha_... calls
sql/opt_range.h:
  Changed to use new ha_... calls
sql/opt_sum.cc:
  Changed to use new ha_... calls
sql/records.cc:
  Changed to use new ha_... calls
sql/set_var.cc:
  Added variable 'userstat'
sql/sp.cc:
  Changed to use new ha_... calls
sql/sql_acl.cc:
  Changed to use new ha_... calls
  Added counting of access_denied_errors
sql/sql_base.cc:
  Added call to statistics functions
sql/sql_class.cc:
  Added usage of org_status_var, to store status variables at start of command
  Added functions THD::update_stats(), THD::update_all_stats()
  Fixed bug in add_to_status() and add_diff_to_status() where longlong variables where threated as long
sql/sql_class.h:
  Added new status variables to status_var
  Moved variables that was not ulong in status_var last.
  Added variables to THD for storing temporary values during statistics counting
sql/sql_connect.cc:
  Variables and functions to calculate user and client statistics
  Added counting of access_denied_errors and lost_connections
sql/sql_cursor.cc:
  Changed to use new ha_... calls
sql/sql_handler.cc:
  Changed to use new ha_... calls
sql/sql_help.cc:
  Changed to use new ha_... calls
sql/sql_insert.cc:
  Changed to use new ha_... calls
sql/sql_lex.h:
  Added SQLCOM_SHOW_USER_STATS, SQLCOM_SHOW_TABLE_STATS, SQLCOM_SHOW_INDEX_STATS, SQLCOM_SHOW_CLIENT_STATS
sql/sql_parse.cc:
  Added handling of:
  - SHOW CLIENT_STATISTICS
  - SHOW USER_STATISTICS
  - SHOW TABLE_STATISTICS
  - SHOW INDEX_STATISTICS
  Added handling of new FLUSH commands:
  - FLUSH SLOW QUERY LOGS
  - FLUSH TABLE_STATISTICS
  - FLUSH INDEX_STATISTICS
  - FLUSH USER_STATISTICS
  - FLUSH CLIENT_STATISTICS
  Added THD parameter to mysql_reset_thd_for_next_command()
  Added initialization and calls to user statistics functions
  Added increment of statistics variables empty_queries, rows_sent and access_denied_errors.
  Added counting of cpu time per query
sql/sql_plugin.cc:
  Changed to use new ha_... calls
sql/sql_prepare.cc:
  Updated call to mysql_reset_thd_for_next_command()
sql/sql_select.cc:
  Changed to use new ha_... calls
  Indentation changes
sql/sql_servers.cc:
  Changed to use new ha_... calls
sql/sql_show.cc:
  Added counting of access denied errors
  Added function for new information schema tables:
  - CLIENT_STATISTICS
  - USER_STATISTICS
  - INDEX_STATISTICS
  - TABLE_STATISTICS
  Changed to use new ha_... calls
sql/sql_table.cc:
  Changed to use new ha_... calls
sql/sql_udf.cc:
  Changed to use new ha_... calls
sql/sql_update.cc:
  Changed to use new ha_... calls
sql/sql_yacc.yy:
  Add new show and flush commands
sql/structs.h:
  Add name_length to KEY to avoid some strlen
  Added cache_name to KEY for fast storage of keyvalue in cache
  Added structs USER_STATS, TABLE_STATS, INDEX_STATS
  Added function prototypes for statistics functions
sql/table.cc:
  Store db+table+index name into keyinfo->cache_name
sql/table.h:
  Added new information schema tables
sql/tztime.cc:
  Changed to use new ha_... calls
2009-10-19 20:14:48 +03:00
Sven Sandberg
3d467f04a1 merged fixes for BUG#39934 to 5.1-rpl+3
Also renamed current_stmt_binlog_row_based to
current_stmt_binlog_format_row for consistency
2009-09-30 18:00:22 +02:00
Staale Smedseng
6a89842e36 Bug #43414 Parenthesis (and other) warnings compiling MySQL
with gcc 4.3.2

Cleaning up warnings not present in 5.0.
2009-09-23 15:21:29 +02:00
Sven Sandberg
41783de549 BUG#39934: Slave stops for engine that only support row-based logging
General overview:
The logic for switching to row format when binlog_format=MIXED had
numerous flaws. The underlying problem was the lack of a consistent
architecture.
General purpose of this changeset:
This changeset introduces an architecture for switching to row format
when binlog_format=MIXED. It enforces the architecture where it has
to. It leaves some bugs to be fixed later. It adds extensive tests to
verify that unsafe statements work as expected and that appropriate
errors are produced by problems with the selection of binlog format.
It was not practical to split this into smaller pieces of work.

Problem 1:
To determine the logging mode, the code has to take several parameters
into account (namely: (1) the value of binlog_format; (2) the
capabilities of the engines; (3) the type of the current statement:
normal, unsafe, or row injection). These parameters may conflict in
several ways, namely:
 - binlog_format=STATEMENT for a row injection
 - binlog_format=STATEMENT for an unsafe statement
 - binlog_format=STATEMENT for an engine only supporting row logging
 - binlog_format=ROW for an engine only supporting statement logging
 - statement is unsafe and engine does not support row logging
 - row injection in a table that does not support statement logging
 - statement modifies one table that does not support row logging and
   one that does not support statement logging
Several of these conflicts were not detected, or were detected with
an inappropriate error message. The problem of BUG#39934 was that no
appropriate error message was written for the case when an engine
only supporting row logging executed a row injection with
binlog_format=ROW. However, all above cases must be handled.
Fix 1:
Introduce new error codes (sql/share/errmsg.txt). Ensure that all
conditions are detected and handled in decide_logging_format()

Problem 2:
The binlog format shall be determined once per statement, in
decide_logging_format(). It shall not be changed before or after that.
Before decide_logging_format() is called, all information necessary to
determine the logging format must be available. This principle ensures
that all unsafe statements are handled in a consistent way.
However, this principle is not followed:
thd->set_current_stmt_binlog_row_based_if_mixed() is called in several
places, including from code executing UPDATE..LIMIT,
INSERT..SELECT..LIMIT, DELETE..LIMIT, INSERT DELAYED, and
SET @@binlog_format. After Problem 1 was fixed, that caused
inconsistencies where these unsafe statements would not print the
appropriate warnings or errors for some of the conflicts.
Fix 2:
Remove calls to THD::set_current_stmt_binlog_row_based_if_mixed() from
code executed after decide_logging_format(). Compensate by calling the
set_current_stmt_unsafe() at parse time. This way, all unsafe statements
are detected by decide_logging_format().

Problem 3:
INSERT DELAYED is not unsafe: it is logged in statement format even if
binlog_format=MIXED, and no warning is printed even if
binlog_format=STATEMENT. This is BUG#45825.
Fix 3:
Made INSERT DELAYED set itself to unsafe at parse time. This allows
decide_logging_format() to detect that a warning should be printed or
the binlog_format changed.

Problem 4:
LIMIT clause were not marked as unsafe when executed inside stored
functions/triggers/views/prepared statements. This is
BUG#45785.
Fix 4:
Make statements containing the LIMIT clause marked as unsafe at
parse time, instead of at execution time. This allows propagating
unsafe-ness to the view.


mysql-test/extra/rpl_tests/create_recursive_construct.inc:
  Added auxiliary file used by binlog_unsafe.test to create and
  execute recursive constructs
  (functions/procedures/triggers/views/prepared statements).
mysql-test/extra/rpl_tests/rpl_foreign_key.test:
  removed unnecessary set @@session.binlog_format
mysql-test/extra/rpl_tests/rpl_insert_delayed.test:
  Filter out table id from table map events in binlog listing.
  Got rid of $binlog_format_statement.
mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test:
  disable warnings around call to unsafe procedure
mysql-test/include/rpl_udf.inc:
  Disabled warnings for code that generates warnings
  for some binlog formats. That would otherwise cause
  inconsistencies in the result file.
mysql-test/r/mysqldump.result:
  Views are now unsafe if they contain a LIMIT clause.
  That fixed BUG#45831. Due to BUG#45832, a warning is
  printed for the CREATE VIEW statement.
mysql-test/r/sp_trans.result:
  Unsafe statements in stored procedures did not give a warning if
  binlog_format=statement. This is BUG#45824. Now they do, so this
  result file gets a new warning.
mysql-test/suite/binlog/r/binlog_multi_engine.result:
  Error message changed.
mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result:
  INSERT DELAYED didn't generate a warning when binlog_format=STATEMENT.
  That was BUG#45825. Now there is a warning, so result file needs to be
  updated.
mysql-test/suite/binlog/r/binlog_stm_ps.result:
  Changed error message.
mysql-test/suite/binlog/r/binlog_unsafe.result:
  updated result file:
   - error message changed
   - added test for most combinations of unsafe constructs invoked
     from recursive constructs
   - INSERT DELAYED now gives a warning (because BUG#45826 is fixed)
   - INSERT..SELECT..LIMIT now gives a warning from inside recursive
     constructs (because BUG#45785 was fixed)
   - When a recursive construct (e.g., stored proc or function)
     contains more than one statement, at least one of which is
     unsafe, then all statements in the recursive construct give
     warnings. This is a new bug introduced by this changeset.
     It will be addressed in a post-push fix.
mysql-test/suite/binlog/t/binlog_innodb.test:
  Changed error code for innodb updates with READ COMMITTED or 
  READ UNCOMMITTED transaction isolation level and
  binlog_format=statement.
mysql-test/suite/binlog/t/binlog_multi_engine.test:
  The error code has changed for statements where more than one
  engine is involved and one of them is self-logging.
mysql-test/suite/binlog/t/binlog_unsafe-master.opt:
  Since binlog_unsafe now tests unsafe-ness of UDF's, we need an extra
  flag in the .opt file.
mysql-test/suite/binlog/t/binlog_unsafe.test:
   - Clarified comment.
   - Rewrote first part of test. Now it tests not only unsafe variables
     and functions, but also unsafe-ness due to INSERT..SELECT..LIMIT,
     INSERT DELAYED, insert into two autoinc columns, use of UDF's, and
     access to log tables in the mysql database.
     Also, in addition to functions, procedures, triggers, and prepared
     statements, it now also tests views; and it constructs recursive
     calls in two levels by combining these recursive constructs.
     Part of the logic is in extra/rpl_tests/create_recursive_construct.inc.
   - added tests for all special system variables that should not be unsafe.
   - added specific tests for BUG#45785 and BUG#45825
mysql-test/suite/rpl/r/rpl_events.result:
  updated result file
mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result:
  updated result file
mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result:
  updated result file
mysql-test/suite/rpl/r/rpl_foreign_key_innodb.result:
  updated result file
mysql-test/suite/rpl/r/rpl_idempotency.result:
  updated result file
mysql-test/suite/rpl/r/rpl_mix_found_rows.result:
  Split rpl_found_rows.test into rpl_mix_found_rows.test (a new file) and
  rpl_stm_found_rows.test (renamed rpl_found_rows.test). This file equals
  the second half of the old rpl_found_rows.result, with the following
  modifications:
   - minor formatting changes
   - additional initialization
mysql-test/suite/rpl/r/rpl_mix_insert_delayed.result:
  Moved out code operating in mixed mode from rpl_stm_insert_delayed
  (into rpl_mix_insert_delayed) and got rid of explicit setting of
  binlog format.
mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result:
  updated result file
mysql-test/suite/rpl/r/rpl_row_idempotency.result:
  Moved the second half of rpl_idempotency.test, which only
  executed in row mode, to rpl_row_idempotency.test. This is
  the new result file.
mysql-test/suite/rpl/r/rpl_row_insert_delayed.result:
  Got rid of unnecessary explicit setting of binlog format.
mysql-test/suite/rpl/r/rpl_stm_found_rows.result:
  Split rpl_found_rows.test into rpl_mix_found_rows.test (a new file) and
  rpl_stm_found_rows.test (renamed rpl_found_rows.test). Changes in
  this file:
   - minor formatting changes
   - warning is now issued for unsafe statements inside procedures
     (since BUG#45824 is fixed)
   - second half of file is moved to rpl_mix_found_rows.result
mysql-test/suite/rpl/r/rpl_stm_insert_delayed.result:
  Moved out code operating in mixed mode from rpl_stm_insert_delayed
  (into rpl_mix_insert_delayed) and got rid of explicit setting of
  binlog format.
mysql-test/suite/rpl/r/rpl_stm_loadfile.result:
  error message changed
mysql-test/suite/rpl/r/rpl_temporary_errors.result:
  updated result file
mysql-test/suite/rpl/r/rpl_udf.result:
  Remove explicit set of binlog format (and triplicate test execution)
  and rely on test system executing the test in all binlog formats.
mysql-test/suite/rpl/t/rpl_bug31076.test:
  Test is only valid in mixed or row mode since it generates row events.
mysql-test/suite/rpl/t/rpl_events.test:
  Removed explicit set of binlog_format and removed duplicate testing.
  Instead, we rely on the test system to try all binlog formats.
mysql-test/suite/rpl/t/rpl_extraColmaster_innodb.test:
  Removed triplicate testing and instead relying on test system.
  Test is only relevant for row format since statement-based replication
  cannot handle extra columns on master.
mysql-test/suite/rpl/t/rpl_extraColmaster_myisam.test:
  Removed triplicate testing and instead relying on test system.
  Test is only relevant for row format since statement-based replication
  cannot handle extra columns on master.
mysql-test/suite/rpl/t/rpl_idempotency-slave.opt:
  Removed .opt file to avoid server restarts.
mysql-test/suite/rpl/t/rpl_idempotency.test:
  - Moved out row-only tests to a new test file, rpl_row_idempotency.test.
    rpl_idempotency now only contains tests that execute in all
    binlog_formats.
  - While I was here, also removed .opt file to avoid server restarts.
    The slave_exec_mode is now set inside the test instead.
mysql-test/suite/rpl/t/rpl_mix_found_rows.test:
  Split rpl_found_rows.test into rpl_mix_found_rows.test (a new file) and
  rpl_stm_found_rows.test (renamed rpl_found_rows.test). This file
  contains the second half of the original rpl_found_rows.test with the
  follwing changes:
   - initialization
   - removed SET_BINLOG_FORMAT and added have_binlog_format_mixed.inc
   - minor formatting changes
mysql-test/suite/rpl/t/rpl_mix_insert_delayed.test:
  Moved out code operating in mixed mode from rpl_stm_insert_delayed
  (into rpl_mix_insert_delayed) and got rid of explicit setting of
  binlog format.
mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test:
  Test cannot execute in statement mode, since we no longer
  switch to row format when binlog_format=statement.
  Enforced mixed mode throughout the test.
mysql-test/suite/rpl/t/rpl_row_idempotency.test:
  Moved the second half of rpl_idempotency.test, which only
  executed in row mode, to this new file. We now rely on the
  test system to set binlog format.
mysql-test/suite/rpl/t/rpl_row_insert_delayed.test:
   - Got rid of unnecessary explicit setting of binlog format.
   - extra/rpl_tests/rpl_insert_delayed.test does not need the
     $binlog_format_statement variable any more, so that was
     removed.
mysql-test/suite/rpl/t/rpl_slave_skip.test:
  The test switches binlog_format internally and master generates both
  row and statement events. Hence, the slave must be able to log in both
  statement and row format. Hence test was changed to only execute in
  mixed mode.
mysql-test/suite/rpl/t/rpl_stm_found_rows.test:
  Split rpl_found_rows.test into rpl_mix_found_rows.test (a new file) and
  rpl_stm_found_rows.test (renamed rpl_found_rows.test). Changes in
  this file:
   - minor formatting changes
   - added have_binlog_format_statement and removed SET BINLOG_FORMAT.
   - second half of file is moved to rpl_mix_found_rows.test
   - added cleanup code
mysql-test/suite/rpl/t/rpl_stm_insert_delayed.test:
  Moved out code operating in mixed mode from rpl_stm_insert_delayed
  (into rpl_mix_insert_delayed) and got rid of explicit setting of
  binlog format.
mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test:
  The test switches binlog_format internally and master generates both
  row and statement events. Hence, the slave must be able to log in both
  statement and row format. Hence test was changed to only execute in
  mixed mode on slave.
mysql-test/suite/rpl/t/rpl_temporary_errors.test:
  Removed explicit set of binlog format. Instead, the test now only
  executes in row mode.
mysql-test/suite/rpl/t/rpl_udf.test:
  Remove explicit set of binlog format (and triplicate test execution)
  and rely on test system executing the test in all binlog formats.
mysql-test/suite/rpl_ndb/combinations:
  Added combinations file for rpl_ndb.
mysql-test/suite/rpl_ndb/r/rpl_ndb_binlog_format_errors.result:
  new result file
mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result:
  updated result file
mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb.test:
  The test needs slave to be able to switch to row mode, so the
  test was changed to only execute in mixed and row mode.
mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam.test:
  The test needs slave to be able to switch to row mode, so the
  test was changed to only execute in mixed and row mode.
mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test:
  The test needs slave to be able to switch to row mode, so the
  test was changed to only execute in mixed and row mode.
mysql-test/suite/rpl_ndb/t/rpl_ndb_binlog_format_errors-master.opt:
  new option file
mysql-test/suite/rpl_ndb/t/rpl_ndb_binlog_format_errors-slave.opt:
  new option file
mysql-test/suite/rpl_ndb/t/rpl_ndb_binlog_format_errors.test:
  New test case to verify all errors and warnings generated by
  decide_logging_format.
mysql-test/suite/rpl_ndb/t/rpl_ndb_blob.test:
  The test needs slave to be able to switch to row mode, so the
  test was changed to only execute in mixed and row mode.
mysql-test/suite/rpl_ndb/t/rpl_ndb_blob2.test:
  The test needs slave to be able to switch to row mode, so the
  test was changed to only execute in mixed and row mode.
mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test:
  The test needs slave to be able to switch to row mode, so the
  test was changed to only execute in mixed and row mode.
mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test:
  The test needs slave to be able to switch to row mode, so the
  test was changed to only execute in mixed and row mode.
  While I was here, also made the test clean up after itself.
mysql-test/suite/rpl_ndb/t/rpl_ndb_commit_afterflush.test:
  The test needs slave to be able to switch to row mode, so the
  test was changed to only execute in mixed and row mode.
mysql-test/suite/rpl_ndb/t/rpl_ndb_ctype_ucs2_def.test:
  The test needs slave to be able to switch to row mode, so the
  test was changed to only execute in mixed and row mode.
mysql-test/suite/rpl_ndb/t/rpl_ndb_delete_nowhere.test:
  The test needs slave to be able to switch to row mode, so the
  test was changed to only execute in mixed and row mode.
mysql-test/suite/rpl_ndb/t/rpl_ndb_do_db.test:
  The test needs slave to be able to switch to row mode, so the
  test was changed to only execute in mixed and row mode.
mysql-test/suite/rpl_ndb/t/rpl_ndb_do_table.test:
  The test needs slave to be able to switch to row mode, so the
  test was changed to only execute in mixed and row mode.
mysql-test/suite/rpl_ndb/t/rpl_ndb_func003.test:
  The test needs slave to be able to switch to row mode, so the
  test was changed to only execute in mixed and row mode.
mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans.test:
  The test needs slave to be able to switch to row mode, so the
  test was changed to only execute in mixed and row mode.
mysql-test/suite/rpl_ndb/t/rpl_ndb_insert_ignore.test:
  The test needs slave to be able to switch to row mode, so the
  test was changed to only execute in mixed and row mode.
mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions.test:
  The test needs slave to be able to switch to row mode, so the
  test was changed to only execute in mixed and row mode.
mysql-test/suite/rpl_ndb/t/rpl_ndb_multi_update3.test:
  The test needs slave to be able to switch to row mode, so the
  test was changed to only execute in mixed and row mode.
mysql-test/suite/rpl_ndb/t/rpl_ndb_rep_ignore.test:
  The test needs slave to be able to switch to row mode, so the
  test was changed to only execute in mixed and row mode.
mysql-test/suite/rpl_ndb/t/rpl_ndb_row_001.test:
  The test needs slave to be able to switch to row mode, so the
  test was changed to only execute in mixed and row mode.
mysql-test/suite/rpl_ndb/t/rpl_ndb_sp003.test:
  The test needs slave to be able to switch to row mode, so the
  test was changed to only execute in mixed and row mode.
mysql-test/suite/rpl_ndb/t/rpl_ndb_sp006.test:
  The test needs slave to be able to switch to row mode, so the
  test was changed to only execute in mixed and row mode.
mysql-test/suite/rpl_ndb/t/rpl_ndb_trig004.test:
  The test needs slave to be able to switch to row mode, so the
  test was changed to only execute in mixed and row mode.
mysql-test/t/partition_innodb_stmt.test:
  Changed error code for innodb updates with READ COMMITTED or 
  READ UNCOMMITTED transaction isolation level and
  binlog_format=statement.
sql/event_db_repository.cc:
  Use member function to read current_stmt_binlog_row_based.
sql/events.cc:
  Use member function to read current_stmt_binlog_row_based.
sql/ha_ndbcluster_binlog.cc:
  reset_current_stmt_binlog_row_based() is not a no-op for the ndb_binlog
  thread any more. Instead, the ndb_binlog thread now forces row mode both
  initially and just after calling mysql_parse.  (mysql_parse() is the only
  place where reset_current_stmt_binlog_row_based() may be called from
  the ndb_binlog thread, so these are the only two places that need to
  change.)
sql/ha_partition.cc:
  Use member function to read current_stmt_binlog_row_based.
sql/handler.cc:
  Use member function to read current_stmt_binlog_row_based.
sql/item_create.cc:
  Added DBUG_ENTER to some functions, to be able to trace when
  set_stmt_unsafe is called.
sql/log.cc:
  Use member function to read current_stmt_binlog_row_based.
sql/log_event.cc:
   - Moved logic for changing to row format out of do_apply_event (and into
     decide_logging_format).
   - Added @todo comment for post-push cleanup.
sql/log_event_old.cc:
  Move logic for changing to row format out of do_apply_event (and into
  decide_logging_format).
sql/mysql_priv.h:
  Make decide_logging_format() a member of the THD class, for two reasons:
   - It is natural from an object-oriented perspective.
   - decide_logging_format() needs to access private members of THD
     (specifically, the new binlog_warning_flags field).
sql/rpl_injector.cc:
  Removed call to set_current_stmt_binlog_row_based().
  From now on, only decide_logging_fromat is allowed to modify
  current_stmt_binlog_row_based. This call is from the ndb_binlog
  thread, mostly executing code in ha_ndbcluster_binlog.cc.
  This call can be safely removed, because:
   - current_stmt_binlog_row_based is initialized for the ndb_binlog
     thread's THD object when the THD object is created. So we're
     not going to read uninitialized memory.
   - The behavior of ndb_binlog thread does not use the state of the
     current_stmt_binlog_row_based. It is conceivable that the
     ndb_binlog thread would rely on the current_stmt_binlog_format
     in two situations:
      (1) when it calls mysql_parse;
      (2) when it calls THD::binlog_query.
     In case (1), it always clears THD::options&OPTION_BIN_LOG (because
     run_query() in ha_ndbcluster_binlog.cc is only called with
     disable_binlogging = TRUE).
     In case (2), it always uses qtype=STMT_QUERY_TYPE.
sql/set_var.cc:
  Added @todo comment for post-push cleanup.
sql/share/errmsg.txt:
  Added new error messages and clarified ER_BINLOG_UNSAFE_STATEMENT.
sql/sp.cc:
  Added DBUG_ENTER, to be able to trace when set_stmt_unsafe is called.
  Got rid of MYSQL_QUERY_TYPE: it was equivalent to STMT_QUERY_TYPE.
sql/sp_head.cc:
  Use member function to read current_stmt_binlog_row_based.
sql/sp_head.h:
  Added DBUG_ENTER, to be able to trace when set_stmt_unsafe is called.
sql/sql_acl.cc:
  Got rid of MYSQL_QUERY_TYPE: it was equivalent to STMT_QUERY_TYPE.
sql/sql_base.cc:
   - Made decide_logging_format take care of all logic for deciding the
     logging format, and for determining the related warnings and errors.
     See comment above decide_logging_format for details.
   - Made decide_logging_format a member function of THD, since it needs
     to access private members of THD and since its purpose is to update
     the state of a THD object.
   - Added DBUG_ENTER, to be able to trace when set_stmt_unsafe is called.
sql/sql_class.cc:
  - Moved logic for determining unsafe warnings away from THD::binlog_query
    (and into decide_logging_format()). Now, it works like this:
    1. decide_logging_format detects that the current statement shall
       produce a warning, if it ever makes it to the binlog
    2. decide_logging_format sets a flag of THD::binlog_warning_flags.
    3. THD::binlog_query reads the flag. If the flag is set, it generates
       a warning.
  - Use member function to read current_stmt_binlog_row_based.
sql/sql_class.h:
  - Added THD::binlog_warning_flags (see sql_class.cc for explanation).
  - Made decide_logging_format() and reset_for_next_command() member
    functions of THD (instead of standalone functions). This was needed
    for two reasons: (1) the functions need to access the private member
    THD::binlog_warning_flags; (2) the purpose of these functions is to
    update the staet of a THD object, so from an object-oriented point
    of view they should be member functions.
  - Encapsulated current_stmt_binlog_row_based, so it is now private and
    can only be accessed from a member function. Also changed the
    data type to an enumeration instead of a bool.
  - Removed MYSQL_QUERY_TYPE, because it was equivalent to
    STMT_QUERY_TYPE anyways.
  - When reset_current_stmt_binlog_row_based was called from the
    ndb_binlog thread, it would behave as a no-op. This special
    case has been removed, and the behavior of
    reset_current_stmt_binlog_row_based does not depend on which thread
    calls it any more. The special case did not serve any purpose,
    since the ndb binlog thread did not take the
    current_stmt_binlog_row_based flag into account anyways.
sql/sql_delete.cc:
  - Moved logic for setting row format for DELETE..LIMIT away from
    mysql_prepare_delete.
    (Instead, we mark the statement as unsafe at parse time (sql_yacc.yy)
    and rely on decide_logging_format() (sql_class.cc) to set row format.)
    This is part of the fix for BUG#45831.
  - Use member function to read current_stmt_binlog_row_based.
sql/sql_insert.cc:
   - Removed unnecessary calls to thd->lex->set_stmt_unsafe() and
     thd->set_current_stmt_binlog_row_based_if_mixed() from
     handle_delayed_insert(). The calls are unnecessary because they
     have already been made; they were made in the constructor of
     the `di' object.
   - Since decide_logging_format() is now a member function of THD, code
     that calls decide_logging_format() had to be updated.
   - Added DBUG_ENTER call, to be able to trace when set_stmt_unsafe is
     called.
   - Moved call to set_stmt_unsafe() for INSERT..SELECT..LIMIT away from
     mysql_insert_select_prepare() (and into decide_logging_format).
     This is part of the fix for BUG#45831.
   - Use member function to read current_stmt_binlog_row_based.
sql/sql_lex.h:
   - Added the flag BINLOG_STMT_FLAG_ROW_INJECTION to enum_binlog_stmt_flag.
     This was necessary so that a statement can identify itself as a row
     injection.
   - Added appropriate setter and getter functions for the new flag.
   - Added or clarified some comments.
   - Added DBUG_ENTER()
sql/sql_load.cc:
  Use member function to read current_stmt_binlog_row_based.
sql/sql_parse.cc:
   - Made mysql_reset_thd_for_next_command() clear thd->binlog_warning_flags.
   - Since thd->binlog_warning_flags is private, it must be set in a
     member function of THD. Hence, moved the body of
     mysql_reset_thd_for_next_command() to the new member function
     THD::reset_thd_for_next_command(), and made
     mysql_reset_thd_for_next_command() call
     THD::reset_thd_for_next_command().
   - Removed confusing comment.
   - Use member function to read current_stmt_binlog_row_based.
sql/sql_repl.cc:
  Use member function to read current_stmt_binlog_row_based.
sql/sql_table.cc:
  Use member function to read current_stmt_binlog_row_based.
sql/sql_udf.cc:
  Use member function to read current_stmt_binlog_row_based.
sql/sql_update.cc:
  Moved logic for setting row format for UPDATE..LIMIT away from
  mysql_prepare_update.
  (Instead, we mark the statement as unsafe at parse time (sql_yacc.yy)
  and rely on decide_logging_format() (sql_class.cc) to set row format.)
  This is part of the fix for BUG#45831.
sql/sql_yacc.yy:
  Made INSERT DELAYED, INSERT..SELECT..LIMIT, UPDATE..LIMIT, and
  DELETE..LIMIT mark themselves as unsafe at parse time (instead
  of at execution time).
  This is part of the fixes BUG#45831 and BUG#45825.
storage/example/ha_example.cc:
  Made exampledb accept inserts. This was needed by the new test case
  rpl_ndb_binlog_format_errors, because it needs an engine that
  is statement-only (and accepts inserts).
storage/example/ha_example.h:
  Made exampledb a statement-only engine instead of a row-only engine.
  No existing test relied exampledb's row-only capabilities. The new
  test case rpl_ndb_binlog_format_errors needs an engine that is
  statement-only.
storage/innobase/handler/ha_innodb.cc:
  - Changed error error code and message given by innodb when 
    binlog_format=STATEMENT and transaction isolation level is
    READ COMMITTED or READ UNCOMMITTED.
  - While I was here, also simplified the condition for
    checking when to give the error.
2009-07-14 21:31:19 +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
Michael Widenius
bd4e65515f Fixed compiler warnings found by gcc 4.3.2
- Added braces around expressions with &&, ||, & and |
- Added empty line before ; for empty while and for loops
- Added () around if with assignments
- Removed const before function returning simple type

Changed BUILD scripts to not build with NDB 


BUILD/SETUP.sh:
  By default, don't build ndb with --max in Maria tree.
  NDB is not kept up to date anyway in 5.1
client/mysql.cc:
  Added braces around && to get rid of compiler warnings
sql/event_db_repository.cc:
  Added braces around && to get rid of compiler warnings
sql/events.cc:
  Added braces around && to get rid of compiler warnings
sql/field.cc:
  Added braces around && to get rid of compiler warnings
  Fixed for loops
sql/field.h:
  Added braces around & to get rid of compiler warnings
sql/field_conv.cc:
  Added braces around && to get rid of compiler warnings
  Fixed bug when copying between DATETIME fields and strict dates are used
  Removed not needeed else
sql/gstream.cc:
  Added braces around && to get rid of compiler warnings
sql/ha_ndbcluster.cc:
  Added braces around && to get rid of compiler warnings
  Added {} to get rid of compiler warnings
sql/handler.cc:
  Added braces around && to get rid of compiler warnings
sql/item.cc:
  Added braces around && to get rid of compiler warnings
sql/item_cmpfunc.cc:
  Added braces around && to get rid of compiler warnings
  Removed some not needed space
sql/item_func.cc:
  Added braces around && to get rid of compiler warnings
sql/item_strfunc.cc:
  Added braces around && to get rid of compiler warnings
sql/item_subselect.cc:
  Added braces around && to get rid of compiler warnings
sql/item_sum.cc:
  Added braces around && to get rid of compiler warnings
sql/item_timefunc.cc:
  Added braces around && to get rid of compiler warnings
sql/item_xmlfunc.cc:
  Added empty line before ; for empty while and for loops
sql/log.cc:
  Added braces around && to get rid of compiler warnings
sql/log_event.cc:
  Added braces around && to get rid of compiler warnings
  Removed not needed else
sql/log_event_old.cc:
  Added braces around && to get rid of compiler warnings
sql/opt_range.cc:
  Added braces around && to get rid of compiler warnings
sql/opt_sum.cc:
  Added braces around && to get rid of compiler warnings
sql/set_var.cc:
  Added empty line before ; for empty while and for loops
  Added () around if with assignments
sql/slave.cc:
  Added braces around && to get rid of compiler warnings
  Added empty line before ; for empty while and for loops
sql/spatial.h:
  Added braces around && to get rid of compiler warnings
sql/sql_acl.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_analyse.cc:
  Added empty line before ; for empty while and for loops
sql/sql_base.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_connect.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_db.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_delete.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_help.cc:
  Added empty line before ; for empty while and for loops
sql/sql_insert.cc:
  Added braces around && to get rid of compiler warnings
  Added () around if with assignments
sql/sql_lex.cc:
  Cast char array references to uchar; Fixed wrong array referencing when using characters > ASCII 128 in SQL statments
  Added empty line before ; for empty while and for loops
  Trivial indent fixes
  Added braces around && to get rid of compiler warnings
sql/sql_load.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_parse.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_partition.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_plugin.cc:
  Fixed bug in detecing if option variable should be readonly
  Added empty line before ; for empty while and for loops
sql/sql_prepare.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_select.cc:
  Added braces around && to get rid of compiler warnings
  Added () around if with assignments
  Added empty line before ; for empty while and for loops
sql/sql_show.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_table.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_trigger.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_update.cc:
  Added braces around && to get rid of compiler warnings
sql/sql_yacc.yy:
  Added braces around && to get rid of compiler warnings
sql/table.cc:
  Added braces around && to get rid of compiler warnings
sql/table.h:
  Added braces around && to get rid of compiler warnings
sql/time.cc:
  Added braces around && to get rid of compiler warnings
sql/tztime.cc:
  Added braces around && to get rid of compiler warnings
sql/uniques.cc:
  Added braces around && to get rid of compiler warnings
storage/federated/ha_federated.cc:
  Fixed bug in testing of variable to ha_info() (Not critical)
storage/heap/ha_heap.cc:
  Added braces around && to get rid of compiler warnings
storage/maria/ha_maria.cc:
  Fixed bug: Mark that maria_log_dir_path is readonly
  Added braces around && to get rid of compiler warnings
storage/ndb/include/ndbapi/NdbEventOperation.hpp:
  Removed const before function returning simple type
storage/ndb/include/ndbapi/NdbOperation.hpp:
  Removed const before function returning simple type
storage/ndb/src/ndbapi/Ndb.cpp:
  Added empty line before ; for empty while and for loops
storage/ndb/src/ndbapi/NdbEventOperation.cpp:
  Removed const before function returning simple type
storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp:
  Removed const before function returning simple type
storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp:
  Removed const before function returning simple type
storage/ndb/src/ndbapi/NdbRecAttr.cpp:
  Added empty line before ; for empty while and for loops
storage/ndb/src/ndbapi/TransporterFacade.hpp:
  Added braces around && to get rid of compiler warnings
2009-01-31 23:22:44 +02:00
Build Team
e85fe79430 Added "Sun Microsystems, Inc." to copyright headers on files modified
since Oct 1st
2008-11-10 21:21:49 +01:00
Georgi Kodinov
5b1b7320b1 fixed a win32 warning caused by the fix for bug #35981 2008-10-01 13:12:08 +03:00
Tatiana A. Nurnberg
fe7baacaff Bug#35981: ALTER EVENT causes the server to change the PRESERVE option.
If [NOT] PRESERVE was not given, parser always defaulted to NOT
PRESERVE, making it impossible for the "not given = no change"
rule to work in ALTER EVENT. Leaving out the PRESERVE-clause
defaults to NOT PRESERVE on CREATE now, and to "no change" in
ALTER.

mysql-test/r/events_2.result:
  show that giving no PRESERVE-clause to ALTER EVENT
  results in no change. show that giving no PRESERVE-clause
  to CREATE EVENT defaults to NOT PRESERVE as per the docs.
  Show specifically that this is also handled correctly when
  trying to ALTER EVENTs into the past.
mysql-test/t/events_2.test:
  show that giving no PRESERVE-clause to ALTER EVENT
  results in no change. show that giving no PRESERVE-clause
  to CREATE EVENT defaults to NOT PRESERVE as per the docs.
  Show specifically that this is also handled correctly when
  trying to ALTER EVENTs into the past.
sql/event_db_repository.cc:
  If ALTER EVENT was given no PRESERVE-clause (meaning "no change"),
  we don't know the previous PRESERVE-setting by the time we check
  the parse-data. If ALTER EVENT was given dates that are in the past,
  we don't know how to react, lacking the PRESERVE-setting. Heal this
  by running the check later when we have actually read the previous
  EVENT-data.
sql/event_parse_data.cc:
  Change default for ON COMPLETION to indicate, "not specified."
  Also defer throwing errors when ALTER EVENT is given dates in
  the past but not PRESERVE-clause until we know the previous
  PRESERVE-value.
sql/event_parse_data.h:
  Add third state for ON COMPLETION [NOT] PRESERVE (preserve,
  don't, not specified).
  
  Make check_dates() public so we can defer this check until
  deeper in the callstack where we have all the required data.
sql/sql_yacc.yy:
  If CREATE EVENT is not given ON COMPLETION [NOT] PRESERVE,
  we default to NOT, as per the docs.
2008-09-11 09:51:02 +02:00
Tatiana A. Nurnberg
02f305516f Bug#35981: ALTER EVENT causes the server to change the PRESERVE option.
If [NOT] PRESERVE was not given, parser always defaulted to NOT
PRESERVE, making it impossible for the "not given = no change"
rule to work in ALTER EVENT. Leaving out the PRESERVE-clause
defaults to NOT PRESERVE on CREATE now, and to "no change" in
ALTER.

mysql-test/r/events_2.result:
  show that giving no PRESERVE-clause to ALTER EVENT
  results in no change. show that giving no PRESERVE-clause
  to CREATE EVENT defaults to NOT PRESERVE as per the docs.
  Show specifically that this is also handled correctly when
  trying to ALTER EVENTs into the past.
mysql-test/t/events_2.test:
  show that giving no PRESERVE-clause to ALTER EVENT
  results in no change. show that giving no PRESERVE-clause
  to CREATE EVENT defaults to NOT PRESERVE as per the docs.
  Show specifically that this is also handled correctly when
  trying to ALTER EVENTs into the past.
sql/event_db_repository.cc:
  If ALTER EVENT was given no PRESERVE-clause (meaning "no change"),
  we don't know the previous PRESERVE-setting by the time we check
  the parse-data. If ALTER EVENT was given dates that are in the past,
  we don't know how to react, lacking the PRESERVE-setting. Heal this
  by running the check later when we have actually read the previous
  EVENT-data.
sql/event_parse_data.cc:
  Change default for ON COMPLETION to indicate, "not specified."
  Also defer throwing errors when ALTER EVENT is given dates in
  the past but not PRESERVE-clause until we know the previous
  PRESERVE-value.
sql/event_parse_data.h:
  Add third state for ON COMPLETION [NOT] PRESERVE (preserve,
  don't, not specified).
  
  Make check_dates() public so we can defer this check until
  deeper in the callstack where we have all the required data.
sql/sql_yacc.yy:
  If CREATE EVENT is not given ON COMPLETION [NOT] PRESERVE,
  we default to NOT, as per the docs.
2008-08-18 13:05:51 +02:00
Sergey Petrunia
7a92412c59 Merge fix for BUG#35478 into 5.1 2008-07-15 21:46:02 +04:00
unknown
1b6b7010a6 Bug#32633 Can not create any routine if SQL_MODE=no_engine_substitution
The problem is that one can not create a stored routine if sql_mode
contains NO_ENGINE_SUBSTITUTION or PAD_CHAR_TO_FULL_LENGTH. Also when
a event is created, the mode is silently lost if sql_mode contains one
of the aforementioned.  This was happening because the table definitions
which stored sql_mode values weren't being updated to accept new values
of sql_mode.

The solution is to update, in a backwards compatible manner, the various
table definitions (columns) that store the sql_mode value to take into
account the new possible values. One incompatible change is that if a event
that is being created can't be stored to the mysql.event table, an error
will be raised.

The tests case also ensure that new SQL modes will be added to the mysql.proc
and mysql.event tables, otherwise the tests will fail.


mysql-test/r/events_bugs.result:
  Add test case result for Bug#32633
mysql-test/r/information_schema.result:
  Update the sql_mode column definition.
mysql-test/r/sp.result:
  Add test case result for Bug#32633
mysql-test/r/system_mysql_db.result:
  Update the sql_mode column definition.
mysql-test/t/events_bugs.test:
  Add test case for Bug#32633
mysql-test/t/sp.test:
  Add test case for Bug#32633
mysql-test/t/system_mysql_db_fix50117.test:
  Update the sql_mode column definition.
scripts/mysql_system_tables.sql:
  Update the sql_mode column definition.
scripts/mysql_system_tables_fix.sql:
  Update the sql_mode column definition.
sql/event_db_repository.cc:
  Reset and restore SQL modes when storing and loading a
  event from the data dictionary. Also throw out a error
  if a store fails.
sql/mysqld.cc:
  Add warning to avoid this problem in the future.
sql-common/my_user.c:
  Truncate length if user name or host name does not fit
  in the buffer.
sql/sp.cc:
  SQL mode of the thread must not effect data dictionary operations.
2008-02-07 08:47:39 -02:00
unknown
611dbd0bb3 Bug#30882 Dropping a temporary table inside a stored function may cause a server crash
If a stored function that contains a drop temporary table statement
is invoked by a create temporary table of the same name may cause
a server crash. The problem is that when dropping a table no check
is done to ensure that table is not being used by some outer query
(or outer statement), potentially leaving the outer query with a
reference to a stale (freed) table.

The solution is when dropping a temporary table, always check if
the table is being used by some outer statement as a temporary
table can be dropped inside stored procedures.

The check is performed by looking at the TABLE::query_id value for
temporary tables. To simplify this check and to solve a bug related
to handling of temporary tables in prelocked mode, this patch changes
the way in which this member is used to track the fact that table is
used/unused. Now we ensure that TABLE::query_id is zero for unused
temporary tables (which means that all temporary tables which were
used by a statement should be marked as free for reuse after it's
execution has been completed).


mysql-test/include/handler.inc:
  Add test case for side effect of Bug#30882
mysql-test/r/handler_innodb.result:
  Add test case result for side effect of Bug#30882
mysql-test/r/handler_myisam.result:
  Add test case result for side effect of Bug#30882
mysql-test/r/sp-error.result:
  Add test case result for Bug#30882
mysql-test/t/sp-error.test:
  Add test case for Bug#30882
sql/event_db_repository.cc:
  Update close_thread_tables call, no more default values.
sql/mysql_priv.h:
  Remove implicit default parameters values of the close_thread_tables
  function as no callers are using it.
sql/slave.cc:
  Update close_thread_tables call, no more default values
sql/sp_head.cc:
  Update close_thread_tables call, no more default values
sql/sql_base.cc:
  Changed the approach to distinguishing currently unused temporary tables.
  Now we ensure that such tables always have TABLE::query_id set to 0 and
  use this fact to perform checks during opening and dropping of temporary
  tables. This means that we have to call close_thread_tables() even for
  statements which use only temporary tables. To make this call cheaper,
  we re-factored close_thread_tables() to not take LOCK_open unless there
  are open base tables.
sql/sql_handler.cc:
  Properly close temporary tables associated with a handler.
sql/sql_insert.cc:
  close_temporary_table is now merged into drop_temporary_table.
sql/sql_parse.cc:
  Now the condition doesn't cover all cases because close_thread_tables()
  must be called even for statements that use only temporary tables.
sql/sql_table.cc:
  Use drop_temporary_table which perform checks to verify if
  the table is not being used. Error path problem is due to
  a handler tables issue and is going to be addressed in bug
  31397.
sql/table.h:
  Rename previously unused clear_query_id and document the usage of
  query_id and open_by_handler.
2007-11-01 18:52:56 -02:00
unknown
66cd6d0c8f 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.


mysql-test/r/events_bugs.result:
  Update result file.
mysql-test/t/events_bugs.test:
  A test case for BUG#31111: --read-only crashes MySQL (events fail
  to load).
sql/event_data_objects.cc:
  When the worker thread is going to drop event after the execution
  we should do it under the super-user privileges in order to be able
  to lock the mysql.event table for writing in the read-only mode.
  
  This is a system operation, where user SQL can not be executed.
  So, there is no risk in compromising security by dropping an event
  under the super-user privileges.
sql/event_db_repository.cc:
  1. Close tables if something went wrong in simple_open_n_lock_tables();
  2. As soon as the system event scheduler thread is running under
     the super-user privileges, we should always be able to acquire
     WRITE-lock on the mysql.event table. However, let's have an assert
     to check this.
sql/event_scheduler.cc:
  Run the system event scheduler thread under the super-user privileges.
  In particular, this is needed to be able to lock the mysql.event table
  for writing when the server is running in the read-only mode.
  
  The event scheduler executes only system operations and does not
  execute user SQL (this is what the worker threads for). So, there
  is no risk in compromising security by running the event scheduler
  under the super-user privileges.
sql/events.cc:
  Open the mysql.event table as the super user to be able to acquire
  WRITE-lock in the read-only mode.
sql/sql_class.cc:
  Initialize Security_context::master_acces.
2007-10-19 19:57:08 +04:00
unknown
af602784f6 Manual merge of parallel development in separate team trees.
client/mysqldump.c:
  Auto merged
sql/event_db_repository.cc:
  Auto merged
sql/event_queue.cc:
  Auto merged
sql/field.cc:
  Auto merged
sql/item.cc:
  Auto merged
sql/item_subselect.cc:
  Auto merged
sql/log_event.h:
  Auto merged
sql/sp.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_db.cc:
  Auto merged
sql/sql_handler.cc:
  Auto merged
sql/sql_lex.cc:
  Auto merged
sql/sql_plugin.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/table.h:
  Auto merged
sql/sql_yacc.yy:
  Manual merge.
2007-08-22 17:13:42 +02:00
unknown
7691bbbfe3 Provide initial module structure to Doxygen.
sql/event_data_objects.cc:
  Add module comments.
sql/event_data_objects.h:
  Add module comments.
sql/event_db_repository.cc:
  Add module comments.
sql/event_db_repository.h:
  Add module comments.
sql/event_queue.cc:
  Add module comments.
sql/event_queue.h:
  Add module comments.
sql/event_scheduler.cc:
  Add module comments.
sql/event_scheduler.h:
  Add module comments.
sql/events.cc:
  Add module comments.
sql/events.h:
  Add module comments.
sql/lock.cc:
  Add module comments.
sql/sp_head.h:
  Add module comments.
sql/sql_base.cc:
  Add module comments.
sql/sql_lex.h:
  Add module comments.
sql/sql_parse.cc:
  Add module comments.
sql/sql_select.cc:
  Add module comments.
sql/sql_yacc.yy:
  Add module comments.
2007-08-15 19:08:44 +04:00
unknown
c514373cf3 Fix doxygen warnings.
client/mysqldump.c:
  Fix doxygen warnings
mysys/test_charset.c:
  Fix doxygen warnings
sql/event_db_repository.cc:
  Fix doxygen warnings
sql/events.cc:
  Fix doxygen warnings
sql/events.h:
  Fix doxygen warnings
sql/item_create.cc:
  Fix doxygen warnings, style.
sql/item_create.h:
  Fix coding style.
sql/item_subselect.cc:
  Fix doxygen warnings
sql/lock.cc:
  Fix doxygen warnings
sql/sp.cc:
  Fix doxygen warnings
sql/sp_head.h:
  Fix doxygen warnings
sql/sql_analyse.cc:
  Fix doxygen warnings
sql/sql_analyse.h:
  Fix doxygen warnings
sql/sql_base.cc:
  Fix doxygen warnings
sql/sql_db.cc:
  Fix doxygen warnings
sql/sql_lex.cc:
  Fix doxygen warnings
sql/sql_lex.h:
  Fix doxygen warnings
sql/sql_parse.cc:
  Fix doxygen warnings
sql/sql_plugin.cc:
  Fix doxygen warnings
sql/sql_prepare.cc:
  Fix doxygen warnings
sql/sql_show.cc:
  Fix doxygen warnings
sql/sql_trigger.cc:
  Fix doxygen warnings
sql/sql_update.cc:
  Fix doxygen warnings
sql/table.h:
  Fix doxygen warnings
2007-08-15 17:43:08 +04:00
unknown
09a53f28a7 Fixed a lot of compiler warnings and errors detected by Forte C++ on Solaris
Faster thr_alarm()
Added 'Opened_files' status variable to track calls to my_open()
Don't give warnings when running mysql_install_db
Added option --source-install to mysql_install_db

I had to do the following renames() as used polymorphism didn't work with Forte compiler on 64 bit systems
index_read()      -> index_read_map()
index_read_idx()  -> index_read_idx_map()
index_read_last() -> index_read_last_map()


BUILD/compile-solaris-sparc-forte:
  Updated script to current Solaris installations
  Now we compile by default for 64 bits
client/mysql.cc:
  Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
client/mysql_upgrade.c:
  Fixed compiler warning (on Forte)
client/mysqladmin.cc:
  Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
client/mysqlcheck.c:
  Fixed compiler warning (on Forte)
client/mysqldump.c:
  Fixed compiler warning (on Forte)
client/mysqlslap.c:
  Fixed compiler warning (on Forte)
client/mysqltest.c:
  Fixed compiler warning (on Forte)
client/sql_string.cc:
  Avoid compiler warnings when using C function pointers in C++
configure.in:
  Added detection of mtmalloc and ieeefp.h
extra/replace.c:
  Fixed compiler warning (on Forte)
include/m_ctype.h:
  Added some typedef's to make it easy to use C function pointers in C++
include/my_sys.h:
  Added my_file_total_opened (counter for calls to my_open())
include/myisam.h:
  Fixed compiler warning (on Forte)
libmysql/libmysql.c:
  Fixed compiler warning (on Forte) by adding casts and change types
libmysql/manager.c:
  Fixed compiler warning (on Forte) by adding casts and change types
mysql-test/r/ctype_cp932_binlog_stm.result:
  Updated positions
  (Needed because we didn't before correctly restore collation_database after running stored procedure
mysys/my_fopen.c:
  Count number of opened files
mysys/my_open.c:
  Count number of opened files
mysys/my_static.c:
  Count number of opened files
mysys/thr_alarm.c:
  Optimization to do less alarm() and pthread_sigmask() calls.
  Idea is to remember time for next pending alarm and not reschedule a new alarm if it's after the current one.
  Before we only did this if there was other pending alarms.
  We don't have to use pthread_sigmask() in case of 'USE_ONE_SIGNAL_HAND' as the alarm()
  signal will be blocked for the calling thread anyway and no other thread will have the alarm() signal enabled to call process_alarm()
regex/regcomp.c:
  Fixed compiler warning (on Forte) by adding casts and change types
scripts/mysql_install_db.sh:
  Added option --source-install to allow one to create a mysql database from the source tree without installing MySQL
  Don't give (unnecessary) warnings
server-tools/instance-manager/angel.cc:
  Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
server-tools/instance-manager/thread_registry.cc:
  Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
sql/event_db_repository.cc:
  index_read() -> index_read_map()
sql/event_queue.cc:
  Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
sql/field.cc:
  Fixed compiler warnings about hidden fields
sql/ha_partition.cc:
  Fixed compiler warnings about hidden fields
  index_read() -> index_read_map()
sql/ha_partition.h:
  index_read() -> index_read_map()
sql/handler.cc:
  Added PAGE option to row types (to prepare for future)
  index_read() -> index_read_map()
sql/handler.h:
  Added ROW_TYPE_PAGE (for future)
  Added flag to signal if table was to be created transactionally
  I had to do the following renames() as used polymorphism didn't work with Forte compiler on 64 bit systems
  index_read()      -> index_read_map()
  index_read_idx()  -> index_read_idx_map()
  index_read_last() -> index_read_last_map()
sql/item.cc:
  Fixed indentation
  Renamed local variable to avoid hiding class variable
sql/item_cmpfunc.cc:
  Renamed local variable to avoid hiding class variable
sql/item_cmpfunc.h:
  Removed not used variable
sql/item_func.cc:
  Renamed local variable to avoid hiding class variable
sql/item_strfunc.cc:
  Moved functions from Item_strfunc.cc
sql/item_strfunc.h:
  Move functions to item_strfunc.cc
  Use C function pointer type to avoid compiler warnings (with Forte)
sql/item_subselect.cc:
  index_read() -> index_read_map()
sql/item_xmlfunc.cc:
  Renamed local variable to avoid hiding class variable
  Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
sql/key.cc:
  Fixed indentation
sql/log.cc:
  Renamed local variable to avoid hiding class variable
sql/log_event.cc:
  Removed call to my_time() when creating class instance of Log_event() as this may have static instances.
  (One can't call my_time() before my_init())
  index_read() -> index_read_map()
  Renamed local variable to avoid hiding class variable
sql/log_event_old.cc:
  Renamed local variable to avoid hiding class variable
sql/mysql_priv.h:
  Made all create_backup_ctx() declarations identical.
  This lifted up a bug where wrong create_backup_ctx() was called in some cases.
  Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
sql/mysqld.cc:
  Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
  Fixed indentation
  Don't call end_thr_alarm() when calling unireg_abort() as unireg_abort() already calls end_thr_alarm()
  Added variable 'Opened_files' (number of calls to my_open() or my_fopen())
  Don't print 'loose' warnings when using --bootstrap (to avoid warnings when running mysql_install_db)
  Fixed compiler warnings
sql/opt_range.cc:
  index_read() -> index_read_map()
sql/opt_sum.cc:
  index_read() -> index_read_map()
sql/partition_info.cc:
  Renamed local variable to avoid hiding class variable
sql/rpl_filter.cc:
  Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
sql/set_var.cc:
  Renamed local variable to avoid hiding class variable
  Added 'process_key_cache_t' type to avoid compiler warning (on Forte)
sql/set_var.h:
  Added 'process_key_cache_t' type to avoid compiler warning (on Forte)
sql/sp.cc:
  More debugging
  index_read() -> index_read_map()
sql/sp_cache.cc:
  Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
sql/sp_head.cc:
  Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
  Moved 'saved_creation_ctx' higher up to be able to free objects allocated by create_backup_ctx()
sql/sql_acl.cc:
  index_read() -> index_read_map()
sql/sql_class.cc:
  Renamed local variable to avoid hiding class variable
  Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
sql/sql_class.h:
  Renamed local variable to avoid hiding class variable
sql/sql_db.cc:
  Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
sql/sql_delete.cc:
  Renamed local variable to avoid hiding class variable
sql/sql_handler.cc:
  index_read() -> index_read_map()
sql/sql_help.cc:
  index_read() -> index_read_map()
sql/sql_insert.cc:
  index_read() -> index_read_map()
  Renamed local variable to avoid hiding class variable
sql/sql_lex.cc:
  Renamed local variable to avoid hiding class variable
sql/sql_plugin.cc:
  Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
  index_read() -> index_read_map()
  Don't give warnings about not used plugins if we are using --warnings=0
sql/sql_select.cc:
  index_read() -> index_read_map()
sql-common/client.c:
  Fixed compiler warning (on Forte)
sql-common/my_time.c:
  Removed never accessed code
  Fixed compiler warning (on Forte)
sql/sql_servers.cc:
  index_read() -> index_read_map()
sql/sql_show.cc:
  Added TRANSACTIONAL to SHOW CREATE
  Fixed ROW_TYPE_PAGE
sql/sql_string.cc:
  Avoid compiler warnings when using C function pointers in C++
sql/sql_table.cc:
  Set create_info->transactional if we used TRANSACTIONAL=1
sql/sql_udf.cc:
  index_read() -> index_read_map()
sql/sql_yacc.yy:
  Added TRANSACTIONAL=0|1 to CREATE (for future)
  Added row type PAGE (was only partionally handled before)
sql/strfunc.cc:
  Avoid compiler warnings when using C function pointers in C++
sql/table.cc:
  More DBUG statements
  Declare all create_backup_ctx() functions identically
  Remember if table was created with TRANSACTIONAL flag or not (future safe)
  Renamed local variable to avoid hiding class variable
sql/table.h:
  Remember if table was created with TRANSACTIONAL=1
sql/tztime.cc:
  index_read() -> index_read_map()
sql-common/pack.c:
  Fixed compiler warning (on Forte)
storage/archive/archive_reader.c:
  Fixed compiler warning (on Forte)
storage/archive/azio.c:
  Fixed compiler warning (on Forte)
storage/blackhole/ha_blackhole.cc:
  index_read() -> index_read_map()
storage/blackhole/ha_blackhole.h:
  index_read() -> index_read_map()
storage/csv/ha_tina.cc:
  Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
storage/example/ha_example.cc:
  index_read() -> index_read_map()
storage/example/ha_example.h:
  index_read() -> index_read_map()
storage/heap/ha_heap.cc:
  index_read() -> index_read_map()
storage/heap/ha_heap.h:
  index_read() -> index_read_map()
storage/heap/hp_test1.c:
  Fixed compiler warning (on Forte)
storage/heap/hp_test2.c:
  Fixed compiler warning (on Forte)
storage/myisam/ft_boolean_search.c:
  Fixed compiler warning (on Forte)
storage/myisam/ft_nlq_search.c:
  Fixed compiler warning (on Forte)
storage/myisam/ft_parser.c:
  Fixed compiler warning (on Forte)
storage/myisam/ft_stopwords.c:
  Fixed compiler warning (on Forte)
storage/myisam/ha_myisam.cc:
  index_read() -> index_read_map()
storage/myisam/ha_myisam.h:
  index_read() -> index_read_map()
storage/myisam/mi_check.c:
  Fixed compiler warning (on Forte)
storage/myisam/mi_delete.c:
  Fixed compiler warning (on Forte)
storage/myisam/mi_dynrec.c:
  Fixed compiler warning (on Forte)
storage/myisam/mi_extra.c:
  Fixed compiler warning (on Forte)
storage/myisam/mi_key.c:
  Fixed compiler warning (on Forte)
storage/myisam/mi_keycache.c:
  Fixed compiler warning (on Forte)
storage/myisam/mi_locking.c:
  Fixed compiler warning (on Forte)
storage/myisam/mi_log.c:
  Fixed compiler warning (on Forte)
storage/myisam/mi_open.c:
  Fixed compiler warning (on Forte)
storage/myisam/mi_packrec.c:
  Fixed compiler warning (on Forte)
storage/myisam/mi_page.c:
  Fixed compiler warning (on Forte)
storage/myisam/mi_rkey.c:
  Added comment
storage/myisam/mi_search.c:
  Fixed compiler warning (on Forte)
storage/myisam/mi_statrec.c:
  Fixed compiler warning (on Forte)
storage/myisam/mi_test1.c:
  Fixed compiler warning (on Forte)
storage/myisam/mi_test2.c:
  Fixed compiler warning (on Forte)
storage/myisam/mi_test3.c:
  Fixed compiler warning (on Forte)
storage/myisam/mi_update.c:
  Fixed compiler warning (on Forte)
storage/myisam/mi_write.c:
  Fixed compiler warning (on Forte)
storage/myisam/myisamdef.h:
  Fixed that file_read/file_write returns type size_t
  Changed some functions to use uchar * as argument/return value instead of char*
  This fixed some compiler warnings on Forte
storage/myisam/myisamlog.c:
  Fixed compiler warning (on Forte)
storage/myisam/myisampack.c:
  Fixed compiler warning (on Forte)
storage/myisam/rt_test.c:
  Fixed compiler warning (on Forte)
storage/myisam/sort.c:
  Fixed compiler warning (on Forte) by adding casts or changing variables to uchar*
storage/myisam/sp_test.c:
  Fixed compiler warning (on Forte) by adding casts or changing variables to uchar*
storage/myisammrg/ha_myisammrg.cc:
  index_read() -> index_read_map()
storage/myisammrg/ha_myisammrg.h:
  index_read() -> index_read_map()
storage/myisammrg/myrg_create.c:
  Fixed compiler warning (on Forte) by adding casts or changing variable types
storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp:
  Tdummy -> align  (as in other part of cluster code)
storage/ndb/src/kernel/vm/DynArr256.cpp:
  Removed not used variable
storage/ndb/src/ndbapi/Ndb.cpp:
  Removed not used variable
strings/strtod.c:
  Include ieeefp.h to avoid compiler warning
tests/bug25714.c:
  Fixed compiler warning
tests/mysql_client_test.c:
  Remove not used variable
  Fixed indentation
  Removed never reached code
  Fixed compiler warning (on Forte) by adding casts or changing variable types
vio/viosocket.c:
  Fixed compiler warning (on Forte) by adding casts or changing variable types
2007-08-13 16:11:25 +03:00
unknown
cfdd203549 Bug#28641 CREATE EVENT with '2038.01.18 03:00:00' let server crash.
Creating an EVENT to be executed at a time close to the end of the allowed
range (2038.01.19 03:14:07 UTC) would cause the server to crash. The
expected behavior is to accept all calendar times within the interval and
reject all other values without crashing.

This patch replaces the function 'sec_to_epoch_TIME' with a Time_zone API call.
This function was broken because it invoked the internal function 'sec_to_epoch'
without respecting the restrictions on the function parameters (and this caused
assertion failure). It also was used as a reverse function to
Time_zone_utc::gmt_sec_to_TIME which it isn't.


mysql-test/r/events_bugs.result:
  Added test case
mysql-test/t/events_bugs.test:
  Added test case
sql/event_data_objects.cc:
  Replaced function 'sec_since_epoch_TIME' since it was implemented as
  a wrapper around 'sec_since_epoch' without taking parameter restrictions
  into account. The function was used to load information about event
  execution time from mysql.events table. Further more, the function wasn't
  the inverse function of Time_zone_utc::gmt_sec_to_TIME() which was used
  by events code to store information about event execution time.
sql/event_db_repository.cc:
  Replaced my_tz_UTC object with my_tz_OFFSET0 object because the first one
  doesn't supply us with a bijective MYSQL_TIME<->my_time_t translation. Instead
  the function sec_since_epoch_TIME was used as a reverse function to the method
  my_tz_UTC::gmt_sec_to_TIME.
sql/event_queue.cc:
  Replaced my_tz_UTC object with my_tz_OFFSET0 object because the first one
  doesn't supply us with a bijective MYSQL_TIME<->my_time_t translation. Instead
  the function sec_since_epoch_TIME was used as a reverse function to the method
  my_tz_UTC::gmt_sec_to_TIME.
sql/tztime.cc:
  * Remove function 'sec_since_epoch_TIME' since it was implemented as
  a wrapper around 'sec_since_epoch' without taking parameter restrictions
  into account. The function was used to load information about event
  execution time from mysql.events table. Further more, the function wasn't
  the inverse function of Time_zone_utc::gmt_sec_to_TIME() which was used
  by events code to store information about event execution time.
  
  * Added static Time_zone object for UTC+0 time zone.
sql/tztime.h:
  Include extern pointer to static Time_zone object.
2007-07-25 09:43:49 +02:00
unknown
405f82d390 Patch for the following bugs:
- BUG#11986: Stored routines and triggers can fail if the code
    has a non-ascii symbol
  - BUG#16291: mysqldump corrupts string-constants with non-ascii-chars
  - BUG#19443: INFORMATION_SCHEMA does not support charsets properly
  - BUG#21249: Character set of SP-var can be ignored
  - BUG#25212: Character set of string constant is ignored (stored routines)
  - BUG#25221: Character set of string constant is ignored (triggers)

There were a few general problems that caused these bugs:
1. Character set information of the original (definition) query for views,
   triggers, stored routines and events was lost.
2. mysqldump output query in client character set, which can be
   inappropriate to encode definition-query.
3. INFORMATION_SCHEMA used strings with mixed encodings to display object
   definition;

1. No query-definition-character set.

In order to compile query into execution code, some extra data (such as
environment variables or the database character set) is used. The problem
here was that this context was not preserved. So, on the next load it can
differ from the original one, thus the result will be different.

The context contains the following data:
  - client character set;
  - connection collation (character set and collation);
  - collation of the owner database;

The fix is to store this context and use it each time we parse (compile)
and execute the object (stored routine, trigger, ...).

2. Wrong mysqldump-output.

The original query can contain several encodings (by means of character set
introducers). The problem here was that we tried to convert original query
to the mysqldump-client character set.

Moreover, we stored queries in different character sets for different
objects (views, for one, used UTF8, triggers used original character set).

The solution is
  - to store definition queries in the original character set;
  - to change SHOW CREATE statement to output definition query in the
    binary character set (i.e. without any conversion);
  - introduce SHOW CREATE TRIGGER statement;
  - to dump special statements to switch the context to the original one
    before dumping and restore it afterwards.

Note, in order to preserve the database collation at the creation time,
additional ALTER DATABASE might be used (to temporary switch the database
collation back to the original value). In this case, ALTER DATABASE
privilege will be required. This is a backward-incompatible change.

3. INFORMATION_SCHEMA showed non-UTF8 strings

The fix is to generate UTF8-query during the parsing, store it in the object
and show it in the INFORMATION_SCHEMA.

Basically, the idea is to create a copy of the original query convert it to
UTF8. Character set introducers are removed and all text literals are
converted to UTF8.

This UTF8 query is intended to provide user-readable output. It must not be
used to recreate the object.  Specialized SHOW CREATE statements should be
used for this.

The reason for this limitation is the following: the original query can
contain symbols from several character sets (by means of character set
introducers).

Example:

  - original query:
    CREATE VIEW v1 AS SELECT _cp1251 'Hello' AS c1;

  - UTF8 query (for INFORMATION_SCHEMA):
    CREATE VIEW v1 AS SELECT 'Hello' AS c1;


client/mysqldump.c:
  Set original character set and collation before dumping definition query.
include/my_sys.h:
  Move out-parameter to the end of list.
mysql-test/lib/mtr_report.pl:
  Ignore server-warnings during the test case.
mysql-test/r/create.result:
  Update result file.
mysql-test/r/ctype_cp932_binlog_stm.result:
  Update result file.
mysql-test/r/events.result:
  Update result file.
mysql-test/r/events_bugs.result:
  Update result file.
mysql-test/r/events_grant.result:
  Update result file.
mysql-test/r/func_in.result:
  Update result file.
mysql-test/r/gis.result:
  Update result file.
mysql-test/r/grant.result:
  Update result file.
mysql-test/r/information_schema.result:
  Update result file.
mysql-test/r/information_schema_db.result:
  Update result file.
mysql-test/r/lowercase_view.result:
  Update result file.
mysql-test/r/mysqldump.result:
  Update result file.
mysql-test/r/ndb_sp.result:
  Update result file.
mysql-test/r/ps.result:
  Update result file.
mysql-test/r/rpl_replicate_do.result:
  Update result file.
mysql-test/r/rpl_sp.result:
  Update result file.
mysql-test/r/rpl_trigger.result:
  Update result file.
mysql-test/r/rpl_view.result:
  Update result file.
mysql-test/r/show_check.result:
  Update result file.
mysql-test/r/skip_grants.result:
  Update result file.
mysql-test/r/sp-destruct.result:
  Update result file.
mysql-test/r/sp-error.result:
  Update result file.
mysql-test/r/sp-security.result:
  Update result file.
mysql-test/r/sp.result:
  Update result file.
mysql-test/r/sql_mode.result:
  Update result file.
mysql-test/r/system_mysql_db.result:
  Update result file.
mysql-test/r/temp_table.result:
  Update result file.
mysql-test/r/trigger-compat.result:
  Update result file.
mysql-test/r/trigger-grant.result:
  Update result file.
mysql-test/r/trigger.result:
  Update result file.
mysql-test/r/view.result:
  Update result file.
mysql-test/r/view_grant.result:
  Update result file.
mysql-test/t/events.test:
  Update test case (new columns added).
mysql-test/t/information_schema.test:
  Update test case (new columns added).
mysql-test/t/show_check.test:
  Test case for SHOW CREATE TRIGGER in prepared statements and
  stored routines.
mysql-test/t/sp-destruct.test:
  Update test case (new columns added).
mysql-test/t/sp.test:
  Update test case (new columns added).
mysql-test/t/view.test:
  Update test.
mysys/charset.c:
  Move out-parameter to the end of list.
scripts/mysql_system_tables.sql:
  Add new columns to mysql.proc and mysql.event.
scripts/mysql_system_tables_fix.sql:
  Add new columns to mysql.proc and mysql.event.
sql/event_data_objects.cc:
  Support new attributes for events.
sql/event_data_objects.h:
  Support new attributes for events.
sql/event_db_repository.cc:
  Support new attributes for events.
sql/event_db_repository.h:
  Support new attributes for events.
sql/events.cc:
  Add new columns to SHOW CREATE event resultset.
sql/mysql_priv.h:
  1. Introduce Object_creation_ctx;
  2. Introduce SHOW CREATE TRIGGER;
  3. Introduce auxilary functions.
sql/sp.cc:
  Add support for new store routines attributes.
sql/sp_head.cc:
  Add support for new store routines attributes.
sql/sp_head.h:
  Add support for new store routines attributes.
sql/sql_lex.cc:
  Generate UTF8-body on parsing/lexing.
sql/sql_lex.h:
  1. Generate UTF8-body on parsing/lexing.
  2. Introduce SHOW CREATE TRIGGER.
sql/sql_parse.cc:
  Introduce SHOW CREATE TRIGGER.
sql/sql_partition.cc:
  Update parse_sql().
sql/sql_prepare.cc:
  Update parse_sql().
sql/sql_show.cc:
  Support new attributes for views
sql/sql_trigger.cc:
  Support new attributes for views
sql/sql_trigger.h:
  Support new attributes for views
sql/sql_view.cc:
  Support new attributes for views
sql/sql_yacc.yy:
  1. Add SHOW CREATE TRIGGER statement.
  2. Generate UTF8-body for views, stored routines, triggers and events.
sql/table.cc:
  Introduce Object_creation_ctx.
sql/table.h:
  Introduce Object_creation_ctx.
sql/share/errmsg.txt:
  Add new errors.
mysql-test/include/ddl_i18n.check_events.inc:
  Aux file for test suite.
mysql-test/include/ddl_i18n.check_sp.inc:
  Aux file for test suite.
mysql-test/include/ddl_i18n.check_triggers.inc:
  Aux file for test suite.
mysql-test/include/ddl_i18n.check_views.inc:
  Aux file for test suite.
mysql-test/include/have_cp1251.inc:
  Aux file for test suite.
mysql-test/include/have_cp866.inc:
  Aux file for test suite.
mysql-test/include/have_koi8r.inc:
  Aux file for test suite.
mysql-test/include/have_utf8.inc:
  Aux file for test suite.
mysql-test/r/ddl_i18n_koi8r.result:
  Result file.
mysql-test/r/ddl_i18n_utf8.result:
  Result file.
mysql-test/r/have_cp1251.require:
  Aux file for test suite.
mysql-test/r/have_cp866.require:
  Aux file for test suite.
mysql-test/r/have_koi8r.require:
  Aux file for test suite.
mysql-test/r/have_utf8.require:
  Aux file for test suite.
mysql-test/t/ddl_i18n_koi8r.test:
  Complete koi8r test case for the CS patch.
mysql-test/t/ddl_i18n_utf8.test:
  Complete utf8 test case for the CS patch.
2007-06-28 21:34:54 +04:00
unknown
c7aeb8f37b This is the 3-rd part of patch for BUG#11986:
remove redundant "body" from Event_parse_data (use sp_head::m_body).


sql/event_data_objects.cc:
  Use sp_head::m_body to store SQL-statement.
  Polishing.
sql/event_data_objects.h:
  Use sp_head::m_body to store SQL-statement.
  Polishing.
sql/event_db_repository.cc:
  Use sp_head::m_body to store SQL-statement.
sql/sql_yacc.yy:
  Use sp_head::m_body to store SQL-statement.
2007-06-14 18:49:17 +04:00
unknown
f252f9248a WL#3817: Simplify string / memory area types and make things more consistent (first part)
The following type conversions was done:

- Changed byte to uchar
- Changed gptr to uchar*
- Change my_string to char *
- Change my_size_t to size_t
- Change size_s to size_t

Removed declaration of byte, gptr, my_string, my_size_t and size_s. 

Following function parameter changes was done:
- All string functions in mysys/strings was changed to use size_t
  instead of uint for string lengths.
- All read()/write() functions changed to use size_t (including vio).
- All protocoll functions changed to use size_t instead of uint
- Functions that used a pointer to a string length was changed to use size_t*
- Changed malloc(), free() and related functions from using gptr to use void *
  as this requires fewer casts in the code and is more in line with how the
  standard functions work.
- Added extra length argument to dirname_part() to return the length of the
  created string.
- Changed (at least) following functions to take uchar* as argument:
  - db_dump()
  - my_net_write()
  - net_write_command()
  - net_store_data()
  - DBUG_DUMP()
  - decimal2bin() & bin2decimal()
- Changed my_compress() and my_uncompress() to use size_t. Changed one
  argument to my_uncompress() from a pointer to a value as we only return
  one value (makes function easier to use).
- Changed type of 'pack_data' argument to packfrm() to avoid casts.
- Changed in readfrm() and writefrom(), ha_discover and handler::discover()
  the type for argument 'frmdata' to uchar** to avoid casts.
- Changed most Field functions to use uchar* instead of char* (reduced a lot of
  casts).
- Changed field->val_xxx(xxx, new_ptr) to take const pointers.

Other changes:
- Removed a lot of not needed casts
- Added a few new cast required by other changes
- Added some cast to my_multi_malloc() arguments for safety (as string lengths
  needs to be uint, not size_t).
- Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done
  explicitely as this conflict was often hided by casting the function to
  hash_get_key).
- Changed some buffers to memory regions to uchar* to avoid casts.
- Changed some string lengths from uint to size_t.
- Changed field->ptr to be uchar* instead of char*. This allowed us to
  get rid of a lot of casts.
- Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar
- Include zlib.h in some files as we needed declaration of crc32()
- Changed MY_FILE_ERROR to be (size_t) -1.
- Changed many variables to hold the result of my_read() / my_write() to be
  size_t. This was needed to properly detect errors (which are
  returned as (size_t) -1).
- Removed some very old VMS code
- Changed packfrm()/unpackfrm() to not be depending on uint size
  (portability fix)
- Removed windows specific code to restore cursor position as this
  causes slowdown on windows and we should not mix read() and pread()
  calls anyway as this is not thread safe. Updated function comment to
  reflect this. Changed function that depended on original behavior of
  my_pwrite() to itself restore the cursor position (one such case).
- Added some missing checking of return value of malloc().
- Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow.
- Changed type of table_def::m_size from my_size_t to ulong to reflect that
  m_size is the number of elements in the array, not a string/memory
  length.
- Moved THD::max_row_length() to table.cc (as it's not depending on THD).
  Inlined max_row_length_blob() into this function.
- More function comments
- Fixed some compiler warnings when compiled without partitions.
- Removed setting of LEX_STRING() arguments in declaration (portability fix).
- Some trivial indentation/variable name changes.
- Some trivial code simplifications:
  - Replaced some calls to alloc_root + memcpy to use
    strmake_root()/strdup_root().
  - Changed some calls from memdup() to strmake() (Safety fix)
  - Simpler loops in client-simple.c


BitKeeper/etc/ignore:
  added libmysqld/ha_ndbcluster_cond.cc
  ---
  added debian/defs.mk debian/control
client/completion_hash.cc:
  Remove not needed casts
client/my_readline.h:
  Remove some old types
client/mysql.cc:
  Simplify types
client/mysql_upgrade.c:
  Remove some old types
  Update call to dirname_part
client/mysqladmin.cc:
  Remove some old types
client/mysqlbinlog.cc:
  Remove some old types
  Change some buffers to be uchar to avoid casts
client/mysqlcheck.c:
  Remove some old types
client/mysqldump.c:
  Remove some old types
  Remove some not needed casts
  Change some string lengths to size_t
client/mysqlimport.c:
  Remove some old types
client/mysqlshow.c:
  Remove some old types
client/mysqlslap.c:
  Remove some old types
  Remove some not needed casts
client/mysqltest.c:
  Removed some old types
  Removed some not needed casts
  Updated hash-get-key function arguments
  Updated parameters to dirname_part()
client/readline.cc:
  Removed some old types
  Removed some not needed casts
  Changed some string lengths to use size_t
client/sql_string.cc:
  Removed some old types
dbug/dbug.c:
  Removed some old types
  Changed some string lengths to use size_t
  Changed some prototypes to avoid casts
extra/comp_err.c:
  Removed some old types
extra/innochecksum.c:
  Removed some old types
extra/my_print_defaults.c:
  Removed some old types
extra/mysql_waitpid.c:
  Removed some old types
extra/perror.c:
  Removed some old types
extra/replace.c:
  Removed some old types
  Updated parameters to dirname_part()
extra/resolve_stack_dump.c:
  Removed some old types
extra/resolveip.c:
  Removed some old types
include/config-win.h:
  Removed some old types
include/decimal.h:
  Changed binary strings to be uchar* instead of char*
include/ft_global.h:
  Removed some old types
include/hash.h:
  Removed some old types
include/heap.h:
  Removed some old types
  Changed records_under_level to be 'ulong' instead of 'uint' to clarify usage of variable
include/keycache.h:
  Removed some old types
include/m_ctype.h:
  Removed some old types
  Changed some string lengths to use size_t
  Changed character length functions to return uint
  unsigned char -> uchar
include/m_string.h:
  Removed some old types
  Changed some string lengths to use size_t
include/my_alloc.h:
  Changed some string lengths to use size_t
include/my_base.h:
  Removed some old types
include/my_dbug.h:
  Removed some old types
  Changed some string lengths to use size_t
  Changed db_dump() to take uchar * as argument for memory to reduce number of casts in usage
include/my_getopt.h:
  Removed some old types
include/my_global.h:
  Removed old types:
  my_size_t -> size_t
  byte -> uchar
  gptr -> uchar *
include/my_list.h:
  Removed some old types
include/my_nosys.h:
  Removed some old types
include/my_pthread.h:
  Removed some old types
include/my_sys.h:
  Removed some old types
  Changed MY_FILE_ERROR to be in line with new definitions of my_write()/my_read()
  Changed some string lengths to use size_t
  my_malloc() / my_free() now uses void *
  Updated parameters to dirname_part() & my_uncompress()
include/my_tree.h:
  Removed some old types
include/my_trie.h:
  Removed some old types
include/my_user.h:
  Changed some string lengths to use size_t
include/my_vle.h:
  Removed some old types
include/my_xml.h:
  Removed some old types
  Changed some string lengths to use size_t
include/myisam.h:
  Removed some old types
include/myisammrg.h:
  Removed some old types
include/mysql.h:
  Removed some old types
  Changed byte streams to use uchar* instead of char*
include/mysql_com.h:
  Removed some old types
  Changed some string lengths to use size_t
  Changed some buffers to be uchar* to avoid casts
include/queues.h:
  Removed some old types
include/sql_common.h:
  Removed some old types
include/sslopt-longopts.h:
  Removed some old types
include/violite.h:
  Removed some old types
  Changed some string lengths to use size_t
libmysql/client_settings.h:
  Removed some old types
libmysql/libmysql.c:
  Removed some old types
libmysql/manager.c:
  Removed some old types
libmysqld/emb_qcache.cc:
  Removed some old types
libmysqld/emb_qcache.h:
  Removed some old types
libmysqld/lib_sql.cc:
  Removed some old types
  Removed some not needed casts
  Changed some buffers to be uchar* to avoid casts
  true -> TRUE, false -> FALSE
mysys/array.c:
  Removed some old types
mysys/charset.c:
  Changed some string lengths to use size_t
mysys/checksum.c:
  Include zlib to get definition for crc32
  Removed some old types
mysys/default.c:
  Removed some old types
  Changed some string lengths to use size_t
mysys/default_modify.c:
  Changed some string lengths to use size_t
  Removed some not needed casts
mysys/hash.c:
  Removed some old types
  Changed some string lengths to use size_t
  Note: Prototype of hash_key() has changed which may cause problems if client uses hash_init() with a cast for the hash-get-key function.
  hash_element now takes 'ulong' as the index type (cleanup)
mysys/list.c:
  Removed some old types
mysys/mf_cache.c:
  Changed some string lengths to use size_t
mysys/mf_dirname.c:
  Removed some old types
  Changed some string lengths to use size_t
  Added argument to dirname_part() to avoid calculation of length for 'to'
mysys/mf_fn_ext.c:
  Removed some old types
  Updated parameters to dirname_part()
mysys/mf_format.c:
  Removed some old types
  Changed some string lengths to use size_t
mysys/mf_getdate.c:
  Removed some old types
mysys/mf_iocache.c:
  Removed some old types
  Changed some string lengths to use size_t
  Changed calculation of 'max_length' to be done the same way in all functions
mysys/mf_iocache2.c:
  Removed some old types
  Changed some string lengths to use size_t
  Clean up comments
  Removed not needed indentation
mysys/mf_keycache.c:
  Removed some old types
mysys/mf_keycaches.c:
  Removed some old types
mysys/mf_loadpath.c:
  Removed some old types
mysys/mf_pack.c:
  Removed some old types
  Changed some string lengths to use size_t
  Removed some not needed casts
  Removed very old VMS code
  Updated parameters to dirname_part()
  Use result of dirnam_part() to remove call to strcat()
mysys/mf_path.c:
  Removed some old types
mysys/mf_radix.c:
  Removed some old types
mysys/mf_same.c:
  Removed some old types
mysys/mf_sort.c:
  Removed some old types
mysys/mf_soundex.c:
  Removed some old types
mysys/mf_strip.c:
  Removed some old types
mysys/mf_tempdir.c:
  Removed some old types
mysys/mf_unixpath.c:
  Removed some old types
mysys/mf_wfile.c:
  Removed some old types
mysys/mulalloc.c:
  Removed some old types
mysys/my_alloc.c:
  Removed some old types
  Changed some string lengths to use size_t
  Use void* as type for allocated memory area
  Removed some not needed casts
  Changed argument 'Size' to 'length' according coding guidelines
mysys/my_chsize.c:
  Changed some buffers to be uchar* to avoid casts
mysys/my_compress.c:
  More comments
  Removed some old types
  Changed string lengths to use size_t
  Changed arguments to my_uncompress() to make them easier to understand
  Changed packfrm()/unpackfrm() to not be depending on uint size (portability fix)
  Changed type of 'pack_data' argument to packfrm() to avoid casts.
mysys/my_conio.c:
  Changed some string lengths to use size_t
mysys/my_create.c:
  Removed some old types
mysys/my_div.c:
  Removed some old types
mysys/my_error.c:
  Removed some old types
mysys/my_fopen.c:
  Removed some old types
mysys/my_fstream.c:
  Removed some old types
  Changed some string lengths to use size_t
  writen -> written
mysys/my_getopt.c:
  Removed some old types
mysys/my_getwd.c:
  Removed some old types
  More comments
mysys/my_init.c:
  Removed some old types
mysys/my_largepage.c:
  Removed some old types
  Changed some string lengths to use size_t
mysys/my_lib.c:
  Removed some old types
mysys/my_lockmem.c:
  Removed some old types
mysys/my_malloc.c:
  Removed some old types
  Changed malloc(), free() and related functions to use void *
  Changed all functions to use size_t
mysys/my_memmem.c:
  Indentation cleanup
mysys/my_once.c:
  Removed some old types
  Changed malloc(), free() and related functions to use void *
mysys/my_open.c:
  Removed some old types
mysys/my_pread.c:
  Removed some old types
  Changed all functions to use size_t
  Added comment for how my_pread() / my_pwrite() are supposed to work.
  Removed windows specific code to restore cursor position as this causes slowdown on windows and we should not mix read() and pread() calls anyway as this is not thread safe.
  (If we ever would really need this, it should be enabled only with a flag argument)
mysys/my_quick.c:
  Removed some old types
  Changed all functions to use size_t
mysys/my_read.c:
  Removed some old types
  Changed all functions to use size_t
mysys/my_realloc.c:
  Removed some old types
  Use void* as type for allocated memory area
  Changed all functions to use size_t
mysys/my_static.c:
  Removed some old types
mysys/my_static.h:
  Removed some old types
mysys/my_vle.c:
  Removed some old types
mysys/my_wincond.c:
  Removed some old types
mysys/my_windac.c:
  Removed some old types
mysys/my_write.c:
  Removed some old types
  Changed all functions to use size_t
mysys/ptr_cmp.c:
  Removed some old types
  Changed all functions to use size_t
mysys/queues.c:
  Removed some old types
mysys/safemalloc.c:
  Removed some old types
  Changed malloc(), free() and related functions to use void *
  Changed all functions to use size_t
mysys/string.c:
  Removed some old types
  Changed all functions to use size_t
mysys/testhash.c:
  Removed some old types
mysys/thr_alarm.c:
  Removed some old types
mysys/thr_lock.c:
  Removed some old types
mysys/tree.c:
  Removed some old types
mysys/trie.c:
  Removed some old types
mysys/typelib.c:
  Removed some old types
plugin/daemon_example/daemon_example.cc:
  Removed some old types
regex/reginit.c:
  Removed some old types
server-tools/instance-manager/buffer.cc:
  Changed some string lengths to use size_t
  Changed buffer to be of type uchar*
server-tools/instance-manager/buffer.h:
  Changed some string lengths to use size_t
  Changed buffer to be of type uchar*
server-tools/instance-manager/commands.cc:
  Removed some old types
  Changed some string lengths to use size_t
  Changed buffer to be of type uchar*
server-tools/instance-manager/instance_map.cc:
  Removed some old types
  Changed some string lengths to use size_t
  Changed buffer to be of type uchar*
server-tools/instance-manager/instance_options.cc:
  Changed buffer to be of type uchar*
  Replaced alloc_root + strcpy() with strdup_root()
server-tools/instance-manager/mysql_connection.cc:
  Changed buffer to be of type uchar*
server-tools/instance-manager/options.cc:
  Removed some old types
server-tools/instance-manager/parse.cc:
  Changed some string lengths to use size_t
server-tools/instance-manager/parse.h:
  Removed some old types
  Changed some string lengths to use size_t
server-tools/instance-manager/protocol.cc:
  Changed some buffers to be uchar* to avoid casts
  Changed some string lengths to use size_t
server-tools/instance-manager/protocol.h:
  Changed some string lengths to use size_t
server-tools/instance-manager/user_map.cc:
  Removed some old types
  Changed some string lengths to use size_t
sql/derror.cc:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
  Changed some string lengths to use size_t
sql/discover.cc:
  Changed in readfrm() and writefrom() the type for argument 'frmdata' to uchar** to avoid casts
  Changed some string lengths to use size_t
  Changed some buffers to be uchar* to avoid casts
sql/event_data_objects.cc:
  Removed some old types
  Added missing casts for alloc() and sprintf()
sql/event_db_repository.cc:
  Changed some buffers to be uchar* to avoid casts
  Added missing casts for sprintf()
sql/event_queue.cc:
  Removed some old types
sql/field.cc:
  Removed some old types
  Changed memory buffers to be uchar*
  Changed some string lengths to use size_t
  Removed a lot of casts
  Safety fix in Field_blob::val_decimal() to not access zero pointer
sql/field.h:
  Removed some old types
  Changed memory buffers to be uchar* (except of store() as this would have caused too many other changes). 
  Changed some string lengths to use size_t
  Removed some not needed casts
  Changed val_xxx(xxx, new_ptr) to take const pointers
sql/field_conv.cc:
  Removed some old types
  Added casts required because memory area pointers are now uchar*
sql/filesort.cc:
  Initalize variable that was used unitialized in error conditions
sql/gen_lex_hash.cc:
  Removed some old types
  Changed memory buffers to be uchar*
  Changed some string lengths to use size_t
  Removed a lot of casts
  Safety fix in Field_blob::val_decimal() to not access zero pointer
sql/gstream.h:
  Added required cast
sql/ha_ndbcluster.cc:
  Removed some old types
  Updated hash-get-key function arguments
  Changed some buffers to be uchar* to avoid casts
  Added required casts
  Removed some not needed casts
sql/ha_ndbcluster.h:
  Removed some old types
sql/ha_ndbcluster_binlog.cc:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
  Replaced sql_alloc() + memcpy() + set end 0 with sql_strmake()
  Changed some string lengths to use size_t
  Added missing casts for alloc() and sprintf()
sql/ha_ndbcluster_binlog.h:
  Removed some old types
sql/ha_ndbcluster_cond.cc:
  Removed some old types
  Removed some not needed casts
sql/ha_ndbcluster_cond.h:
  Removed some old types
sql/ha_partition.cc:
  Removed some old types
  Changed prototype for change_partition() to avoid casts
sql/ha_partition.h:
  Removed some old types
sql/handler.cc:
  Removed some old types
  Changed some string lengths to use size_t
sql/handler.h:
  Removed some old types
  Changed some string lengths to use size_t
  Changed type for 'frmblob' parameter for discover() and ha_discover() to get fewer casts
sql/hash_filo.h:
  Removed some old types
  Changed all functions to use size_t
sql/hostname.cc:
  Removed some old types
sql/item.cc:
  Removed some old types
  Changed some string lengths to use size_t
  Use strmake() instead of memdup() to create a null terminated string.
  Updated calls to new Field()
sql/item.h:
  Removed some old types
  Changed malloc(), free() and related functions to use void *
  Changed some buffers to be uchar* to avoid casts
sql/item_cmpfunc.cc:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
sql/item_cmpfunc.h:
  Removed some old types
sql/item_create.cc:
  Removed some old types
sql/item_func.cc:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
  Removed some not needed casts
  Added test for failing alloc() in init_result_field()
  Remove old confusing comment
  Fixed compiler warning
sql/item_func.h:
  Removed some old types
sql/item_row.cc:
  Removed some old types
sql/item_row.h:
  Removed some old types
sql/item_strfunc.cc:
  Include zlib (needed becasue we call crc32)
  Removed some old types
sql/item_strfunc.h:
  Removed some old types
  Changed some types to match new function prototypes
sql/item_subselect.cc:
  Removed some old types
sql/item_subselect.h:
  Removed some old types
sql/item_sum.cc:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
  Removed some not needed casts
sql/item_sum.h:
  Removed some old types
sql/item_timefunc.cc:
  Removed some old types
  Changed some string lengths to use size_t
sql/item_timefunc.h:
  Removed some old types
sql/item_xmlfunc.cc:
  Changed some string lengths to use size_t
sql/item_xmlfunc.h:
  Removed some old types
sql/key.cc:
  Removed some old types
  Removed some not needed casts
sql/lock.cc:
  Removed some old types
  Added some cast to my_multi_malloc() arguments for safety
sql/log.cc:
  Removed some old types
  Changed some string lengths to use size_t
  Changed some buffers to be uchar* to avoid casts
  Changed usage of pwrite() to not assume it holds the cursor position for the file
  Made usage of my_read() safer
sql/log_event.cc:
  Removed some old types
  Added checking of return value of malloc() in pack_info()
  Changed some buffers to be uchar* to avoid casts
  Removed some 'const' to avoid casts
  Added missing casts for alloc() and sprintf()
  Added required casts
  Removed some not needed casts
  Added some cast to my_multi_malloc() arguments for safety
sql/log_event.h:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
sql/log_event_old.cc:
  Changed some buffers to be uchar* to avoid casts
  Removed some not needed casts
sql/log_event_old.h:
  Changed some buffers to be uchar* to avoid casts
sql/mf_iocache.cc:
  Removed some old types
sql/my_decimal.cc:
  Changed memory area to use uchar*
sql/my_decimal.h:
  Changed memory area to use uchar*
sql/mysql_priv.h:
  Removed some old types
  Changed malloc(), free() and related functions to use void *
  Changed some string lengths to use size_t
  Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid long overflow
  Changed some buffers to be uchar* to avoid casts
sql/mysqld.cc:
  Removed some old types
sql/net_serv.cc:
  Removed some old types
  Changed some string lengths to use size_t
  Changed some buffers to be uchar* to avoid casts
  Ensure that vio_read()/vio_write() return values are stored in a size_t variable
  Removed some not needed casts
sql/opt_range.cc:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
  Removed some not needed casts
sql/opt_range.h:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
sql/opt_sum.cc:
  Removed some old types
  Removed some not needed casts
sql/parse_file.cc:
  Removed some old types
  Changed some string lengths to use size_t
  Changed alloc_root + memcpy + set end 0 -> strmake_root()
sql/parse_file.h:
  Removed some old types
sql/partition_info.cc:
  Removed some old types
  Added missing casts for alloc()
  Changed some buffers to be uchar* to avoid casts
sql/partition_info.h:
  Changed some buffers to be uchar* to avoid casts
sql/protocol.cc:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
  Removed some not needed casts
sql/protocol.h:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
  Changed some string lengths to use size_t
sql/records.cc:
  Removed some old types
sql/repl_failsafe.cc:
  Removed some old types
  Changed some string lengths to use size_t
  Added required casts
sql/rpl_filter.cc:
  Removed some old types
  Updated hash-get-key function arguments
  Changed some string lengths to use size_t
sql/rpl_filter.h:
  Changed some string lengths to use size_t
sql/rpl_injector.h:
  Removed some old types
sql/rpl_record.cc:
  Removed some old types
  Removed some not needed casts
  Changed some buffers to be uchar* to avoid casts
sql/rpl_record.h:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
sql/rpl_record_old.cc:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
  Removed some not needed casts
sql/rpl_record_old.h:
  Removed some old types
  Changed some buffers to be uchar* to avoid cast
sql/rpl_rli.cc:
  Removed some old types
sql/rpl_tblmap.cc:
  Removed some old types
sql/rpl_tblmap.h:
  Removed some old types
sql/rpl_utility.cc:
  Removed some old types
sql/rpl_utility.h:
  Removed some old types
  Changed type of m_size from my_size_t to ulong to reflect that m_size is the number of elements in the array, not a string/memory length
sql/set_var.cc:
  Removed some old types
  Updated parameters to dirname_part()
sql/set_var.h:
  Removed some old types
sql/slave.cc:
  Removed some old types
  Changed some string lengths to use size_t
sql/slave.h:
  Removed some old types
sql/sp.cc:
  Removed some old types
  Added missing casts for printf()
sql/sp.h:
  Removed some old types
  Updated hash-get-key function arguments
sql/sp_cache.cc:
  Removed some old types
  Added missing casts for printf()
  Updated hash-get-key function arguments
sql/sp_head.cc:
  Removed some old types
  Added missing casts for alloc() and printf()
  Added required casts
  Updated hash-get-key function arguments
sql/sp_head.h:
  Removed some old types
sql/sp_pcontext.cc:
  Removed some old types
sql/sp_pcontext.h:
  Removed some old types
sql/sql_acl.cc:
  Removed some old types
  Changed some string lengths to use size_t
  Changed some buffers to be uchar* to avoid casts
  Removed some not needed casts
  Added required casts
sql/sql_analyse.cc:
  Changed some buffers to be uchar* to avoid casts
sql/sql_analyse.h:
  Changed some buffers to be uchar* to avoid casts
sql/sql_array.h:
  Removed some old types
sql/sql_base.cc:
  Removed some old types
  Updated hash-get-key function arguments
sql/sql_binlog.cc:
  Removed some old types
  Added missing casts for printf()
sql/sql_cache.cc:
  Removed some old types
  Updated hash-get-key function arguments
  Removed some not needed casts
  Changed some string lengths to use size_t
sql/sql_cache.h:
  Removed some old types
  Removed reference to not existing function cache_key()
  Updated hash-get-key function arguments
sql/sql_class.cc:
  Removed some old types
  Updated hash-get-key function arguments
  Added missing casts for alloc()
  Updated hash-get-key function arguments
  Moved THD::max_row_length() to table.cc (as it's not depending on THD)
  Removed some not needed casts
sql/sql_class.h:
  Removed some old types
  Changed malloc(), free() and related functions to use void *
  Removed some not needed casts
  Changed some string lengths to use size_t
  Moved max_row_length and max_row_length_blob() to table.cc, as they are not depending on THD
sql/sql_connect.cc:
  Removed some old types
  Added required casts
sql/sql_db.cc:
  Removed some old types
  Removed some not needed casts
  Added some cast to my_multi_malloc() arguments for safety
  Added missing casts for alloc()
sql/sql_delete.cc:
  Removed some old types
sql/sql_handler.cc:
  Removed some old types
  Updated hash-get-key function arguments
  Added some cast to my_multi_malloc() arguments for safety
sql/sql_help.cc:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
  Removed some not needed casts
sql/sql_insert.cc:
  Removed some old types
  Added missing casts for alloc() and printf()
sql/sql_lex.cc:
  Removed some old types
sql/sql_lex.h:
  Removed some old types
  Removed some not needed casts
sql/sql_list.h:
  Removed some old types
  Removed some not needed casts
sql/sql_load.cc:
  Removed some old types
  Removed compiler warning
sql/sql_manager.cc:
  Removed some old types
sql/sql_map.cc:
  Removed some old types
sql/sql_map.h:
  Removed some old types
sql/sql_olap.cc:
  Removed some old types
sql/sql_parse.cc:
  Removed some old types
  Trivial move of code lines to make things more readable
  Changed some string lengths to use size_t
  Added missing casts for alloc()
sql/sql_partition.cc:
  Removed some old types
  Removed compiler warnings about not used functions
  Changed some buffers to be uchar* to avoid casts
  Removed some not needed casts
sql/sql_partition.h:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
sql/sql_plugin.cc:
  Removed some old types
  Added missing casts for alloc()
  Updated hash-get-key function arguments
sql/sql_prepare.cc:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
  Added missing casts for alloc() and printf()
sql-common/client.c:
  Removed some old types
  Changed some memory areas to use uchar*
sql-common/my_user.c:
  Changed some string lengths to use size_t
sql-common/pack.c:
  Changed some buffers to be uchar* to avoid casts
sql/sql_repl.cc:
  Added required casts
  Changed some buffers to be uchar* to avoid casts
  Changed some string lengths to use size_t
sql/sql_select.cc:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
  Removed some old types
sql/sql_select.h:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
sql/sql_servers.cc:
  Removed some old types
  Updated hash-get-key function arguments
sql/sql_show.cc:
  Removed some old types
  Added missing casts for alloc()
  Removed some not needed casts
sql/sql_string.cc:
  Removed some old types
  Added required casts
sql/sql_table.cc:
  Removed some old types
  Removed compiler warning about not used variable
  Changed some buffers to be uchar* to avoid casts
  Removed some not needed casts
sql/sql_test.cc:
  Removed some old types
sql/sql_trigger.cc:
  Removed some old types
  Added missing casts for alloc()
sql/sql_udf.cc:
  Removed some old types
  Updated hash-get-key function arguments
sql/sql_union.cc:
  Removed some old types
sql/sql_update.cc:
  Removed some old types
  Removed some not needed casts
sql/sql_view.cc:
  Removed some old types
sql/sql_yacc.yy:
  Removed some old types
  Changed some string lengths to use size_t
  Added missing casts for alloc()
sql/stacktrace.c:
  Removed some old types
sql/stacktrace.h:
  Removed some old types
sql/structs.h:
  Removed some old types
sql/table.cc:
  Removed some old types
  Updated hash-get-key function arguments
  Changed some buffers to be uchar* to avoid casts
  Removed setting of LEX_STRING() arguments in declaration
  Added required casts
  More function comments
  Moved max_row_length() here from sql_class.cc/sql_class.h
sql/table.h:
  Removed some old types
  Changed some string lengths to use size_t
sql/thr_malloc.cc:
  Use void* as type for allocated memory area
  Changed all functions to use size_t
sql/tzfile.h:
  Changed some buffers to be uchar* to avoid casts
sql/tztime.cc:
  Changed some buffers to be uchar* to avoid casts
  Updated hash-get-key function arguments
  Added missing casts for alloc()
  Removed some not needed casts
sql/uniques.cc:
  Removed some old types
  Removed some not needed casts
sql/unireg.cc:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
  Removed some not needed casts
  Added missing casts for alloc()
storage/archive/archive_reader.c:
  Removed some old types
storage/archive/azio.c:
  Removed some old types
  Removed some not needed casts
storage/archive/ha_archive.cc:
  Removed some old types
  Changed type for 'frmblob' in archive_discover() to match handler
  Updated hash-get-key function arguments
  Removed some not needed casts
storage/archive/ha_archive.h:
  Removed some old types
storage/blackhole/ha_blackhole.cc:
  Removed some old types
storage/blackhole/ha_blackhole.h:
  Removed some old types
storage/csv/ha_tina.cc:
  Removed some old types
  Updated hash-get-key function arguments
  Changed some buffers to be uchar* to avoid casts
storage/csv/ha_tina.h:
  Removed some old types
  Removed some not needed casts
storage/csv/transparent_file.cc:
  Removed some old types
  Changed type of 'bytes_read' to be able to detect read errors
  Fixed indentation
storage/csv/transparent_file.h:
  Removed some old types
storage/example/ha_example.cc:
  Removed some old types
  Updated hash-get-key function arguments
storage/example/ha_example.h:
  Removed some old types
storage/federated/ha_federated.cc:
  Removed some old types
  Updated hash-get-key function arguments
  Removed some not needed casts
storage/federated/ha_federated.h:
  Removed some old types
storage/heap/_check.c:
  Changed some buffers to be uchar* to avoid casts
storage/heap/_rectest.c:
  Removed some old types
storage/heap/ha_heap.cc:
  Removed some old types
storage/heap/ha_heap.h:
  Removed some old types
storage/heap/heapdef.h:
  Removed some old types
storage/heap/hp_block.c:
  Removed some old types
  Changed some string lengths to use size_t
storage/heap/hp_clear.c:
  Removed some old types
storage/heap/hp_close.c:
  Removed some old types
storage/heap/hp_create.c:
  Removed some old types
storage/heap/hp_delete.c:
  Removed some old types
storage/heap/hp_hash.c:
  Removed some old types
storage/heap/hp_info.c:
  Removed some old types
storage/heap/hp_open.c:
  Removed some old types
storage/heap/hp_rfirst.c:
  Removed some old types
storage/heap/hp_rkey.c:
  Removed some old types
storage/heap/hp_rlast.c:
  Removed some old types
storage/heap/hp_rnext.c:
  Removed some old types
storage/heap/hp_rprev.c:
  Removed some old types
storage/heap/hp_rrnd.c:
  Removed some old types
storage/heap/hp_rsame.c:
  Removed some old types
storage/heap/hp_scan.c:
  Removed some old types
storage/heap/hp_test1.c:
  Removed some old types
storage/heap/hp_test2.c:
  Removed some old types
storage/heap/hp_update.c:
  Removed some old types
storage/heap/hp_write.c:
  Removed some old types
  Changed some string lengths to use size_t
storage/innobase/handler/ha_innodb.cc:
  Removed some old types
  Updated hash-get-key function arguments
  Added missing casts for alloc() and printf()
  Removed some not needed casts
storage/innobase/handler/ha_innodb.h:
  Removed some old types
storage/myisam/ft_boolean_search.c:
  Removed some old types
storage/myisam/ft_nlq_search.c:
  Removed some old types
storage/myisam/ft_parser.c:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
storage/myisam/ft_static.c:
  Removed some old types
storage/myisam/ft_stopwords.c:
  Removed some old types
storage/myisam/ft_update.c:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
storage/myisam/ftdefs.h:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
storage/myisam/fulltext.h:
  Removed some old types
storage/myisam/ha_myisam.cc:
  Removed some old types
storage/myisam/ha_myisam.h:
  Removed some old types
storage/myisam/mi_cache.c:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
storage/myisam/mi_check.c:
  Removed some old types
storage/myisam/mi_checksum.c:
  Removed some old types
storage/myisam/mi_close.c:
  Removed some old types
storage/myisam/mi_create.c:
  Removed some old types
storage/myisam/mi_delete.c:
  Removed some old types
storage/myisam/mi_delete_all.c:
  Removed some old types
storage/myisam/mi_dynrec.c:
  Removed some old types
storage/myisam/mi_extra.c:
  Removed some old types
storage/myisam/mi_key.c:
  Removed some old types
storage/myisam/mi_locking.c:
  Removed some old types
storage/myisam/mi_log.c:
  Removed some old types
storage/myisam/mi_open.c:
  Removed some old types
  Removed some not needed casts
  Check argument of my_write()/my_pwrite() in functions returning int
  Added casting of string lengths to size_t
storage/myisam/mi_packrec.c:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
storage/myisam/mi_page.c:
  Removed some old types
storage/myisam/mi_preload.c:
  Removed some old types
storage/myisam/mi_range.c:
  Removed some old types
storage/myisam/mi_rfirst.c:
  Removed some old types
storage/myisam/mi_rkey.c:
  Removed some old types
storage/myisam/mi_rlast.c:
  Removed some old types
storage/myisam/mi_rnext.c:
  Removed some old types
storage/myisam/mi_rnext_same.c:
  Removed some old types
storage/myisam/mi_rprev.c:
  Removed some old types
storage/myisam/mi_rrnd.c:
  Removed some old types
storage/myisam/mi_rsame.c:
  Removed some old types
storage/myisam/mi_rsamepos.c:
  Removed some old types
storage/myisam/mi_scan.c:
  Removed some old types
storage/myisam/mi_search.c:
  Removed some old types
storage/myisam/mi_static.c:
  Removed some old types
storage/myisam/mi_statrec.c:
  Removed some old types
storage/myisam/mi_test1.c:
  Removed some old types
storage/myisam/mi_test2.c:
  Removed some old types
storage/myisam/mi_test3.c:
  Removed some old types
storage/myisam/mi_unique.c:
  Removed some old types
storage/myisam/mi_update.c:
  Removed some old types
storage/myisam/mi_write.c:
  Removed some old types
storage/myisam/myisam_ftdump.c:
  Removed some old types
storage/myisam/myisamchk.c:
  Removed some old types
storage/myisam/myisamdef.h:
  Removed some old types
storage/myisam/myisamlog.c:
  Removed some old types
  Indentation fix
storage/myisam/myisampack.c:
  Removed some old types
storage/myisam/rt_index.c:
  Removed some old types
storage/myisam/rt_split.c:
  Removed some old types
storage/myisam/sort.c:
  Removed some old types
storage/myisam/sp_defs.h:
  Removed some old types
storage/myisam/sp_key.c:
  Removed some old types
storage/myisammrg/ha_myisammrg.cc:
  Removed some old types
storage/myisammrg/ha_myisammrg.h:
  Removed some old types
storage/myisammrg/myrg_close.c:
  Removed some old types
storage/myisammrg/myrg_def.h:
  Removed some old types
storage/myisammrg/myrg_delete.c:
  Removed some old types
storage/myisammrg/myrg_open.c:
  Removed some old types
  Updated parameters to dirname_part()
storage/myisammrg/myrg_queue.c:
  Removed some old types
storage/myisammrg/myrg_rfirst.c:
  Removed some old types
storage/myisammrg/myrg_rkey.c:
  Removed some old types
storage/myisammrg/myrg_rlast.c:
  Removed some old types
storage/myisammrg/myrg_rnext.c:
  Removed some old types
storage/myisammrg/myrg_rnext_same.c:
  Removed some old types
storage/myisammrg/myrg_rprev.c:
  Removed some old types
storage/myisammrg/myrg_rrnd.c:
  Removed some old types
storage/myisammrg/myrg_rsame.c:
  Removed some old types
storage/myisammrg/myrg_update.c:
  Removed some old types
storage/myisammrg/myrg_write.c:
  Removed some old types
storage/ndb/include/util/ndb_opts.h:
  Removed some old types
storage/ndb/src/cw/cpcd/main.cpp:
  Removed some old types
storage/ndb/src/kernel/vm/Configuration.cpp:
  Removed some old types
storage/ndb/src/mgmclient/main.cpp:
  Removed some old types
storage/ndb/src/mgmsrv/InitConfigFileParser.cpp:
  Removed some old types
  Removed old disabled code
storage/ndb/src/mgmsrv/main.cpp:
  Removed some old types
storage/ndb/src/ndbapi/NdbBlob.cpp:
  Removed some old types
storage/ndb/src/ndbapi/NdbOperationDefine.cpp:
  Removed not used variable
storage/ndb/src/ndbapi/NdbOperationInt.cpp:
  Added required casts
storage/ndb/src/ndbapi/NdbScanOperation.cpp:
  Added required casts
storage/ndb/tools/delete_all.cpp:
  Removed some old types
storage/ndb/tools/desc.cpp:
  Removed some old types
storage/ndb/tools/drop_index.cpp:
  Removed some old types
storage/ndb/tools/drop_tab.cpp:
  Removed some old types
storage/ndb/tools/listTables.cpp:
  Removed some old types
storage/ndb/tools/ndb_config.cpp:
  Removed some old types
storage/ndb/tools/restore/consumer_restore.cpp:
  Changed some buffers to be uchar* to avoid casts with new defintion of packfrm()
storage/ndb/tools/restore/restore_main.cpp:
  Removed some old types
storage/ndb/tools/select_all.cpp:
  Removed some old types
storage/ndb/tools/select_count.cpp:
  Removed some old types
storage/ndb/tools/waiter.cpp:
  Removed some old types
strings/bchange.c:
  Changed function to use uchar * and size_t
strings/bcmp.c:
  Changed function to use uchar * and size_t
strings/bmove512.c:
  Changed function to use uchar * and size_t
strings/bmove_upp.c:
  Changed function to use uchar * and size_t
strings/ctype-big5.c:
  Changed functions to use size_t
  Changed character length functions to return uint
strings/ctype-bin.c:
  Changed functions to use size_t
strings/ctype-cp932.c:
  Changed functions to use size_t
  Changed character length functions to return uint
strings/ctype-czech.c:
  Fixed indentation
  Changed functions to use size_t
strings/ctype-euc_kr.c:
  Changed functions to use size_t
  Changed character length functions to return uint
strings/ctype-eucjpms.c:
  Changed functions to use size_t
  Changed character length functions to return uint
  unsigned char -> uchar
strings/ctype-gb2312.c:
  Changed functions to use size_t
  Changed character length functions to return uint
strings/ctype-gbk.c:
  Changed functions to use size_t
  Changed character length functions to return uint
strings/ctype-latin1.c:
  Changed functions to use size_t
  Changed character length functions to return uint
  unsigned char -> uchar
strings/ctype-mb.c:
  Changed functions to use size_t
  Changed character length functions to return uint
strings/ctype-simple.c:
  Changed functions to use size_t
  Simpler loops for caseup/casedown
  unsigned int -> uint
  unsigned char -> uchar
strings/ctype-sjis.c:
  Changed functions to use size_t
  Changed character length functions to return uint
strings/ctype-tis620.c:
  Changed functions to use size_t
  Changed character length functions to return uint
  unsigned char -> uchar
strings/ctype-uca.c:
  Changed functions to use size_t
  unsigned char -> uchar
strings/ctype-ucs2.c:
  Moved inclusion of stdarg.h to other includes
  usigned char -> uchar
  Changed functions to use size_t
  Changed character length functions to return uint
strings/ctype-ujis.c:
  Changed functions to use size_t
  Changed character length functions to return uint
  unsigned char -> uchar
strings/ctype-utf8.c:
  Changed functions to use size_t
  unsigned char -> uchar
  Indentation fixes
strings/ctype-win1250ch.c:
  Indentation fixes
  Changed functions to use size_t
strings/ctype.c:
  Changed functions to use size_t
strings/decimal.c:
  Changed type for memory argument to uchar *
strings/do_ctype.c:
  Indentation fixes
strings/my_strtoll10.c:
  unsigned char -> uchar
strings/my_vsnprintf.c:
  Changed functions to use size_t
strings/r_strinstr.c:
  Removed some old types
  Changed functions to use size_t
strings/str_test.c:
  Removed some old types
strings/strappend.c:
  Changed functions to use size_t
strings/strcont.c:
  Removed some old types
strings/strfill.c:
  Removed some old types
strings/strinstr.c:
  Changed functions to use size_t
strings/strlen.c:
  Changed functions to use size_t
strings/strmake.c:
  Changed functions to use size_t
strings/strnlen.c:
  Changed functions to use size_t
strings/strnmov.c:
  Changed functions to use size_t
strings/strto.c:
  unsigned char -> uchar
strings/strtod.c:
  Changed functions to use size_t
strings/strxnmov.c:
  Changed functions to use size_t
strings/xml.c:
  Changed functions to use size_t
  Indentation fixes
tests/mysql_client_test.c:
  Removed some old types
tests/thread_test.c:
  Removed some old types
vio/test-ssl.c:
  Removed some old types
vio/test-sslclient.c:
  Removed some old types
vio/test-sslserver.c:
  Removed some old types
vio/vio.c:
  Removed some old types
vio/vio_priv.h:
  Removed some old types
  Changed vio_read()/vio_write() to work with size_t
vio/viosocket.c:
  Changed vio_read()/vio_write() to work with size_t
  Indentation fixes
vio/viossl.c:
  Changed vio_read()/vio_write() to work with size_t
  Indentation fixes
vio/viosslfactories.c:
  Removed some old types
vio/viotest-ssl.c:
  Removed some old types
win/README:
  More explanations
2007-05-10 12:59:39 +03:00
unknown
d66e47213d Small fixes for merge.
mysql-test/include/not_embedded.inc:
  Fixed a typo.
mysql-test/lib/mtr_cases.pl:
  Fixed typo and wrong error message.
mysql-test/r/binlog_statement_insert_delayed.result:
  Fixed result file.
sql/event_db_repository.cc:
  Fixed type.
sql/log.cc:
  Fixed type.
2007-04-10 18:01:29 +03:00
unknown
a2989a35f5 Merge jamppa@bk-internal.mysql.com:/home/bk/mysql-5.1
into  ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-5.1-marvel


client/mysqlcheck.c:
  Auto merged
client/mysqldump.c:
  Auto merged
include/my_time.h:
  Auto merged
mysql-test/r/date_formats.result:
  Auto merged
mysql-test/r/grant.result:
  Auto merged
mysql-test/r/sp.result:
  Auto merged
mysql-test/r/type_date.result:
  Auto merged
mysql-test/r/type_datetime.result:
  Auto merged
mysql-test/t/grant.test:
  Auto merged
mysql-test/t/sp.test:
  Auto merged
mysys/my_malloc.c:
  Auto merged
mysys/my_static.c:
  Auto merged
mysys/safemalloc.c:
  Auto merged
sql/event_queue.cc:
  Auto merged
sql/field.cc:
  Auto merged
sql/field.h:
  Auto merged
sql/ha_ndbcluster.cc:
  Auto merged
sql/handler.cc:
  Auto merged
sql/item.h:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/item_func.h:
  Auto merged
sql/log.cc:
  Auto merged
sql/log_event.cc:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/slave.cc:
  Auto merged
sql/sp.cc:
  Auto merged
sql/sp_head.cc:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_db.cc:
  Auto merged
sql/sql_delete.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_repl.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
sql/sql_update.cc:
  Auto merged
sql/table.cc:
  Auto merged
sql-common/client.c:
  Auto merged
sql-common/my_time.c:
  Auto merged
sql/time.cc:
  Auto merged
storage/archive/ha_archive.cc:
  Auto merged
storage/innobase/handler/ha_innodb.cc:
  Auto merged
storage/ndb/src/mgmclient/CommandInterpreter.cpp:
  Auto merged
tests/mysql_client_test.c:
  Auto merged
client/client_priv.h:
  Manual merge with main 5.1 source.
sql/event_data_objects.cc:
  Manual merge with main 5.1 source.
sql/event_db_repository.cc:
  Manual merge with main 5.1 source.
sql/mysqld.cc:
  Manual merge with main 5.1 source.
sql/sql_load.cc:
  Manual merge with main 5.1 source.
sql/sql_parse.cc:
  Manual merge with main 5.1 source.
2007-04-10 16:28:47 +03:00
unknown
93e7a47082 Fix events.test failure on manu pushbuild hosts (5.1-runtime).
sql/event_db_repository.cc:
  Fix events.test failure on many pushbuild hosts (5.1-runtime).
  Make sure that when reading mysql.event the key number matches
  the field number that we're using to read by key.
  Also, print an error in case of a handler error (to not return 
  'Unknown error' when a table is corrupted to the user).
2007-04-06 02:57:38 +04:00
unknown
ff452d050a Post-merge and post-review fixes for the patch for
Bug#23631 "Events: SHOW VARIABLES doesn't work when mysql.event 
is damaged:


mysql-test/r/events.result:
  Update results (a post-merge fix)
mysql-test/r/events_bugs.result:
  Update results (a post-merge fix)
mysql-test/r/events_scheduling.result:
  Update results (a post-merge fix)
mysql-test/t/events_scheduling.test:
  Make sure this test has no races.
sql/event_data_objects.cc:
  Manual post-merge fix for the events replication patch.
sql/event_data_objects.h:
  A post-merge fix.
sql/event_db_repository.cc:
  A post-merge fix.
sql/event_scheduler.cc:
  We should drop the event inside ::execute since there we have
  the right credentials to do so (otherwise Events::drop_event
  returns "access denied" error).
sql/events.cc:
  A post-review fix for: rename start_or_stop_event_scheduler
  to switch_event_scheduler_state.
sql/events.h:
  A post-review fix for: rename start_or_stop_event_scheduler
  to switch_event_scheduler_state.
sql/set_var.cc:
  A post-review fix for: rename start_or_stop_event_scheduler
  to switch_event_scheduler_state.
sql/sql_yacc.yy:
  Remove unused declaratoins.
2007-04-05 20:47:22 +04:00
unknown
a36054f420 Merge bk-internal.mysql.com:/home/bk/mysql-5.1-runtime
into  vajra.(none):/opt/local/work/mysql-5.1-c1


mysql-test/r/events_bugs.result:
  Auto merged
mysql-test/r/events_scheduling.result:
  Auto merged
mysql-test/t/events.test:
  Auto merged
mysql-test/t/events_scheduling.test:
  Auto merged
sql/event_data_objects.h:
  Auto merged
sql/event_db_repository.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/set_var.h:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/table.h:
  Auto merged
sql/share/errmsg.txt:
  Auto merged
mysql-test/r/events.result:
  e
  Use local.
mysql-test/r/events_restart_phase1.result:
  Use local
mysql-test/r/events_time_zone.result:
  SCCS merged
mysql-test/t/events_restart_phase1.test:
  Use local
sql/event_data_objects.cc:
  Use local
sql/event_db_repository.cc:
  Manual merge.
sql/event_queue.cc:
  Manual merge.
sql/events.cc:
  Manual merge.
2007-04-05 15:49:46 +04:00
unknown
fa1d637e89 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


mysql-test/r/events.result:
  Update results.
mysql-test/r/events_bugs.result:
  Update results.
mysql-test/r/events_restart_phase1.result:
  Update results.
mysql-test/r/events_restart_phase2.result:
  Update results.
mysql-test/r/events_restart_phase3.result:
  Update results.
mysql-test/r/events_scheduling.result:
  Update results.
mysql-test/r/events_time_zone.result:
  Update results.
mysql-test/t/events.test:
  Add new tests for tampering with mysql.event and some more
  tests for sub-statements, LOCK TABLES mode and pre-locking.
mysql-test/t/events_bugs.test:
  Move the non-concurrent part of test for Bug 16420 to this file.
mysql-test/t/events_restart_phase1.test:
  Rewrite events_restart_* tests to take into account that now
  we check mysql.event table only once, at server startup.
mysql-test/t/events_restart_phase2.test:
  Rewrite events_restart_* tests to take into account that now
  we check mysql.event table only once, at server startup.
mysql-test/t/events_restart_phase3.test:
  Rewrite events_restart_* tests to take into account that now
  we check mysql.event table only once, at server startup.
mysql-test/t/events_scheduling.test:
  Add more coverage for event_scheduler global variable.
mysql-test/t/events_time_zone.test:
  Move the non-concurrent part of the tests for Bug 16420 to 
  events_bugs.test
sql/event_data_objects.cc:
  Move update_timing_fields functionality to Event_db_repository.
  Make loading of events from a table record more robust to tampering
  with the table - now we do not check mysql.event on every table open.
sql/event_data_objects.h:
  Cleanup.
sql/event_db_repository.cc:
  Now Event_db_repository is responsible for table I/O only.
  All the logic of events DDL is handled outside, in Events class please
  refer to the added test coverage to see how this change affected
  the behavior of Event Scheduler.
  Dependency on sp_head.h and sp.h removed.
  Make this module robust to tweaks with mysql.event table.
  Move check_system_tables from events.cc to this file
sql/event_db_repository.h:
  Cleanup declarations (remove unused ones, change return type to bool
  from int).
sql/event_queue.cc:
  Update to adapt to the new start up scheme of the Event Scheduler.
sql/event_queue.h:
  Cleanup declarations.
sql/event_scheduler.cc:
  Make all the error messages uniform:
  [SEVERITY] Event Scheduler: [user][schema.event] message
  Using append_identifier for error logging was an overkill - we may 
  need it only if the system character set may have NUL (null character)
  as part of a valid identifier, this is currently never the case, 
  whereas additional quoting did not look nice in the log.
sql/event_scheduler.h:
  Cleanup the headers.
sql/events.cc:
  Use a different start up procedure of Event Scheduler:
  - at start up, try to check the system tables first.
  If they are not up-to-date, disable the scheduler.
  - try to load all the active events. In case of a load error, abort
  start up.
  - do not parse an event on start up. Parsing only gives some information
  about event validity, but far not all.
  Consolidate the business logic of Events DDL in this module.
  Now opt_event_scheduler may change after start up and thus is protected
  by LOCK_event_metadata mutex.
sql/events.h:
  Use all-static-data-members approach to implement Singleton pattern.
sql/mysqld.cc:
  New invocation scheme of Events. Move some logic to events.cc.
  Initialize the scheduler before reporting "Ready for connections".
sql/set_var.cc:
  Clean up sys_var_thd_sql_mode::symbolic_mode_representation
  to work with a LEX_STRING.
  Move more logic related to @@events_scheduler global variable to Events
  module.
sql/set_var.h:
  Update declarations.
sql/share/errmsg.txt:
  If someone tampered with mysql.event table after the server has
  started we no longer give him/her a complete report what was actually 
  broken. Do not send the user to look at the error log in such case,
  as there is nothing there (check_table_intact is not executed).
sql/sp_head.cc:
  Update to a new declaration of 
  sys_var_thd_sql_mode::symbolic_mode_representation
sql/sql_db.cc:
  New invocation scheme of Events module.
sql/sql_parse.cc:
  Move more logic to Events module. Make sure that we are consistent
  in the way access rights are checked for Events DDL: always
  after committing the current transaction and checking the system tables.
sql/sql_show.cc:
  Update to the new declarations of 
  sys_var_thd_sql_mode::symbolic_mode_representation
sql/sql_test.cc:
  New invocation scheme of events.
sql/table.cc:
  mysql.event is a system table.
  Update check_table_intact to be concurrent, more verbose, and less smart.
sql/table.h:
  Add a helper method.
mysql-test/r/events_trans.result:
  New BitKeeper file ``mysql-test/r/events_trans.result''
mysql-test/t/events_trans.test:
  New BitKeeper file ``mysql-test/t/events_trans.test'':
  test cases for Event Scheduler that require a transactional
  storage engine.
2007-04-05 15:24:34 +04:00
unknown
67da87d82e Merge jamppa@bk-internal.mysql.com:/home/bk/mysql-5.1
into  ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-5.1-marvel


mysql-test/t/sp.test:
  Auto merged
mysys/typelib.c:
  Auto merged
sql/event_data_objects.cc:
  Auto merged
sql/event_db_repository.cc:
  Auto merged
sql/event_queue.cc:
  Auto merged
sql/ha_ndbcluster.cc:
  Auto merged
sql/item_func.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/sp.cc:
  Auto merged
sql/sp_head.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_view.cc:
  Auto merged
sql/strfunc.cc:
  Auto merged
sql/table.cc:
  Auto merged
include/typelib.h:
  Merged from 5.1 main tree.
mysql-test/r/sp.result:
  Merged from 5.1 main tree.
2007-04-04 21:25:39 +03:00
unknown
fbd929f802 Merge jamppa@bk-internal.mysql.com:/home/bk/mysql-5.1-marvel
into  ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-5.1-marvel


mysys/my_pread.c:
  Auto merged
mysys/thr_alarm.c:
  Auto merged
sql/ha_ndbcluster.cc:
  Auto merged
sql/handler.cc:
  Auto merged
sql/log.cc:
  Auto merged
sql/log_event.cc:
  Auto merged
sql/opt_range.cc:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/slave.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_delete.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_load.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
storage/heap/hp_write.c:
  Auto merged
mysql-test/t/mysqlbinlog2.test:
  SCCS merged
client/mysql.cc:
  Auto merged
client/mysqlbinlog.cc:
  Auto merged
sql/event_db_repository.cc:
  Auto merged
sql/item.cc:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
2007-04-03 14:51:32 +03:00
unknown
e552b08fcd Merge bk-internal.mysql.com:/data0/bk/mysql-5.1
into  bk-internal.mysql.com:/data0/bk/mysql-5.1-marvel


client/mysql.cc:
  Auto merged
client/mysqlbinlog.cc:
  Auto merged
sql/event_data_objects.cc:
  Auto merged
sql/event_db_repository.cc:
  Auto merged
sql/event_queue.cc:
  Auto merged
sql/field.cc:
  Auto merged
sql/field.h:
  Auto merged
sql/item.cc:
  Auto merged
sql/item.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
strings/ctype-utf8.c:
  Auto merged
2007-04-03 13:51:31 +02:00
unknown
7b1bfbb77a Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  bodhi.local:/opt/local/work/mysql-5.1-runtime


mysql-test/r/events_bugs.result:
  Auto merged
mysql-test/r/ps.result:
  Auto merged
mysql-test/t/events.test:
  Auto merged
sql/event_data_objects.cc:
  Auto merged
sql/event_data_objects.h:
  Auto merged
sql/event_db_repository.h:
  Auto merged
sql/event_queue.cc:
  Auto merged
sql/events.cc:
  Auto merged
sql/ha_ndbcluster.cc:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/sql_servers.cc:
  Auto merged
sql/sql_view.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
sql/table.h:
  Auto merged
sql/share/errmsg.txt:
  Auto merged
mysql-test/r/events.result:
  Manual merge.
sql/event_db_repository.cc:
  Manual merge.
sql/sql_parse.cc:
  Manual merge.
2007-04-03 14:34:37 +04:00
unknown
e57c8007a4 Manual merge from 5.0 2007-03-29 21:11:17 +03:00
unknown
4a0f5887b7 Merge cbell@bk-internal.mysql.com:/home/bk/mysql-5.1-new-rpl
into  mysql_cab_desk.:C:/source/c++/mysql-5.1-new-rpl


mysql-test/t/events.test:
  Auto merged
sql/event_queue.cc:
  Auto merged
sql/events.cc:
  Auto merged
sql/lex.h:
  Auto merged
sql/slave.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
BitKeeper/deleted/.del-init_db.sql~a77d572c39d5a1f8:
  WL#3629 : Replication of Invocation and Invoked Features
  
  Manual merge prior to pushing patches.
BitKeeper/deleted/.del-mysql_create_system_tables.sh:
  WL#3629 : Replication of Invocation and Invoked Features
  
  Manual merge prior to pushing patches.
mysql-test/r/events.result:
  WL#3629 : Replication of Invocation and Invoked Features
  
  Manual merge prior to pushing patches.
mysql-test/r/events_grant.result:
  WL#3629 : Replication of Invocation and Invoked Features
  
  Manual merge prior to pushing patches.
mysql-test/r/events_restart_phase1.result:
  WL#3629 : Replication of Invocation and Invoked Features
  
  Manual merge prior to pushing patches.
mysql-test/r/system_mysql_db.result:
  WL#3629 : Replication of Invocation and Invoked Features
  
  Manual merge prior to pushing patches.
mysql-test/t/events_restart_phase1.test:
  WL#3629 : Replication of Invocation and Invoked Features
  
  Manual merge prior to pushing patches.
scripts/mysql_system_tables.sql:
  WL#3629 : Replication of Invocation and Invoked Features
  
  Manual merge prior to pushing patches.
scripts/mysql_system_tables_fix.sql:
  WL#3629 : Replication of Invocation and Invoked Features
  
  Manual merge prior to pushing patches.
sql/event_data_objects.cc:
  WL#3629 : Replication of Invocation and Invoked Features
  
  Manual merge prior to pushing patches.
sql/event_data_objects.h:
  WL#3629 : Replication of Invocation and Invoked Features
  
  Manual merge prior to pushing patches.
sql/event_db_repository.cc:
  WL#3629 : Replication of Invocation and Invoked Features
  
  Manual merge prior to pushing patches.
sql/event_db_repository.h:
  WL#3629 : Replication of Invocation and Invoked Features
  
  Manual merge prior to pushing patches.
sql/sql_udf.cc:
  WL#3629 : Replication of Invocation and Invoked Features
  
  Manual merge prior to pushing patches.
2007-03-29 09:54:59 -04:00
unknown
212ecf348c Removed not used define YY_MAGIC_BELOW
Made year 2000 handling more uniform
Removed year 2000 handling out from calc_days()
The above removes some bugs in date/datetimes with year between 0 and 200
Now we get a note when we insert a datetime value into a date column
For default values to CREATE, don't give errors for warning level NOTE
Fixed some compiler failures
Added library ws2_32 for windows compilation (needed if we want to compile with IOCP support)
Removed duplicate typedef TIME and replaced it with MYSQL_TIME

Better (more complete) fix for: Bug#21103 "DATE column not compared as DATE"
Fixed properly Bug#18997 "DATE_ADD and DATE_SUB perform year2K autoconversion magic on 4-digit year value"
Fixed Bug#23093 "Implicit conversion of 9912101 to date does not match cast(9912101 as date)"


include/my_time.h:
  Removed not used define YY_MAGIC_BELOW
  Added prototype for year_2000_handling()
mysql-test/r/date_formats.result:
  Updated results (fixed bug in date_format() with year < 99)
mysql-test/r/func_sapdb.result:
  Added more testing of make_date()
mysql-test/r/func_time.result:
  Fixed bug in date_sub() with years < 200
mysql-test/r/ps_2myisam.result:
  Now we get a note when we insert a datetime value into a date column
mysql-test/r/ps_3innodb.result:
  Now we get a note when we insert a datetime value into a date column
mysql-test/r/ps_4heap.result:
  Now we get a note when we insert a datetime value into a date column
mysql-test/r/ps_5merge.result:
  Now we get a note when we insert a datetime value into a date column
mysql-test/r/ps_7ndb.result:
  Now we get a note when we insert a datetime value into a date column
mysql-test/r/type_date.result:
  Added test for date conversions
mysql-test/r/type_datetime.result:
  Added testcase for datetime to date conversion.
mysql-test/t/date_formats.test:
  Added testing of dates < 200
mysql-test/t/func_sapdb.test:
  More testing of makedate()
mysql-test/t/type_date.test:
  Added test for date conversions
mysql-test/t/type_datetime.test:
  Added testcase for datetime to date conversion.
sql/CMakeLists.txt:
  Added library ws2_32 (needed if we want to compile with IOCP support)
sql/event_data_objects.cc:
  TIME -> MYSQL_TIME
sql/event_db_repository.cc:
  TIME -> MYSQL_TIME
sql/event_queue.cc:
  TIME -> MYSQL_TIME
sql/field.cc:
  Give note if we insert a datetime value in a date field
  Don't give notes if we are doing internal test conversions (like from convert_constant_item())
  More documentation (store functions can now return '3' to inform that the function did return a NOTE (not warning or error))
  Revert some changes in Field_newdate::store() to get more optimal code
  Field::set_warning() will now ignore notes if CHECK_FIELD_IGNORE is set.
  New parameters to make_truncated_value_warning()
sql/field.h:
  TIME -> MYSQL_TIME
sql/item.cc:
  New parameters to make_truncated_value_warning()
  Fixed get_date() to call number_to_datetime() if argument is not a string.
  Fixes Bug#23093 Implicit conversion of 9912101 to date does not match cast(9912101 as date)
sql/item.h:
  TIME -> MYSQL_TIME
sql/item_cmpfunc.cc:
  Don't print notes in convert_constant_item()
sql/item_func.h:
  TIME -> MYSQL_TIME
sql/item_timefunc.cc:
  New parameters to make_truncated_value_warning()
  Moved year 2000 handling out from calc_days()
  Don't return NULL for years < 200 in date_add/date_sub
sql/item_timefunc.h:
  TIME -> MYSQL_TIME
sql/my_decimal.cc:
  TIME -> MYSQL_TIME
sql/my_decimal.h:
  TIME -> MYSQL_TIME
sql/mysql_priv.h:
  Added error level to make_truncated_value_warning()
sql/protocol.cc:
  TIME -> MYSQL_TIME
sql/protocol.h:
  TIME -> MYSQL_TIME
sql/sp.cc:
  TIME -> MYSQL_TIME
sql/sql_base.cc:
  Make testing of result value of save_in_field() uniform
sql-common/my_time.c:
  Added year_2000_handling()
  Removed year 2000 handling from calc_daynr()
sql/sql_class.h:
  TIME -> MYSQL_TIME
sql/sql_show.cc:
  TIME -> MYSQL_TIME
sql/structs.h:
  TIME -> MYSQL_TIME
sql/time.cc:
  Added error level to make_truncated_value_warning()
sql/tztime.cc:
  TIME -> MYSQL_TIME
sql/tztime.h:
  TIME -> MYSQL_TIME
sql/unireg.cc:
  For default values to CREATE, don't give errors for warning level NOTE
  (Fixed failed CREATE when we give a datetime value to a date field)
strings/ctype-utf8.c:
  Fixed compiler failures
win/README:
  More comments
2007-03-23 22:08:31 +02:00
unknown
57dc12563f Trivial cleanups and whitespace change in Event Scheduler code.
A larger patch is to come, this is to exclude rudimentary changes
from it.


sql/event_data_objects.cc:
  Whitespace change.
sql/event_data_objects.h:
  Remove debug allocators - we have safemalloc.
sql/event_db_repository.cc:
  Whitespace change.
sql/event_db_repository.h:
  Whitespace change.
sql/event_queue.cc:
  Remove an unused structure. Whitespace change.
sql/event_queue.h:
  Whitespace.
sql/event_scheduler.cc:
  Whitespace change.
sql/event_scheduler.h:
  Add comments. Whitespace change.
sql/events.cc:
  Whitespace change.
sql/events.h:
  Trivial cleanups.
2007-03-23 18:14:03 +03:00
unknown
e9bb08ac0c Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  bodhi.local:/opt/local/work/mysql-5.1-runtime


include/my_global.h:
  Auto merged
mysql-test/mysql-test-run.pl:
  Auto merged
mysql-test/r/events_scheduling.result:
  Auto merged
BitKeeper/deleted/.del-init_db.sql~a77d572c39d5a1f8:
  Auto merged
BitKeeper/deleted/.del-mysql_create_system_tables.sh:
  Auto merged
mysql-test/r/query_cache.result:
  Auto merged
mysql-test/r/view.result:
  Auto merged
mysql-test/t/events_scheduling.test:
  Auto merged
mysql-test/t/grant_cache.test:
  Auto merged
mysql-test/t/query_cache.test:
  Auto merged
mysql-test/t/view.test:
  Auto merged
scripts/mysql_system_tables_fix.sql:
  Auto merged
sql/event_db_repository.cc:
  Auto merged
sql/event_queue.cc:
  Auto merged
sql/field.cc:
  Auto merged
sql/handler.cc:
  Auto merged
sql/handler.h:
  Auto merged
sql/item.cc:
  Auto merged
sql/item.h:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_subselect.cc:
  Auto merged
sql/log_event.cc:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/sp.cc:
  Auto merged
sql/sp_head.cc:
  Auto merged
sql/sp_head.h:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_help.cc:
  Auto merged
sql/sql_lex.cc:
  Auto merged
sql/sql_lex.h:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
sql/table.cc:
  Auto merged
sql/share/errmsg.txt:
  Auto merged
sql/tztime.cc:
  Auto merged
storage/innobase/handler/ha_innodb.cc:
  Auto merged
storage/myisam/ha_myisam.cc:
  Auto merged
storage/myisam/ha_myisam.h:
  Auto merged
mysql-test/r/skip_grants.result:
  Manualmerge.
mysql-test/r/sp.result:
  Manualmerge.
mysql-test/t/skip_grants.test:
  Manualmerge.
mysql-test/t/sp.test:
  Manualmerge.
sql/event_data_objects.cc:
  Manualmerge.
2007-03-20 00:42:11 +03:00
unknown
7d383909db wl#3700 - post-review fixes:
s/ulonglong/key_part_map/, comments


include/heap.h:
  wl#3700 - post-review fixes:
  s/ulonglong/key_part_map/
include/my_base.h:
  wl#3700 - post-review fixes:
  s/ulonglong/key_part_map/
include/myisam.h:
  wl#3700 - post-review fixes:
  s/ulonglong/key_part_map/
include/myisammrg.h:
  wl#3700 - post-review fixes:
  s/ulonglong/key_part_map/
sql/event_db_repository.cc:
  wl#3700 - post-review fixes:
  s/ulonglong/key_part_map/
sql/ha_partition.cc:
  wl#3700 - post-review fixes:
  s/ulonglong/key_part_map/
sql/ha_partition.h:
  wl#3700 - post-review fixes:
  s/ulonglong/key_part_map/
sql/sql_select.h:
  wl#3700 - post-review fixes:
  remove tab_to_keypart_map()
2007-03-17 00:13:25 +01:00
unknown
086fba7627 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.


client/mysqldump.c:
  Before every CREATE EVENT, output its time zone.
mysql-test/include/wait_condition.inc:
  Add optional $wait_timeout parameter.
mysql-test/lib/init_db.sql:
  Add time_zone column.
mysql-test/r/events.result:
  Update result.
mysql-test/r/events_bugs.result:
  Update result.
mysql-test/r/events_grant.result:
  Update result.
mysql-test/r/events_restart_phase1.result:
  Update result.
mysql-test/r/events_scheduling.result:
  Update result.
mysql-test/r/mysqldump.result:
  Update result.
mysql-test/r/ps.result:
  Update result.
mysql-test/r/system_mysql_db.result:
  Update result.
mysql-test/t/events.test:
  Remove STARTS from the result, as it depends on current time.
mysql-test/t/events_bugs.test:
  Time in the past is no longer an error.
mysql-test/t/events_restart_phase1.test:
  Fill new column 'time_zone' in mysql.event.
mysql-test/t/events_scheduling.test:
  Cleanup: disable event scheduler.
scripts/mysql_create_system_tables.sh:
  Add new column 'time_zone' to mysql.event.
scripts/mysql_fix_privilege_tables.sql:
  Add new column 'time_zone' to mysql.event.
sql/event_data_objects.cc:
  The essence of the change is the following:
   - for internal times use my_time_t instead of TIME.  Assignment and
     comparison is done now on plain numbers.
   - in init_execute_at(), init_starts(), init_ends() convert given time
     to number of seconds since Epoch (aka Unix time, in UTC).
   - handle time_zone field loading and storing.
   - in get_next_time(), Unix time is converted back to event time zone,
     interval is added, and the result is converted to UTC again.
   - fix Event_timed::get_create_event() to report STARTS and ENDS.
   - before executing the event body we set thread time zone to the
     event time zone.
sql/event_data_objects.h:
  Add time_zone member to Event_basic class.
  
  Store internal times in my_time_t (number of seconds since Epoch),
  rather than in broken down TIME structure.
sql/event_db_repository.cc:
  Add time_zone column handling.
  
  Give a warning and do not create an event if its execution time is in
  the past, and ON COMPLETION NOT PRESERVE is set, because such an event
  should be dropped by that time.  Also, do not allow ALTER EVENT to
  set execution time in the past when ON COMPLETION NOT PRESERVE is set.
sql/event_db_repository.h:
  Add enum member for new time zone column.
sql/event_queue.cc:
  Replace handling of broken down times with simple handling of
  my_time_t.
sql/event_queue.h:
  Store internal times in my_time_t (number of seconds since Epoch),
  rather than in broken down TIME structure.
sql/event_scheduler.cc:
  Add TODO comment.
sql/events.cc:
  Send time_zone column for SHOW CREATE EVENT.
sql/share/errmsg.txt:
  Update error message, and add two more errors.
sql/sql_show.cc:
  Add TIME_ZONE column to the output of SHOW EVENTS.
mysql-test/r/events_time_zone.result:
  BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/r/events_time_zone.result
mysql-test/t/events_time_zone.test:
  BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/t/events_time_zone.test
2007-03-16 17:31:07 +03:00
unknown
62b41b5fbc WL#3629 - Replication of Invocation and Invoked Features
This changeset adds replication of events and user-defined functions. 
There are several bug reports involved in this change:

BUG#16421, BUG#17857, BUG#20384:
This patch modifies the mysql.events table to permit the addition of
another enum value for the status column. The column now has values
of ('DISABLED','SLAVESIDE_DISABLED','ENABLED'). A status of
SLAVESIDE_DISABLED is set on the slave during replication of events.
This enables users to determine which events werereplicated from the 
master and to later enable them if they promote the slave to a master.
The CREATE, ALTER, and DROP statements are binlogged.
A new test was added for replication of events (rpl_events).

BUG#17671:
This patch modifies the code to permit logging of user-defined functions.
Note: this is the CREATE FUNCTION ... SONAME variety. A more friendly error 
message to be displayed should a replicated user-defined function not be
found in the loadable library or if the library is missing from the
slave.The CREATE andDROP statements are binlogged. A new test was added 
for replication of user-defined functions (rpl_udf). 

The patch also adds a new column to the mysql.event table named
'originator' that is used to store the server_id of the server that
the event originated on. This enables users to promote a slave to a 
master and later return the promoted slave to a slave and disable the
replicated events.


mysql-test/lib/init_db.sql:
  WL#3629 - Replication of Invocation and Invoked Feature
  This patch adds the SLAVESIDE_DISABLED to the list of enumerated 
  values for the mysql.event table.
  
  This patch adds the column 'originator' to the mysql.event table.
mysql-test/r/events.result:
  WL#3629 - Replication of Invocation and Invoked Feature
  This patch adds the 'originator' column to the events test results.
  This was necessary to ensure the manual insert into mysql.event table 
  succeeds because the originator column is set to NOT NULL.
mysql-test/r/events_grant.result:
  WL#3629 - Replication of Invocation and Invoked Feature
  This patch adds the 'originator' column to the events_grant test results.
  This was necessary to ensure the manual insert into mysql.event table 
  succeeds because the originator column is set to NOT NULL.
mysql-test/r/events_restart_phase1.result:
  WL#3629 - Replication of Invocation and Invoked Feature
  This patch adds the 'originator' column to the events_restart_phase1
  test results. This was necessary to ensure the manual insert into 
  mysql.event table succeeds because the originator column is set to 
  NOT NULL.
mysql-test/r/system_mysql_db.result:
  WL#3629 - Replication of Invocation and Invoked Feature
  This patch adds the SLAVESIDE_DISABLED to the list of enumerated 
  values for the mysql.event table.
  
  This patch adds the column 'originator' to the mysql.event table.
  
  These changes to the result file were necessary to ensure correct test
  results.
mysql-test/t/events.test:
  WL#3629 - Replication of Invocation and Invoked Feature
  This patch adds the 'originator' column to the events
  test. This was necessary to ensure the manual insert into 
  mysql.event table succeeds because the originator column is set to 
  NOT NULL.
mysql-test/t/events_restart_phase1.test:
  WL#3629 - Replication of Invocation and Invoked Feature
  This patch adds the 'originator' column to the events_restart_phase1
  test. This was necessary to ensure the manual insert into 
  mysql.event table succeeds because the originator column is set to 
  NOT NULL.
scripts/mysql_create_system_tables.sh:
  WL#3629 - Replication of Invocation and Invoked Feature
  This patch adds the SLAVESIDE_DISABLED to the list of enumerated 
  values for the mysql.event table.
  
  This patch adds the column 'originator' to the mysql.event table.
scripts/mysql_fix_privilege_tables.sql:
  WL#3629 - Replication of Invocation and Invoked Feature
  This patch adds the SLAVESIDE_DISABLED to the list of enumerated 
  values for the mysql.event table.
  
  This patch adds the column 'originator' to the mysql.event table.
sql/event_data_objects.cc:
  WL#3629 - Replication of Invocation and Invoked Features
  This patch modifies the code to permit processing of the new enum
  SLAVESIDE_DISABLED which is set on the slave during replication
  of events. 
  
  This patch uses the new Event_basic:: enumerated values.
sql/event_data_objects.h:
  WL#3629 - Replication of Invocation and Invoked Features
  This patch moves the duplicated enumeration values for ENABLED, 
  SLAVESIDE_DISABLED, and DISABLED to the Event_basic class removing
  them from the other Event_* classes.
sql/event_db_repository.cc:
  WL#3629 - Replication of Invocation and Invoked Features
  This patch modifies the code to permit processing of the new enum
  SLAVESIDE_DISABLED which is set on the slave during replication
  of events. 
  
  The patch also adds a new column to the mysql.event table named
  'originator' that is used to store the server_id of the server that
  the event originated on. This enables users to promote a slave to a 
  master and later return the promoted slave to a slave and disable the
  replicated events.
sql/event_db_repository.h:
  WL#3629 - Replication of Invocation and Invoked Features
  This patch modifies the code to add a new field named 'originator' 
  to the enum_event_table_field and associated structure.
sql/event_queue.cc:
  WL#3629 - Replication of Invocation and Invoked Features
  This patch modifies the code to permit processing of the new enum
  SLAVESIDE_DISABLED which is set on the slave during replication
  of events.
sql/events.cc:
  WL#3629 - Replication of Invocation and Invoked Features
  This patch modifies the code to permit processing of the new enum
  SLAVESIDE_DISABLED which is set on the slave during replication
  of events.
sql/lex.h:
  WL#3629 - Replication of Invocation and Invoked Features
  This patch modifies the code to add the new SLAVESIDE_DISABLE symbol
  to the lexical parser.
sql/slave.cc:
  WL#3629 - Replication of Invocation and Invoked Features
  This patch modifies the code to permit the capture of the error on
  the slave when a UDF from a loadable library is not loaded on the server
  when replicated from the master.
sql/sql_parse.cc:
  WL#3629 - Replication of Invocation and Invoked Features
  This patch removes the comment because drop functions commands 
  are replicated.
sql/sql_show.cc:
  WL#3629 - Replication of Invocation and Invoked Features
  This patch modifies the code to permit processing of the new enum
  SLAVESIDE_DISABLED which is set on the slave during replication
  of events. The code also adds changes the display width of the status
  column for the schema table for the show events command and also adds
  the new column 'originator' to the events_field_info structure.
sql/sql_udf.cc:
  WL#3629 - Replication of Invocation and Invoked Features
  This patch modifies the code to add the binlogging of the create and
  drop function events.
sql/sql_yacc.yy:
  WL#3629 - Replication of Invocation and Invoked Features
  This patch modifies the code to change the enumeration of the status
  column for the events in the parser. The code uses the Event_basic::
  enumerations allowing the enums to be defined in one place.
mysql-test/t/rpl_events.test:
  WL#3629 - Replication of Invocation and Invoked Features
  This patch adds a new test for testing replication of events. The test
  uses include files so that the test can test under both RBR and SBR.
mysql-test/r/rpl_events.result:
  WL#3629 - Replication of Invocation and Invoked Features
  This patch adds a new result file for testing replication of events.
mysql-test/r/rpl_udf.result:
  WL#3629 - Replication of Invocation and Invoked Features
  This patch adds a new result file for testing replication of UDFs.
mysql-test/t/rpl_udf.test:
  WL#3629 - Replication of Invocation and Invoked Features
  This patch adds a new test for testing replication of UDFs. The test
  uses include files so that the test can test under both RBR and SBR.
mysql-test/include/rpl_events.inc:
  WL#3629 - Replication of Invocation and Invoked Features
  This patch adds a new include file for testing replication of events.
  This file contains the core test procedures.
mysql-test/include/rpl_udf.inc:
  WL#3629 - Replication of Invocation and Invoked Features
  This patch adds a new include file for testing replication of UDFs.
  This file contains the core test procedures.
2007-03-16 09:56:57 -04:00
unknown
4e8b49d656 WL#3700: Handler API change: all index search methods - that is,
index_read(), index_read_idx(), index_read_last(), and
records_in_range() - instead of 'uint keylen' argument take
'ulonglong keypart_map', a bitmap showing which keyparts are
present in the key value.
Fallback method is provided for handlers that are lagging behind.
2007-01-29 10:40:26 +01:00
unknown
f40e0cc0d0 After merge fixes
Removed a lot of compiler warnings
Removed not used variables, functions and labels
Initialize some variables that could be used unitialized (fatal bugs)
%ll -> %l


BitKeeper/etc/ignore:
  added storage/archive/archive_reader
BUILD/SETUP.sh:
  ccache now works again
BUILD/compile-pentium-gcov:
  Added marker that we are using gcov and need special version of ccache
client/mysql_upgrade.c:
  after merge fixes
client/mysqlbinlog.cc:
  after merge fixes
client/mysqldump.c:
  Removed compiler warnings
client/mysqlimport.c:
  Removed compiler warnings
client/mysqltest.c:
  Removed compiler warnings
mysql-test/t/mysqlcheck.test:
  After merge fixes
mysys/my_bitmap.c:
  After merge fix
sql/event_data_objects.cc:
  Removed not used variable
sql/event_db_repository.cc:
  Removed not used variable
sql/event_queue.cc:
  Removed not used variable
sql/field.cc:
  After merge fixes
sql/filesort.cc:
  Added missing initialization (could cause core dump on EOM)
sql/ha_ndbcluster.cc:
  After merge fixes
  Removed not used variables
  false-> FALSE
  true -> TRUE
  %llu -> %lu (portability fix)
  Fixed bug where field could be used unitialized in build_scan_filter_predicate()
sql/ha_ndbcluster_binlog.cc:
  Removed not used label
sql/ha_partition.cc:
  Removed not used variables
sql/handler.cc:
  Removed not used variable & function
sql/item.cc:
  After merge fixes
sql/item_cmpfunc.cc:
  Removed not used variable
sql/item_func.cc:
  Removed compiler warning
sql/item_xmlfunc.cc:
  Removed not used variables & declarations
sql/log.cc:
  Removed compiler warnings
  Removed not used variables & label
sql/log.h:
  After merge fixes
sql/log_event.cc:
  Removed not used variable & function
sql/mysqld.cc:
  After merge fixes
sql/opt_range.cc:
  Removed not used declaration
sql/partition_info.cc:
  Removed not used variable
sql/protocol.cc:
  Removed compiler warnings
sql/set_var.cc:
  Removed not used variable
sql/set_var.h:
  After merge fix
sql/slave.cc:
  After merge fixes
sql/slave.h:
  Moved wrong declaration to slave.cc
sql/sp.cc:
  Fixed format of DBUG_PRINT
sql/sp_head.cc:
  After merge fixes
sql/spatial.cc:
  Added DBUG_ASSERT() to verify that LINT_INIT is right
sql/sql_class.cc:
  Removed not used variables
sql/sql_insert.cc:
  After merge fixes
sql/sql_parse.cc:
  Removed not used variable
  After merge fixes
sql/sql_partition.cc:
  Removed not used variables
sql/sql_plugin.cc:
  Removed compiler warnings when compiling embedded server
sql/sql_servers.cc:
  Removed not used variables
  Moved wrong placed calle to use_all_columns()
sql/sql_servers.h:
  Moved declaration to right sql_servers.cc
sql/sql_show.cc:
  Removed not used variables and function
  After merge fixes
sql/sql_table.cc:
  Removed not used variable
sql/sql_yacc.yy:
  Removed not used variables
  Lex -> lex
sql/table.cc:
  Indentation fix
storage/archive/ha_archive.cc:
  After merge fixes
storage/example/ha_example.cc:
  Indentation fixes
storage/federated/ha_federated.cc:
  Removed not used variables
storage/myisam/mi_rkey.c:
  Added 0x before address
storage/myisammrg/ha_myisammrg.cc:
  Removed old declaration
storage/ndb/include/kernel/signaldata/ArbitSignalData.hpp:
  After merge fixes
storage/ndb/include/util/SimpleProperties.hpp:
  After merge fixes
storage/ndb/src/common/debugger/EventLogger.cpp:
  Removed not used function
storage/ndb/src/kernel/blocks/suma/Suma.cpp:
  Removed compiler warnings
  Removed not used variables
storage/ndb/src/mgmsrv/MgmtSrvr.cpp:
  After merge fixes
  Removed not used variables
storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp:
  Removed not used varibles.
storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp:
  Removed not used variables
storage/ndb/src/ndbapi/NdbOperationDefine.cpp:
  Removed not used variables and label
storage/ndb/src/ndbapi/NdbOperationSearch.cpp:
  Removed not used label
storage/ndb/src/ndbapi/SignalSender.cpp:
  Removed not used function
storage/ndb/src/ndbapi/TransporterFacade.cpp:
  Removed not used variables
storage/ndb/src/ndbapi/ndb_cluster_connection.cpp:
  Moved static declaration from header file
storage/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp:
  Moved static declaration from header file
support-files/compiler_warnings.supp:
  Remove some warnings from ndb
2007-01-29 01:47:35 +02:00
unknown
92e68d49d7 Many files:
Changed header to GPL version 2 only


client/mysqlslap.c:
  Changed header to GPL version 2 only
include/atomic/nolock.h:
  Changed header to GPL version 2 only
include/atomic/rwlock.h:
  Changed header to GPL version 2 only
include/atomic/x86-gcc.h:
  Changed header to GPL version 2 only
include/atomic/x86-msvc.h:
  Changed header to GPL version 2 only
include/my_atomic.h:
  Changed header to GPL version 2 only
include/my_trie.h:
  Changed header to GPL version 2 only
include/my_vle.h:
  Changed header to GPL version 2 only
include/mysql/plugin.h:
  Changed header to GPL version 2 only
mysys/my_atomic.c:
  Changed header to GPL version 2 only
mysys/my_getncpus.c:
  Changed header to GPL version 2 only
mysys/my_memmem.c:
  Changed header to GPL version 2 only
mysys/my_vle.c:
  Changed header to GPL version 2 only
mysys/trie.c:
  Changed header to GPL version 2 only
plugin/Makefile.am:
  Changed header to GPL version 2 only
server-tools/instance-manager/IMService.h:
  Changed header to GPL version 2 only
server-tools/instance-manager/WindowsService.h:
  Changed header to GPL version 2 only
server-tools/instance-manager/exit_codes.h:
  Changed header to GPL version 2 only
server-tools/instance-manager/user_management_commands.h:
  Changed header to GPL version 2 only
sql/authors.h:
  Changed header to GPL version 2 only
sql/contributors.h:
  Changed header to GPL version 2 only
sql/event_data_objects.cc:
  Changed header to GPL version 2 only
sql/event_data_objects.h:
  Changed header to GPL version 2 only
sql/event_db_repository.cc:
  Changed header to GPL version 2 only
sql/event_db_repository.h:
  Changed header to GPL version 2 only
sql/event_queue.cc:
  Changed header to GPL version 2 only
sql/event_queue.h:
  Changed header to GPL version 2 only
sql/event_scheduler.cc:
  Changed header to GPL version 2 only
sql/event_scheduler.h:
  Changed header to GPL version 2 only
sql/events.cc:
  Changed header to GPL version 2 only
sql/events.h:
  Changed header to GPL version 2 only
sql/ha_ndbcluster_binlog.cc:
  Changed header to GPL version 2 only
sql/ha_ndbcluster_binlog.h:
  Changed header to GPL version 2 only
sql/ha_ndbcluster_tables.h:
  Changed header to GPL version 2 only
sql/ha_partition.cc:
  Changed header to GPL version 2 only
sql/ha_partition.h:
  Changed header to GPL version 2 only
sql/item_xmlfunc.cc:
  Changed header to GPL version 2 only
sql/item_xmlfunc.h:
  Changed header to GPL version 2 only
sql/log.h:
  Changed header to GPL version 2 only
sql/partition_element.h:
  Changed header to GPL version 2 only
sql/partition_info.cc:
  Changed header to GPL version 2 only
sql/partition_info.h:
  Changed header to GPL version 2 only
sql/rpl_filter.cc:
  Changed header to GPL version 2 only
sql/rpl_filter.h:
  Changed header to GPL version 2 only
sql/rpl_injector.cc:
  Changed header to GPL version 2 only
sql/rpl_injector.h:
  Changed header to GPL version 2 only
sql/rpl_mi.cc:
  Changed header to GPL version 2 only
sql/rpl_mi.h:
  Changed header to GPL version 2 only
sql/rpl_rli.cc:
  Changed header to GPL version 2 only
sql/rpl_rli.h:
  Changed header to GPL version 2 only
sql/rpl_tblmap.cc:
  Changed header to GPL version 2 only
sql/rpl_tblmap.h:
  Changed header to GPL version 2 only
sql/rpl_utility.cc:
  Changed header to GPL version 2 only
sql/rpl_utility.h:
  Changed header to GPL version 2 only
sql/sql_binlog.cc:
  Changed header to GPL version 2 only
sql/sql_partition.cc:
  Changed header to GPL version 2 only
sql/sql_partition.h:
  Changed header to GPL version 2 only
sql/sql_plugin.cc:
  Changed header to GPL version 2 only
sql/sql_plugin.h:
  Changed header to GPL version 2 only
sql/sql_servers.cc:
  Changed header to GPL version 2 only
sql/sql_servers.h:
  Changed header to GPL version 2 only
sql/sql_tablespace.cc:
  Changed header to GPL version 2 only
sql/sql_yacc.yy.bak:
  Changed header to GPL version 2 only
storage/Makefile.am:
  Changed header to GPL version 2 only
storage/archive/Makefile.am:
  Changed header to GPL version 2 only
storage/blackhole/Makefile.am:
  Changed header to GPL version 2 only
storage/csv/Makefile.am:
  Changed header to GPL version 2 only
storage/example/Makefile.am:
  Changed header to GPL version 2 only
storage/federated/Makefile.am:
  Changed header to GPL version 2 only
storage/innobase/handler/Makefile.am:
  Changed header to GPL version 2 only
storage/ndb/include/kernel/signaldata/AllocNodeId.hpp:
  Changed header to GPL version 2 only
storage/ndb/include/kernel/signaldata/CreateFilegroup.hpp:
  Changed header to GPL version 2 only
storage/ndb/include/kernel/signaldata/CreateFilegroupImpl.hpp:
  Changed header to GPL version 2 only
storage/ndb/include/kernel/signaldata/CreateObj.hpp:
  Changed header to GPL version 2 only
storage/ndb/include/kernel/signaldata/DictObjOp.hpp:
  Changed header to GPL version 2 only
storage/ndb/include/kernel/signaldata/DihFragCount.hpp:
  Changed header to GPL version 2 only
storage/ndb/include/kernel/signaldata/DropFilegroup.hpp:
  Changed header to GPL version 2 only
storage/ndb/include/kernel/signaldata/DropFilegroupImpl.hpp:
  Changed header to GPL version 2 only
storage/ndb/include/kernel/signaldata/DropObj.hpp:
  Changed header to GPL version 2 only
storage/ndb/include/kernel/signaldata/Extent.hpp:
  Changed header to GPL version 2 only
storage/ndb/include/kernel/signaldata/LgmanContinueB.hpp:
  Changed header to GPL version 2 only
storage/ndb/include/kernel/signaldata/PgmanContinueB.hpp:
  Changed header to GPL version 2 only
storage/ndb/include/kernel/signaldata/RestoreContinueB.hpp:
  Changed header to GPL version 2 only
storage/ndb/include/kernel/signaldata/RestoreImpl.hpp:
  Changed header to GPL version 2 only
storage/ndb/include/kernel/signaldata/RouteOrd.hpp:
  Changed header to GPL version 2 only
storage/ndb/include/kernel/signaldata/TsmanContinueB.hpp:
  Changed header to GPL version 2 only
storage/ndb/include/ndbapi/NdbIndexStat.hpp:
  Changed header to GPL version 2 only
storage/ndb/ndbapi-examples/mgmapi_logevent/mgmapi_logevent.cpp:
  Changed header to GPL version 2 only
storage/ndb/ndbapi-examples/mgmapi_logevent_dual/mgmapi_logevent_dual.cpp:
  Changed header to GPL version 2 only
storage/ndb/ndbapi-examples/ndbapi_async/ndbapi_async.cpp:
  Changed header to GPL version 2 only
storage/ndb/ndbapi-examples/ndbapi_async1/ndbapi_async1.cpp:
  Changed header to GPL version 2 only
storage/ndb/ndbapi-examples/ndbapi_event/ndbapi_event.cpp:
  Changed header to GPL version 2 only
storage/ndb/ndbapi-examples/ndbapi_retries/ndbapi_retries.cpp:
  Changed header to GPL version 2 only
storage/ndb/ndbapi-examples/ndbapi_scan/ndbapi_scan.cpp:
  Changed header to GPL version 2 only
storage/ndb/ndbapi-examples/ndbapi_simple/ndbapi_simple.cpp:
  Changed header to GPL version 2 only
storage/ndb/ndbapi-examples/ndbapi_simple_dual/ndbapi_simple_dual.cpp:
  Changed header to GPL version 2 only
storage/ndb/ndbapi-examples/ndbapi_simple_index/ndbapi_simple_index.cpp:
  Changed header to GPL version 2 only
storage/ndb/src/kernel/blocks/dbdih/printSysfile.cpp:
  Changed header to GPL version 2 only
storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp:
  Changed header to GPL version 2 only
storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp:
  Changed header to GPL version 2 only
storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.cpp:
  Changed header to GPL version 2 only
storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.hpp:
  Changed header to GPL version 2 only
storage/ndb/src/kernel/blocks/dbtup/tuppage.cpp:
  Changed header to GPL version 2 only
storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp:
  Changed header to GPL version 2 only
storage/ndb/src/kernel/blocks/dbtux/DbtuxStat.cpp:
  Changed header to GPL version 2 only
storage/ndb/src/kernel/blocks/diskpage.hpp:
  Changed header to GPL version 2 only
storage/ndb/src/kernel/blocks/lgman.cpp:
  Changed header to GPL version 2 only
storage/ndb/src/kernel/blocks/lgman.hpp:
  Changed header to GPL version 2 only
storage/ndb/src/kernel/blocks/pgman.cpp:
  Changed header to GPL version 2 only
storage/ndb/src/kernel/blocks/pgman.hpp:
  Changed header to GPL version 2 only
storage/ndb/src/kernel/blocks/print_file.cpp:
  Changed header to GPL version 2 only
storage/ndb/src/kernel/blocks/record_types.hpp:
  Changed header to GPL version 2 only
storage/ndb/src/kernel/blocks/restore.cpp:
  Changed header to GPL version 2 only
storage/ndb/src/kernel/blocks/restore.hpp:
  Changed header to GPL version 2 only
storage/ndb/src/kernel/blocks/tsman.cpp:
  Changed header to GPL version 2 only
storage/ndb/src/kernel/blocks/tsman.hpp:
  Changed header to GPL version 2 only
storage/ndb/src/kernel/vm/DLCFifoList.hpp:
  Changed header to GPL version 2 only
storage/ndb/src/kernel/vm/DLCHashTable.hpp:
  Changed header to GPL version 2 only
storage/ndb/src/kernel/vm/DynArr256.cpp:
  Changed header to GPL version 2 only
storage/ndb/src/kernel/vm/DynArr256.hpp:
  Changed header to GPL version 2 only
storage/ndb/src/kernel/vm/KeyTable2Ref.hpp:
  Changed header to GPL version 2 only
storage/ndb/src/kernel/vm/LinearPool.hpp:
  Changed header to GPL version 2 only
storage/ndb/src/kernel/vm/NdbdSuperPool.cpp:
  Changed header to GPL version 2 only
storage/ndb/src/kernel/vm/NdbdSuperPool.hpp:
  Changed header to GPL version 2 only
storage/ndb/src/kernel/vm/Pool.cpp:
  Changed header to GPL version 2 only
storage/ndb/src/kernel/vm/Pool.hpp:
  Changed header to GPL version 2 only
storage/ndb/src/kernel/vm/RWPool.cpp:
  Changed header to GPL version 2 only
storage/ndb/src/kernel/vm/RWPool.hpp:
  Changed header to GPL version 2 only
storage/ndb/src/kernel/vm/Rope.hpp:
  Changed header to GPL version 2 only
storage/ndb/src/kernel/vm/SLFifoList.hpp:
  Changed header to GPL version 2 only
storage/ndb/src/kernel/vm/WOPool.cpp:
  Changed header to GPL version 2 only
storage/ndb/src/kernel/vm/WOPool.hpp:
  Changed header to GPL version 2 only
storage/ndb/src/kernel/vm/bench_pool.cpp:
  Changed header to GPL version 2 only
storage/ndb/src/kernel/vm/ndbd_malloc_impl.cpp:
  Changed header to GPL version 2 only
storage/ndb/src/kernel/vm/ndbd_malloc_impl.hpp:
  Changed header to GPL version 2 only
storage/ndb/src/mgmsrv/ParamInfo.cpp:
  Changed header to GPL version 2 only
storage/ndb/src/ndbapi/NdbIndexStat.cpp:
  Changed header to GPL version 2 only
storage/ndb/test/ndbapi/testIndexStat.cpp:
  Changed header to GPL version 2 only
storage/ndb/test/tools/listen.cpp:
  Changed header to GPL version 2 only
storage/ndb/tools/restore/ndb_nodegroup_map.h:
  Changed header to GPL version 2 only
strings/my_strchr.c:
  Changed header to GPL version 2 only
unittest/mysys/base64-t.c:
  Changed header to GPL version 2 only
unittest/mysys/bitmap-t.c:
  Changed header to GPL version 2 only
unittest/mysys/my_atomic-t.c:
  Changed header to GPL version 2 only
unittest/mytap/tap.c:
  Changed header to GPL version 2 only
unittest/mytap/tap.h:
  Changed header to GPL version 2 only
win/Makefile.am:
  Changed header to GPL version 2 only
2006-12-27 02:23:51 +01:00
unknown
788ad30f08 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.


client/mysqldump.c:
  Fixed some compiler warnings
  Added some missing DBUG_RETURN
  Remove copying of 'cluster' database
client/mysqlslap.c:
  Fixed compiler warnings
client/mysqltest.c:
  After merge fix
extra/yassl/taocrypt/include/algebra.hpp:
  Removed compiler warning
mysql-test/include/im_check_env.inc:
  Fixed race condition (mysqld1 could report 'starting' or 'online'
mysql-test/mysql-test-run.pl:
  After merge fixes
  Added missing directory to LD_LIBRARY_PATH
mysql-test/r/ctype_cp1250_ch.result:
  After merge fix
mysql-test/r/im_cmd_line.result:
  Fixed race condition
mysql-test/r/im_daemon_life_cycle.result:
  Fixed race condition
mysql-test/r/im_instance_conf.result:
  Fixed race condition
mysql-test/r/im_life_cycle.result:
  Fixed race condition
mysql-test/r/im_utils.result:
  Fixed race condition
mysql-test/r/log_tables.result:
  Fixed wrong result
mysql-test/t/disabled.def:
  Disabled ndb_restore_partion, as ndb_restore_compate caused it to fail, becasue of table 'cluster/def/schema' which is stored in ndb_backup50
mysys/my_compress.c:
  Removed compiler warnings
mysys/my_getopt.c:
  Ensure we always have at least one space between option name and value
plugin/fulltext/plugin_example.c:
  Removed compiler warnings
server-tools/instance-manager/mysql_connection.cc:
  After merge fix
sql/event_data_objects.cc:
  Fixed compiler warnings
  Fixed platform compatibility issues (%lld is not portable)
sql/event_data_objects.h:
  Fixed compiler warnings
sql/event_db_repository.cc:
  Fixed compiler warnings
sql/event_queue.cc:
  Fixed compiler warnings
sql/event_scheduler.cc:
  Fixed compiler warnings
sql/events.cc:
  Fixed compiler warnings
sql/field.cc:
  Fixed compiler warnings
sql/ha_ndbcluster.cc:
  Fixed compiler warnings
sql/ha_ndbcluster_binlog.cc:
  Fixed compiler warnings
sql/ha_partition.cc:
  Fixed compiler warnings
sql/handler.cc:
  Fixed compiler warnings
sql/item_cmpfunc.cc:
  Fixed DBUG_PRINT style
sql/item_func.cc:
  Fixed compiler warnings
sql/log.cc:
  Fixed compiler warnings
sql/log_event.cc:
  Fixed compiler warnings
sql/mysqld.cc:
  Fixed compiler warnings
sql/opt_range.cc:
  Fixed compiler warnings
sql/repl_failsafe.cc:
  Indentation fixes
sql/rpl_rli.cc:
  Fixed compiler warnings
sql/rpl_tblmap.cc:
  Fixed compiler warnings
sql/set_var.cc:
  Fixed compiler warnings
sql/slave.cc:
  Fixed compiler warnings
sql/sp_head.cc:
  Fixed compiler warnings
sql/sql_base.cc:
  Fixed compiler warnings
  Fixed indentation
sql/sql_binlog.cc:
  Fixed compiler warnings
sql/sql_cache.cc:
  Fixed compiler warnings
sql/sql_class.cc:
  Fixed compiler warnings
sql/sql_handler.cc:
  Fixed compiler warnings
sql/sql_lex.cc:
  Fixed compiler warnings
sql/sql_parse.cc:
  Fixed compiler warnings
sql/sql_partition.cc:
  Fixed compiler warnings
sql/sql_prepare.cc:
  Fixed compiler warnings
sql/sql_table.cc:
  Fixed compiler warnings
sql/sql_test.cc:
  Fixed DBUG_PRINT style
sql/sql_trigger.cc:
  Fixed DBUG_PRINT style
sql/table.cc:
  Fixed compiler warnings
storage/federated/ha_federated.cc:
  Fixed compiler warnings
storage/myisam/mi_rsamepos.c:
  Fixed compiler warnings
storage/ndb/include/ndb_global.h.in:
  After merge fix
storage/ndb/include/util/NdbOut.hpp:
  Inform gcc that ndbout_c takes a printf() string as argument
storage/ndb/include/util/SimpleProperties.hpp:
  After merge fixes
storage/ndb/src/kernel/blocks/backup/Backup.cpp:
  Fixed compiler warnings
storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp:
  Fixed compiler warnings
storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp:
  Fixed compiler warnings
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
  Fixed compiler warnings
storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp:
  Fixed compiler warnings
  Fixed usage of uninitialized value (Got help from Jonas with patch)
storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp:
  Fixed compiler warnings
storage/ndb/src/kernel/blocks/lgman.cpp:
  Fixed compiler warnings
storage/ndb/src/kernel/blocks/pgman.cpp:
  Fixed compiler warnings
storage/ndb/src/kernel/blocks/restore.cpp:
  Fixed compiler warnings
storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp:
  Fixed compiler warnings
storage/ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp:
  Fixed compiler warnings
storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp:
  Fixed compiler warnings
storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp:
  Fixed compiler warnings
storage/ndb/src/kernel/blocks/dbtup/DbtupFixAlloc.cpp:
  Fixed compiler warnings
storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp:
  Fixed compiler warnings
storage/ndb/src/kernel/blocks/suma/Suma.cpp:
  Fixed compiler warnings
  Added missing enum's to switch
storage/ndb/src/kernel/vm/Configuration.cpp:
  Fixed compiler warnings
storage/ndb/src/kernel/vm/DLHashTable.hpp:
  Fixed compiler warnings
storage/ndb/src/kernel/vm/RWPool.hpp:
  Fixed compiler warnings
storage/ndb/src/kernel/vm/SimulatedBlock.cpp:
  Fixed compiler warnings
storage/ndb/src/kernel/vm/WOPool.hpp:
  Fixed compiler warnings
storage/ndb/src/kernel/vm/ndbd_malloc_impl.cpp:
  Fixed compiler warnings
storage/ndb/src/mgmclient/CommandInterpreter.cpp:
  Fixed compiler warnings
storage/ndb/src/mgmsrv/MgmtSrvr.cpp:
  Fixed compiler warnings
storage/ndb/src/ndbapi/DictCache.cpp:
  Fixed compiler warnings
storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp:
  Fixed compiler warnings
storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp:
  Fixed compiler warnings
storage/ndb/src/ndbapi/NdbIndexOperation.cpp:
  Fixed compiler warnings
storage/ndb/src/ndbapi/NdbIndexStat.cpp:
  Initialize possible uninitialized variable
storage/ndb/src/ndbapi/NdbOperationInt.cpp:
  Fixed compiler warnings
storage/ndb/src/ndbapi/NdbRecAttr.cpp:
  Added missing enum's (To avoid compiler warnings)
storage/ndb/src/ndbapi/NdbScanOperation.cpp:
  Fixed compiler warnings
storage/ndb/src/ndbapi/ObjectMap.hpp:
  Fixed compiler warnings
storage/ndb/tools/desc.cpp:
  Fixed compiler warnings
storage/ndb/tools/restore/Restore.cpp:
  Fixed compiler warnings
storage/ndb/tools/restore/consumer_restore.cpp:
  Fixed compiler warnings
unittest/mytap/t/basic-t.c:
  Fixed compiler warnings
unittest/mytap/tap.c:
  Fixed compiler warnings
2006-11-27 01:47:38 +02:00
unknown
92b3a32b50 Remove direct mapping of enum interval_type to mysql.event.interval_field
This decoupling allows in further versions of MySQL enum interval_type to
  be reordered without this affecting any backward compatibility in the
  events code.
  This changeset doesn't change any exposed behavior but makes events' code
  more durable to changes outside of their code base.
  
  To the reviewer: There is no regression test included as it is impossible
  to construct one with the current infrastructure which can test it. To test
  the code one has create and event, then change the order of
  enum interval_type in my_time.h, update sql/time.cc, recompile the server
  and run it with scheduler running.


include/my_time.h:
  Add a reminder to keep enum interval_type and
  interval_type_to_name in sync
sql/event_data_objects.cc:
  When loading from disk don't use the integer value of
  mysql.event.interval_field because it could be different of the
  values of enum interval_type, if the latter is reordered in a later
  version of MySQL. Loaded from disk is the string value which is then
  resolved against interval_type_to_name to get the exact enum value we
  need for Event_queue_element::interval.
sql/event_db_repository.cc:
  Use interval_type_to_name from sql/time.cc during storage thus
  decoupling the value stored on disk (the enum) from the integer
  representation in memory. interval_type can be changed and as
  long as interval_type_to_name is kept in sync correct values will
  be saved to disk.
sql/mysql_priv.h:
  add proto of find_string_in_array
sql/strfunc.cc:
  Add a function for searching a LEX_STRING in an array of LEX_STRINGs
2006-10-10 17:59:46 +02:00
unknown
e22b6703f8 remove unused artifacts
sql/event_db_repository.cc:
  remove unused variables - reported by MS compiler
sql/event_queue.cc:
  remove unused variables - reported by MS compiler
sql/event_scheduler.cc:
  remove unused label
sql/events.cc:
  remove unused variable and a label - reported by MS compiler
2006-09-01 14:25:29 +02:00
unknown
f18ec676a0 WL#3337 (Event scheduler new architecture)
Don't send affected rows after CREATE/ALTER/DROP EVENT as this is
inconsistent with the rest of the server in terms of CREATE/ALTER/DROP
DDLs


sql/event_data_objects.cc:
  Events::drop_event() does not expect anymore a parameter named affected_rows
sql/event_db_repository.cc:
  Remove rows_affected as the behavior exposed by Events is not
  coherent with the behavior of many other DDL, like CREATE PROCEDURE, etc.
sql/event_db_repository.h:
  Remove rows_affected as the behavior exposed by Events is not
  coherent with the behavior of many other DDL, like CREATE PROCEDURE, etc.
sql/events.cc:
  Remove rows_affected as the behavior exposed by Events is not
  coherent with the behavior of many other DDL, like CREATE PROCEDURE, etc.
sql/events.h:
  Remove rows_affected as the behavior exposed by Events is not
  coherent with the behavior of many other DDL, like CREATE PROCEDURE, etc.
sql/sql_parse.cc:
  Don't send affected rows, because this behavior is not consistent
  with the rest of the server for CREATE/ALTER/DROP DDLs
2006-08-28 10:27:42 +02:00
unknown
3e4b79d9ca Minor change - fixed function documentation and added
const for two parameters.


sql/event_db_repository.cc:
  add a missing documentation of a parameter
  add const to two parameters
sql/event_db_repository.h:
  Added const to two parameters
2006-08-21 17:16:46 +02:00
unknown
5f0a5dc037 WL#3337 (Event scheduler new architecture)
Shift from direct usage of (char *) with STRING_WITH_LEN
to C_STRING_WITH_LEN


sql/event_db_repository.cc:
  don't use direct casting but existing C_STRING_WITH_LEN macro
  to shut up the compiler.
sql/event_scheduler.cc:
  don't use direct casting but existing C_STRING_WITH_LEN macro
  to shut up the compiler.
2006-08-17 17:44:16 +02:00
unknown
99adbd131a WL#3337 (Event scheduler new architecture)
Post-review fixes. Mostly whitespace, int-to-bool return value, fixed comments


sql/Makefile.am:
  compile all submodules of Events before compiling the facade
sql/event_data_objects.cc:
  - Use initialization list
  - Clean whitespaces
  - Shorten comments
  - Fix comments
sql/event_data_objects.h:
  - Fix whitespace
sql/event_db_repository.cc:
  - Change return type from int to bool where only one error code is
    returned.
  - Don't use macros but get the maximal number of characters in a column
    from the column
  - Fix  comments
  - Make functions which has return value but it's not used - void.
sql/event_db_repository.h:
  - Methods with only one error code int -> bool return value
  - Remove declaration of fill_schema_events, a function that does not exist
sql/event_queue.cc:
  - Use initialization lists
  - Let find_n_remove_event delete the object thus making the code more robust.
    The caller could forget to destruct the object. In addition, find_n_remove_element()
    does not return a value.
  - Move check_system_tables() to class Events
  - Fix comments
sql/event_queue.h:
  - Whitespace changes
  - init_queue() should allow passing of THD
  - check_system_tables moved to class Events
  - find_n_remove_event() is now void
sql/event_scheduler.cc:
  - Initialize res before use
  - Remove end stop from message
sql/event_scheduler.h:
  Add uninitialized state. The scheduler is in it before init_scheduler()
  is called. The rationale is that otherwise state has no value before
  the call. If the system tables were damaged the scheduler won't be initialized
  but in Events::deinit() Event_scheduler::stop() will be called and this will
  touch state, generating valgrind warning at minimum.
sql/events.cc:
  - Whitespace changes
  - Fix comments
  - Make methods which have only one error code be bool instead of int
  - Create temporarily a THD to be used for the initialization of Event_queue
  - Event_queue::check_system_tables() moved to Events::check_system_tables
  - is_started() is renamed to is_execution_of_events_started()
sql/events.h:
  - Whitespace changes
  - When a method returns only one error code it should be bool, not int
  - is_started() renamed to is_execution_of_events_started()
sql/set_var.cc:
  is_started() is renamed to is_execution_of_events_started()
sql/sql_db.cc:
  The return code is not used, thus don't return anything and drop_schema_events()
  is now void.
sql/sql_yacc.yy:
  - Fix comments
  - Remove unneeded initialization which is performed in lex_init()
sql/share/errmsg.txt:
  New error message
sql/table.cc:
  - Fix comments
  - make table_check_intact() accespt const *table_def
sql/table.h:
  Make table_check_intact() accespt const *table_def
2006-08-17 14:22:59 +02:00
unknown
e69e640f2e WL#3337 (Events new architecture)
Small updates before patch submit.


client/mysqltest.c:
  allow --valgrind option to mysqltest so one can be able to detect
  whether the test is running under valgrind by having $VALGRIND_TEST,
  similar to BIG_TEST, in the test file.
mysql-test/mysql-test-run.pl:
  If the test suite is running under valgrind start mysqltest with --valgrind
  to inform that we run valgrind. mysqltest will provide $VALGRIND_TEST for the
  test cases.
mysql-test/r/events_bugs.result:
  update result
mysql-test/r/events_scheduling.result:
  update result
mysql-test/t/events.test:
  Increase times or the test will fail under valgrind
mysql-test/t/events_bugs.test:
  Increase times or the test will fail under valgrind
mysql-test/t/events_scheduling.test:
  Remove faulty test
  Disable the test case for valgrind
sql/event_data_objects.cc:
  count the number of executions
sql/event_data_objects.h:
  flags is not used at all
  add execution_count to count the number of executions
sql/event_db_repository.cc:
  Initialize wherever needed.
  Add a comment regarding valgrind warning.
sql/event_queue.cc:
  more debug info in the trace log
sql/event_scheduler.cc:
  Use macro COND_STATE_WAIT() in all cases we need waiting
  on condition. Hence, we can trace locking, attemption to lock
  and more with SHOW SCHEDULER STATUS
sql/event_scheduler.h:
  Change the declaration of cond_wait to accept THD
sql/events.cc:
  fix memory leak. Destroy event_queue
mysql-test/include/not_valgrind.inc:
  New BitKeeper file ``mysql-test/include/not_valgrind.inc''
mysql-test/r/not_valgrind.require:
  New BitKeeper file ``mysql-test/r/not_valgrind.require''
2006-07-17 16:52:45 +02:00
unknown
42a8e2c942 WL#3337 (Event scheduler new architecture)
More small fixes to the API : use LEX_STRING instead of LEX_STRING* and if error
then return bool(true) instead of error code.
Merged functions. Reduced usage of sp_name.
Fixed a lot of function documentation errors.
Added function documentation wherever needed.
Removed some unused defines and error codes.

Next to come is batch rename of Event_scheduler_ng to Event_scheduler.


mysql-test/r/events.result:
  update result
mysql-test/r/events_logs_tests.result:
  update result
mysql-test/t/events.test:
  more test coverage
mysql-test/t/events_logs_tests.test:
  fix test
sql/event_data_objects.cc:
  Cosmetics.
  Fix function documentation whenever needed.
  Move Event_job_data::compile() next to Event_job_data::execute()
sql/event_data_objects.h:
  Remove unneeded error codes and defines
  Move function declarations at the end of the header
sql/event_db_repository.cc:
  Fix function documentation.
  Event_db_repository::update_event() now uses LEX_STRING *-s instead of
  sp_name . Lower coupling.
sql/event_db_repository.h:
  Event_db_repository::update_event() now uses LEX_STRING *-s instead of
  sp_name . Lower coupling.
  find_event -> find_named_event
  find_event_by_name is not used externally, merge with load_named_event()
sql/event_queue.cc:
  LEX_STRING* to LEX_STRING
  Fix comments.
  Fix and add function documentation.
  Remove Event_queue::events_count() as it is unused
  Change get_top_for_execution_if_time() to return status code as return value
  and the object is in out parameter.
sql/event_queue.h:
  LEX_STRING* to LEX_STRING
  Fix comments.
  Fix and add function documentation.
  Remove Event_queue::events_count() as it is unused
  Change get_top_for_execution_if_time() to return status code as return value
  and the object is in out parameter.
  Try to detect also lock attemptions for deadlocks.
sql/event_scheduler_ng.cc:
  Always execute on thd->mem_root
  Fix according to changed API of Event_queue::get_top_for_execution_if_time()
sql/events.cc:
  Fix function documentation.
  Fix code after API changes of internal Event module classes.
sql/events.h:
  sp_name -> LEX_STRINGs
sql/sql_parse.cc:
  Fix according to changed API of Events::show_create_event()
sql/sql_yacc.yy:
  Don't pass NULL as third parameter to sp_head::init_strings()
2006-07-11 18:28:15 +02:00
unknown
084f74426b Remove trailing whitespace.
After merge fixes.


sql/event_data_objects.cc:
  after merge fix. use thd->strmake instead of strmake_root
  Remove commented out code.
  Remove trailing whitespace.
sql/event_db_repository.cc:
  After merge fix.
  Before closing thread tables check whether table is actuall non-NULL.
  And always initialize it to NULL.
sql/event_queue.cc:
  Remove trailing whitespace.
sql/event_scheduler_ng.cc:
  Remove trailing whitespace.
  Tabs to spaces.
sql/events.cc:
  Remove trailing whitespace.
2006-07-10 23:54:46 +02:00
unknown
974eecc246 WL#3337 (Event scheduler new architecture)
This patch introduces specialized Event data objects
Event_basic as parent.
Event_queue_element used for queue storage
Event_timed used for SHOW EVENTS/ I_S.EVENTS / SHOW CREATE EVENT
Event_job_data using during execution.
Methods were moved out of Event_timed to other classes.

This patch also introduces Events::LOCK_event_metadata.
This patch gives new implementation of Events::dump_internal_status().
Now both the Event_scheduler and Event_queue return information during
their ::dump_internal_status().

Shortened a bit the runtime for executing events test cases.


mysql-test/r/events.result:
  update results
mysql-test/r/events_bugs.result:
  update results
mysql-test/r/events_logs_tests.result:
  update results
mysql-test/r/events_scheduling.result:
  update results
mysql-test/t/events.test:
  update test
  make --sleep more appropriate . saving some time could mean failure on loaded boxes though :(
  add tests for previously uncovered branches.
mysql-test/t/events_bugs.test:
  update test
  make --sleep more appropriate . saving some time could mean failure on loaded boxes though :(
  add tests for previously uncovered branches.
mysql-test/t/events_logs_tests.test:
  make the test shorter by time
mysql-test/t/events_scheduling.test:
  when selecting always use ORDER BY
mysql-test/t/events_stress.test:
  sleep 2.5secs for shorter stress test
sql/event_data_objects.cc:
  Event_timed is no more used during execution.
  Event_timed is no more used during in the memory queue.
  Event_timed is only used for SHOW CREATE EVENT/ I_S.EVENTS/ SHOW EVENTS
  Event_basic is the parent of almost all Event data objects.
  Event_basic -> Event_queue_element (used for the memory queue) -> Event_timed
  Event_basic -> Event_job_data (the object used for execution)
  Sql_alloc -> Event_parse_data (used during parsing)
sql/event_data_objects.h:
  Event_timed is no more used during execution.
  Event_timed is no more used during in the memory queue.
  Event_timed is only used for SHOW CREATE EVENT/ I_S.EVENTS/ SHOW EVENTS
  Event_basic is the parent of almost all Event data objects.
  Event_basic -> Event_queue_element (used for the memory queue) -> Event_timed
  Event_basic -> Event_job_data (the object used for execution)
  Sql_alloc -> Event_parse_data (used during parsing)
sql/event_db_repository.cc:
  Cosmetics.
  load_named_event now uses Event_basic, for polymorphism
  find_event uses Event_basic, to be polymorphic.
  use Field **fields= table->field and then index fields[...]
  Add documentation.
  Fix documentation.
sql/event_db_repository.h:
  Event_db_repository depends only on Event_basic's interface
sql/event_queue.cc:
  Cosmetics.
  Don't use Event_timed for the queue and giving back object for execution.
  Event_queue_element is for the queue, Event_job_data is for execution.
  Add Event_queue::dump_internal_status() for SHOW SCHEDULER STATUS command
sql/event_queue.h:
  Cosmetics.
  Don't use Event_timed for the queue and giving back object for execution.
  Event_queue_element is for the queue, Event_job_data is for execution.
  Add Event_queue::dump_internal_status() for SHOW SCHEDULER STATUS command
sql/event_scheduler_ng.cc:
  Add back Event_scheduler::cond_wait()
  Add back Event_scheduler::dump_internal_status()
  Using Event_job_data for execution. Make the scheduler thread unkillable (thd->command= COM_DAEMON).
  Add a lot of documentation.
sql/event_scheduler_ng.h:
  Add back Event_scheduler::cond_wait()
  Add back Event_scheduler::dump_internal_status()
  Using Event_job_data for execution.
sql/events.cc:
  Documentation
  Add LOCK_event_metadata
sql/events.h:
  Change the signature of Events::drop_event() not to use sp_name but LEX_STRING
sql/share/errmsg.txt:
  Fix error message
sql/sql_parse.cc:
  Events::drop_event() has new signature
2006-07-10 13:44:43 +02:00
unknown
b9a7fe2757 WL#3337 (Event scheduler new architecture)
Cleaned up the code a bit. Fixed few leaks.
This code still does not load events on server startup
from disk. The problem is that there is a need for a THD instance, which
does not exist during server boot. This will be solved soon.
Still Event_timed is used both for the memory queue and for exectution.
This will be changed according to WL#3337 probably in the next commit.


sql/event_data_objects.cc:
  Strip unneeded stuff from class Event_timed
  Event_timed is still used for the queue and execution.
  That will be changed in the next commit.
sql/event_data_objects.h:
  Strip unneeded stuff from class Event_timed
  Event_timed is still used for the queue and execution.
  That will be changed in the next commit.
sql/event_db_repository.cc:
  Cosmetics.
  Add a new method load_named_event_job, to be made complete in the 
  next commit. It will load from disk an instance of Event_job_data to
  be used during execution.
sql/event_db_repository.h:
  find_event does not need MEM_ROOT anymore
  because the memory is allocated on Event's own root.
sql/event_queue.cc:
  Remove dead code.
  Move dumping of the queue to separate method.
  Make critical sections in create_event & update_event
  as small as possible - load the new event outside of the section
  and free the object also outside of it.
sql/event_queue.h:
  init -> init_queue -> easier for ctags
  deinit -> deinit_queue -> easier for ctags
sql/event_scheduler.cc:
  empty this file
sql/event_scheduler.h:
  empty this file
sql/event_scheduler_ng.cc:
  add back DBUG_RETURN(0) in thread handlers.
  We don't stop running events when stopping the scheduler. Therefore
  remove this method now. If it is needed later it can be added back.
sql/event_scheduler_ng.h:
  Remove stop_all_running_threads()
  init -> init_scheduler
  deinit -> deinit_scheduler
  easier for ctags
sql/events.cc:
  Cosmetics
sql/events.h:
  Cosmetics
sql/set_var.cc:
  Remove references to dead code
sql/sql_parse.cc:
  Reorganize a bit.
2006-07-05 17:12:50 +02:00
unknown
a5dfeb02e9 WL #3337 (Event scheduler new architecture)
Cut Nr. 8.

All tests pass.

Separated Event_scheduler into Event_queue and Event_scheduler.
Added new Event_scheduler_ng which is the new scheduler and is used
system-wide. Will be moved to the event_scheduler.cc in the future.
Using Event_timed in Event_queue as well as cloned during execution.
Next step is to have Event_worker_data which will be used during execution
and will take ::compile()/::execute() out of Event_timed.


mysql-test/r/events.result:
  update result
mysql-test/r/events_bugs.result:
  update result
mysql-test/r/ps_1general.result:
  update result
mysql-test/r/skip_name_resolve.result:
  update result
mysql-test/r/sp-threads.result:
  update result
mysql-test/r/sp_notembedded.result:
  update result
mysql-test/r/status.result:
  update result
mysql-test/t/events_stress.test:
  Make event_stress a bit longer
sql/Makefile.am:
  Add new event_scheduler_ng.h/cc . These are only to be in the experimental
  clone. Later their content will be moved to event_scheduler.h/cc
sql/event_data_objects.cc:
  Allocate strings memory on own memory root, instead
  on the schedulers. Thus don't "leak" memory. This should
  fix bug#18683 memory leak in event scheduler
sql/event_data_objects.h:
  add mem_root
  add THD - this is only temporal, will be moved to class Event_job_data
  once Event_job_data is responsible for the execution.
sql/event_db_repository.cc:
  Remove unused code.
  Cosmetic changes
sql/event_queue.cc:
  Now use the Event_scheduler_ng (NextGen)
sql/event_queue.h:
  Now use the Event_scheduler_ng (NextGen)
sql/event_scheduler.cc:
  This file is no more used, but will be soon.
sql/event_scheduler.h:
  This file is no more used but will be soon
sql/events.cc:
  Now use the Event_scheduler_ng (NextGen)
sql/events.h:
  Now use the Event_scheduler_ng (NextGen)
sql/mysqld.cc:
  Make it again possible to kill the scheduler thread
sql/set_var.cc:
  Now use the Event_scheduler_ng (NextGen)
sql/share/errmsg.txt:
  Shorten the message.
sql/sql_show.cc:
  Loading is on a own root, then don't use thd->mem_root
2006-07-04 18:44:35 +02:00
unknown
377446fa34 WL#3337 (Event scheduler new architecture)
This is the first cut of separating Event_scheduler in two
classes which are more specialized.
Inheritance was used to separate methods and member variables.
Still Event_scheduler is a child of Event_queue. This dependency
will be removed soon.


sql/event_data_objects.cc:
  add comments
sql/event_db_repository.cc:
  coding style
sql/event_db_repository.h:
  add a call, will be implemented later
sql/event_queue.cc:
  Event_queue, still as super-class of Event_scheduler
sql/event_queue.h:
  Event_queue as super-class of Event_scheduler. Trying to
  separate the two classes
sql/event_scheduler.cc:
  Event_scheduler as child class of Event_queue.
  Trying to separate both classes.
sql/event_scheduler.h:
  Event_scheduler as child class of Event_queue.
  Trying to separate both classes.
sql/events.cc:
  Don't allocate on the stack the scheduler but on the heap.
  The exact way it is done will be changed, that's ok for now.
2006-07-03 11:20:08 +02:00
unknown
9fa9378b2e WL#3337 (Events new architecture)
This cut No 7 should finish the part of fixing the parsing of the events :
- Event_timed is no more used during parsing. Less problems because it has
  a mutex. Event_parse_data class is used during parsing. It is suited only
  for this purpose. It's pretty lightweight
- Late checking of data from parsing is being performed. This should solve
  the problems of nested events in SP or other events (for the situation 
  of no nested bodies). Before if an ALTER EVENT was in a SP, then when the
  SP was compiled, and not executed, the actual init_xxx methods of Event_timed
  were called, which is wrong.
- It could be a side effect of using a specialized class, but test events_stress is
  now 25% quicker.

Cut No8 will start splitting Event_scheduler into 2 parts, the QUEUE will be moved
to Event_queue.


mysql-test/r/events.result:
  update result
mysql-test/t/events.test:
  disabled is actually wrong, should be disable, but because of the early
  checking it was never parsed.
sql/event_data_objects.cc:
  move add init_xxx methods from Event_timed to Event_parse_data
  Event_parse data does not need definer_user and definer_host
  in Event_timed::compile() do not use lex.et, well there is no more lex.et :)
sql/event_data_objects.h:
  move parsing responsibilities from Event_timed to Event_parse_data
sql/event_db_repository.cc:
  No more Event_timed comes from parsing but Event_parse_data
  The initialization of Item*-s from parsing is done late, and not
  during the actual parsing. This is the right way to go because
  if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
  executed (initialized) during parsing, as it was done.
sql/event_db_repository.h:
  No more Event_timed comes from parsing but Event_parse_data
  The initialization of Item*-s from parsing is done late, and not
  during the actual parsing. This is the right way to go because
  if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
  executed (initialized) during parsing, as it was done.
sql/event_scheduler.cc:
  No more Event_timed comes from parsing but Event_parse_data
  The initialization of Item*-s from parsing is done late, and not
  during the actual parsing. This is the right way to go because
  if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
  executed (initialized) during parsing, as it was done.
sql/event_scheduler.h:
  No more Event_timed comes from parsing but Event_parse_data
  The initialization of Item*-s from parsing is done late, and not
  during the actual parsing. This is the right way to go because
  if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
  executed (initialized) during parsing, as it was done.
sql/events.cc:
  No more Event_timed comes from parsing but Event_parse_data
  The initialization of Item*-s from parsing is done late, and not
  during the actual parsing. This is the right way to go because
  if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
  executed (initialized) during parsing, as it was done.
sql/events.h:
  No more Event_timed comes from parsing but Event_parse_data
  The initialization of Item*-s from parsing is done late, and not
  during the actual parsing. This is the right way to go because
  if an ALTER EVENT is inside a SP or CREATE EVENT it should not be
  executed (initialized) during parsing, as it was done.
sql/sql_lex.cc:
  lex->et_compile_phase and lex->et are no more.
  Use lex->event_parse_data
sql/sql_lex.h:
  lex->et_compile_phase and lex->et are no more.
  Use lex->event_parse_data
sql/sql_parse.cc:
  lex->et_compile_phase and lex->et are no more.
  Use lex->event_parse_data
  ACL checks were moved inside the Events subsystem.
  Also ending of the transaction is performed only just
  before doing disk operation. Therefore only when needed.
sql/sql_yacc.yy:
  lex->et and lex->et_parse_phase are no more
  Use the specialized for parsing Event_parse_data
2006-06-29 00:42:25 +02:00
unknown
400276c2f5 WL#3337 (Events new architecture)
Cut 7 (refactoring)

db_repository is no more embedded in the Events
singleton. Therefore a change to Events_db_repository
won't mean recompile of all files in the server which include events.h


sql/event_data_objects.cc:
  db_repository is no more embedded in the Events
  singleton. Therefore a change to Events_db_repository
  won't mean recompile of all files in the server which include events.h
sql/event_db_repository.cc:
  db_repository is no more embedded in the Events
  singleton. Therefore a change to Events_db_repository
  won't mean recompile of all files in the server which include events.h
sql/events.cc:
  db_repository is no more embedded in the Events
  singleton. Therefore a change to Events_db_repository
  won't mean recompile of all files in the server which include events.h
sql/events.h:
  db_repository is no more embedded in the Events
  singleton. Therefore a change to Events_db_repository
  won't mean recompile of all files in the server which include events.h
sql/mysqld.cc:
  db_repository is no more embedded in the Events
  singleton. Therefore a change to Events_db_repository
  won't mean recompile of all files in the server which include events.h
2006-06-28 15:14:05 +02:00
unknown
8ca78787a5 WL#3337 (Events new architecture)
Cut number 6. Move code from sql_show.cc to event_db_repository.cc
that more belongs to the latter.


sql/event_db_repository.cc:
  move code that works with mysql.event from sql_show.cc to 
  event_db_repository.cc . Route through Event_db_repository's interface
  which is proxied by class Events. The code relies on a function from
  sql_show.cc which does the actual storage in the schema table. I think
  it's better to leave the function there because the structure of 
  I_S.EVENTS is defined in sql_show.cc
sql/event_db_repository.h:
  I_S / SHOW EVENTS handling hooks
sql/event_scheduler.cc:
  use the pointer to db_repository which Event_scheduler already has
sql/events.cc:
  Put a comment to get_instance
sql/events.h:
  callback for I_S (sql_show.cc)
sql/sql_show.cc:
  move code that belongs more to Event_db_repository than to here.
  Use a callback of class Events. Only 1 function is left here, because
  it copies data into the actual rows of I_S.EVENTS and belongs to this file.
sql/sql_show.h:
  export this function will be called from event_db_repository.cc
2006-06-28 14:22:14 +02:00
unknown
acefb78bc3 WL#3337 (Events new architecture)
5th cut, moved DB related code to Event_db_repository and
updated accordingly the remanining code.
Moved change/restore_security_context() to class THD
Removed events_priv.h
Next step is to reorganize create/update_event() and parsing for them.
But probably some other refactoring could be done in the meanwhile.
The changes so far pass the test suite.


BitKeeper/deleted/.del-events_priv.h~2e8bce2cf35997df:
  Delete: sql/events_priv.h
sql/Makefile.am:
  events_priv.h is no more
sql/event_data_objects.cc:
  reorganize events code
sql/event_data_objects.h:
  reorganize events code
sql/event_db_repository.cc:
  reorganize events code
sql/event_db_repository.h:
  reorganize events code
sql/event_scheduler.cc:
  reorganize events code
sql/event_scheduler.h:
  reorganize events code
sql/events.cc:
  reorganize events code
sql/events.h:
  reorganize events code
sql/mysqld.cc:
  reorganize events code
sql/set_var.cc:
  reorganize events code
sql/sql_class.cc:
  add ::change_security_context() and restore_security_context()
sql/sql_class.h:
  add ::change_security_context() and restore_security_context()
sql/sql_db.cc:
  reorganize Events code
sql/sql_parse.cc:
  reorganize Events code
sql/sql_show.cc:
  reorganize Events code
2006-06-28 01:28:03 +02:00
unknown
e5f8163b88 first cut of WL#3337 (New event scheduler locking infrastructure).
Infrastructure built. Added the  foreseen files and change Makefile.am/CMakeLists.txt
accordingly.


libmysqld/Makefile.am:
  add new files. this is first cut of WL3337u
sql/CMakeLists.txt:
  add more files to build
sql/Makefile.am:
  add new files. this is first cut of WL3337
sql/event_scheduler.cc:
  event_timed.h -> event_data_objects.h (WL#3337)
sql/events.cc:
  event_timed.h -> event_data_objects.h (WL#3337)
sql/share/errmsg.txt:
  new error message
sql/event_data_objects.cc:
  event_timed.h -> event_data_objects.h (WL#3337)
sql/event_data_objects.h:
  event_timed.h -> event_data_objects.h (WL#3337)
sql/sql_parse.cc:
  event_timed.h -> event_data_objects.h (WL#3337)
sql/sql_show.cc:
  event_timed.h -> event_data_objects.h (WL#3337)
sql/sql_yacc.yy:
  event_timed.h -> event_data_objects.h (WL#3337)
2006-06-27 08:48:50 +02:00