Commit graph

56 commits

Author SHA1 Message Date
He Zhenxing
df0b6707da Bug#53189 Table map version unused and can be removed
MYSQL_BIN_LOG m_table_map_version member and it's associated 
functions were not used in the logic of binlogging and replication,
this patch removed all related code.

sql/log.cc:
  removed unused m_table_map_version variable and functions
sql/log.h:
  removed unused m_table_map_version variable and functions
sql/log_event.h:
  Removed unused LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F flag
sql/sql_class.cc:
  Removed unused LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F flag
sql/sql_load.cc:
  Removed unused LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F flag
sql/table.cc:
  removed unused table_map_version variable
sql/table.h:
  removed unused table_map_version variable
2010-05-08 11:25:33 +08:00
Alfranio Correia
a4c50983f4 BUG#45292 orphan binary log created when starting server twice
This patch fixes three bugs as follows. First, aborting the server while purging
binary logs might generate orphan files due to how the purge operation was
implemented:

          (purge routine - sql/log.cc - MYSQL_BIN_LOG::purge_logs)

      1 - register the files to be removed in a temporary buffer.
      2 - update the log-bin.index.
      3 - flush the log-bin.index.
      4 - erase the files whose names where register in the temporary buffer
      in step 1.

Thus a failure while  executing step 4 would generate an orphan file. Second,
a similar issue might happen while creating a new binary as follows:

          (create routine - sql/log.cc - MYSQL_BIN_LOG::open)

      1 - open the new log-bin.
      2 - update the log-bin.index.

Thus a failure while executing step 1 would generate an orphan file.

To fix these issues, we record the files to be purged or created before really
removing or adding them. So if a failure happens such records can be used to
automatically remove dangling files. The new steps might be outlined as follows:

          (purge routine - sql/log.cc - MYSQL_BIN_LOG::purge_logs)

      1 - register the files to be removed in the log-bin.~rec~ placed in
      the data directory.
      2 - update the log-bin.index.
      3 - flush the log-bin.index.
      4 - delete the log-bin.~rec~.

          (create routine - sql/log.cc - MYSQL_BIN_LOG::open)

      1 - register the file to be created in the log-bin.~rec~
      placed in the data directory.
      2 - open the new log-bin.
      3 - update the log-bin.index.
      4 - delete the log-bin.~rec~.

          (recovery routine - sql/log.cc - MYSQL_BIN_LOG::open_index_file)

      1 - open the log-bin.index.
      2 - open the log-bin.~rec~.
      3 - for each file in log-bin.~rec~.
        3.1 Check if the file is in the log-bin.index and if so ignore it.
        3.2 Otherwise, delete it.

The third issue can be described as follows. The purge operation was allowing
to remove a file in use thus leading to the loss of data and possible
inconsistencies between the master and slave. Roughly, the routine was only
taking into account the dump threads and so if a slave was not connect the
file might be delete even though it was in use.
2009-12-04 14:40:42 +00:00
Alfranio Correia
3cf052b76c BUG#43929 binlog corruption when max_binlog_cache_size is exceeded
Large transactions and statements may corrupt the binary log if the size of the
cache, which is set by the max_binlog_cache_size, is not enough to store the
the changes.

In a nutshell, to fix the bug, we save the position of the next character in the
cache before starting processing a statement. If there is a problem, we simply
restore the position thus removing any effect of the statement from the cache.
Unfortunately, to avoid corrupting the binary log, we may end up loosing changes
on non-transactional tables if they do not fit in the cache. In such cases, we
store an Incident_log_event in order to stop the slave and alert users that some
changes were not logged.

Precisely, for every non-transactional changes that do not fit into the cache,
we do the following:
  a) the statement is *not* logged
  b) an incident event is logged after committing/rolling back the transaction,
  if any. Note that if a failure happens before writing the incident event to
  the binary log, the slave will not stop and the master will not have reported
  any error.
  c) its respective statement gives an error

For transactional changes that do not fit into the cache, we do the following:
  a) the statement is *not* logged
  b) its respective statement gives an error

To work properly, this patch requires two additional things. Firstly, callers to
MYSQL_BIN_LOG::write and THD::binlog_query must handle any error returned and
take the appropriate actions such as undoing the effects of a statement. We
already changed some calls in the sql_insert.cc, sql_update.cc and sql_insert.cc
modules but the remaining calls spread all over the code should be handled in
BUG#37148. Secondly, statements must be either classified as DDL or DML because
DDLs that do not get into the cache must generate an incident event since they
cannot be rolled back.
2009-06-18 14:52:46 +01:00
He Zhenxing
abf5f8dac2 BUG#41948 Query_log_event constructor needlessly contorted
Make the caller of Query_log_event, Execute_load_log_event
constructors and THD::binlog_query to provide the error code
instead of having the constructors to figure out the error code.

sql/log_event.cc:
  Changed constructors of Query_log_event and Execute_load_log_event to accept the error code argument instead of figuring it out by itself
sql/log_event.h:
  Changed constructors of Query_log_event and Execute_load_log_event to accept the error code argument
2009-05-30 21:32:28 +08:00
Luis Soares
df8543868d merge: 5.1 -> 5.1-rpl
conflicts:
  Text conflict in client/mysqltest.cc
  Text conflict in mysql-test/include/wait_until_connected_again.inc
  Text conflict in mysql-test/lib/mtr_report.pm
  Text conflict in mysql-test/mysql-test-run.pl
  Text conflict in mysql-test/r/events_bugs.result
  Text conflict in mysql-test/r/log_state.result
  Text conflict in mysql-test/r/myisam_data_pointer_size_func.result
  Text conflict in mysql-test/r/mysqlcheck.result
  Text conflict in mysql-test/r/query_cache.result
  Text conflict in mysql-test/r/status.result
  Text conflict in mysql-test/suite/binlog/r/binlog_index.result
  Text conflict in mysql-test/suite/binlog/r/binlog_innodb.result
  Text conflict in mysql-test/suite/rpl/r/rpl_packet.result
  Text conflict in mysql-test/suite/rpl/t/rpl_packet.test
  Text conflict in mysql-test/t/disabled.def
  Text conflict in mysql-test/t/events_bugs.test
  Text conflict in mysql-test/t/log_state.test
  Text conflict in mysql-test/t/myisam_data_pointer_size_func.test
  Text conflict in mysql-test/t/mysqlcheck.test
  Text conflict in mysql-test/t/query_cache.test
  Text conflict in mysql-test/t/rpl_init_slave_func.test
  Text conflict in mysql-test/t/status.test
2009-01-23 13:22:05 +01:00
Luis Soares
73326c1069 BUG#38826 Race in MYSQL_LOG::purge_logs is impossible to debug in production
BUG#39325 Server crash inside MYSQL_LOG::purge_first_log halts replicaiton

The patch reverses the order of the purging and updating events for log and
relay-log.info/index files respectively.

This solves the problem of having holes caused by crashes happening between updating
info/index files and purging logs.

This patch also contains an aditional test case for testing the crashing before purge logs.
      
NOTE1: This is a combined patch for BUG#38826 and BUG#39325. This patch is based on
bugteam tree and takes into account reviewers suggestions.

NOTE2: Merge from 5.0-bugteam
2008-12-04 14:07:56 +00:00
Mats Kindahl
bcaf5e0cf5 Merging 5.1 main into 5.1-rpl. 2008-10-06 10:27:36 +02:00
He Zhenxing
bd35cfe22e BUG#38734 rpl_server_id2 sync_with_master failed
Rotate event is automatically generated and written when rotating binary
log or relay log. Rotate events for relay logs are usually ignored by slave
SQL thread becuase they have the same server id as that of the slave.
However, if --replicate-same-server-id is enabled, rotate event
for relay log would be treated as if it's a rotate event from master, and
would be executed by slave to update the rli->group_master_log_name and
rli->group_master_log_pos to a wrong value and cause the MASTER_POS_WAIT
function to fail and return NULL.

This patch fixed this problem by setting a flag bit (LOG_EVENT_RELAY_LOG_F)
in the event to tell the SQL thread to ignore these Rotate events generated
for relay logs.

This patch also added another binlog event flag bit (LOG_EVENT_ARTIFICIAL_F)
to distinquish faked events, the method used before this was by checking if
log_pos was zero.


sql/log.h:
  Add a member to MYSQL_BIN_LOG to distinguish binary log from relay log.
sql/log_event.cc:
  Change artificial_event member to LOG_EVENT_ARTIFICIAL_F flag
  
  If LOG_EVENT_RELAY_LOG_F is set in the event flags for a rotate event, ignore it when updating position
  
  Refactored the code in Rotate_log_event::do_update_pos
sql/log_event.h:
  Add LOG_EVENT_RELAY_LOG_F flag to Log_event flags
  Add RELAY_LOG flag to Rotate_log_event flags
sql/sql_repl.cc:
  Set LOG_EVENT_ARTIFICIAL_F for fake rotate events
2008-09-28 15:34:25 +08:00
Mats Kindahl
02a4354044 Bug #32709: Assertion failed: trx_data->empty(), file log.cc
The assertion indicates that some data was left in the transaction
cache when the server was shut down, which means that a previous
statement did not commit or rollback correctly.

What happened was that a bug in the rollback of a transactional
table caused the transaction cache to be emptied, but not reset.
The error can be triggered by having a failing UPDATE or INSERT,
on a transactional table, causing an implicit rollback.

Fixed by always flushing the pending event to reset the state
properly.


mysql-test/extra/rpl_tests/rpl_row_basic.test:
  Testing that a failed update (that writes some rows to the
  transaction cache) does not cause the transaction cache to
  hold on to the data or forget to reset the transaction cache.
sql/log.cc:
  Added call to remove pending event when the transaction cache
  is emptied instead of written to binary log. The call will also
  clear the outstanding table map count so that the cache is not
  left it in a state of "empty but not reset".
  
  Added function MYSQL_BIN_LOG::remove_pending_rows_event().
sql/log.h:
  Added function MYSQL_BIN_LOG::remove_pending_rows_event().
sql/sql_class.cc:
  Adding function THD::binlog_remove_pending_rows_event().
sql/sql_class.h:
  Adding function THD::binlog_remove_pending_rows_event().
2008-09-03 22:04:07 +02:00
unknown
a3b60d2d51 Merge abarkov@bk-internal.mysql.com:/home/bk/mysql-5.1
into  mysql.com:/home/bar/mysql-work/mysql-5.1-new-rpl-merge


client/mysql.cc:
  Auto merged
mysql-test/r/ctype_euckr.result:
  Auto merged
mysql-test/r/ctype_uca.result:
  Auto merged
mysql-test/r/ctype_utf8.result:
  Auto merged
mysql-test/r/func_regexp.result:
  Auto merged
mysql-test/suite/rpl/r/rpl_bug31076.result:
  Auto merged
mysql-test/t/ctype_utf8.test:
  Auto merged
mysql-test/t/func_regexp.test:
  Auto merged
mysql-test/t/partition.test:
  Auto merged
sql/field.cc:
  Auto merged
sql/field.h:
  Auto merged
sql/handler.cc:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/item_cmpfunc.h:
  Auto merged
sql/item_xmlfunc.cc:
  Auto merged
sql/log.cc:
  Auto merged
sql/log.h:
  Auto merged
sql/log_event.cc:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/sp_head.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_delete.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_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
strings/ctype-euc_kr.c:
  Auto merged
sql/sql_yacc.yy:
  Reverting Rafal's changes: TRANSACTIONAL_SYM was removed in a mistake.
mysql-test/r/ctype_ucs.result:
  After merge fix
mysql-test/suite/rpl/t/rpl_bug31076.test:
  After merge fix.
mysql-test/t/ctype_ucs.test:
  After megre fix
2007-10-30 12:03:34 +04:00
unknown
b9b481ec70 Bug#21557 entries in the general query log truncated at 1000 characters.
The general log write function (general_log_print) uses printf style
arguments which need to be pre-processed, meaning that the all arguments
are copied to a single buffer and the problem is that the buffer size is
constant (1022 characters) but queries can be much larger then this.

The solution is to introduce a new log write function that accepts a
buffer and it's length as arguments. The function is to be used when
a formatted output is not required, which is the case for almost all
query write-to-log calls.

This is a incompatible change with respect to the log format of prepared
statements.


mysql-test/r/log_tables.result:
  Add test case result for Bug#21557
mysql-test/t/log_tables.test:
  Add test case for Bug#21557
sql/log.cc:
  Introduce the logger function general_log_write which is similar to
  general_log_print but accepts a single buffer and the buffer length.
  The function doesn't perform any formatting and sends the buffer
  directly to the underlying log handlers.
sql/log.h:
  Introduce the logger function general_log_write.
sql/log_event.cc:
  Pass the query buffer directly to the logger function, formatting
  is not required on this case.
sql/mysql_priv.h:
  Prototype for the logger function general_log_write.
sql/sp_head.cc:
  Pass the query buffer directly to the logger function, formatting
  is not required on this case.
sql/sql_parse.cc:
  Pass the buffer directly to the logger function when formatting
  is not required.
sql/sql_prepare.cc:
  Don't log the statement id, it avoids making a extra copy of the query
  and the query is not truncated anymore if it exceeds the limit.
2007-10-18 15:45:07 -03:00
unknown
0f0e0e1aaf manual merge
sql/log.h:
  manual merge: moving 5.0 hunk into the correct file.
2007-10-04 13:13:04 +03:00
unknown
dc4f704478 Merge kindahl-laptop.dnsalias.net:/home/bkroot/mysql-5.1-rpl
into  kindahl-laptop.dnsalias.net:/home/bk/fix-mysql-5.1-rpl


sql/ha_ndbcluster.cc:
  Auto merged
sql/log.cc:
  Auto merged
sql/log.h:
  Auto merged
sql/slave.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/log_event.cc:
  Manual merge.
2007-08-17 11:00:03 +02:00
unknown
044a4a3e06 Renaming RELAY_LOG_INFO and st_relay_log_info to follow coding standards
(and be more friendly to Doxygen by removing unnecessary typedefs).


sql/log.cc:
  Renaming struct st_relay_log_info to class Relay_log_info.
sql/log.h:
  Renaming struct st_relay_log_info to class Relay_log_info.
sql/log_event.cc:
  Renaming RELAY_LOG_INFO to Relay_log_info.
sql/log_event.h:
  Renaming struct st_relay_log_info to class Relay_log_info.
  Renaming RELAY_LOG_INFO to Relay_log_info.
  Removing typedef RELAY_LOG_INFO.
sql/log_event_old.cc:
  Renaming RELAY_LOG_INFO to Relay_log_info.
sql/log_event_old.h:
  Renaming RELAY_LOG_INFO to Relay_log_info.
sql/rpl_mi.h:
  Renaming RELAY_LOG_INFO to Relay_log_info.
sql/rpl_record.cc:
  Renaming RELAY_LOG_INFO to Relay_log_info.
sql/rpl_record.h:
  Renaming RELAY_LOG_INFO to Relay_log_info.
sql/rpl_record_old.cc:
  Renaming RELAY_LOG_INFO to Relay_log_info.
sql/rpl_record_old.h:
  Renaming RELAY_LOG_INFO to Relay_log_info.
sql/rpl_rli.cc:
  Renaming struct st_relay_log_info to class Relay_log_info.
  Renaming RELAY_LOG_INFO to Relay_log_info.
sql/rpl_rli.h:
  Renaming struct st_relay_log_info to class Relay_log_info.
  Renaming RELAY_LOG_INFO to Relay_log_info.
  Removing typedef RELAY_LOG_INFO.
sql/rpl_utility.cc:
  Renaming RELAY_LOG_INFO to Relay_log_info.
sql/rpl_utility.h:
  Renaming struct st_relay_log_info to class Relay_log_info.
  Renaming RELAY_LOG_INFO to Relay_log_info.
  Removing typedef RELAY_LOG_INFO.
sql/slave.cc:
  Renaming RELAY_LOG_INFO to Relay_log_info.
sql/slave.h:
  Renaming struct st_relay_log_info to class Relay_log_info.
  Renaming RELAY_LOG_INFO to Relay_log_info.
  Removing typedef RELAY_LOG_INFO.
sql/sql_binlog.cc:
  Renaming RELAY_LOG_INFO to Relay_log_info.
sql/sql_class.h:
  Renaming struct st_relay_log_info to class Relay_log_info.
  Renaming RELAY_LOG_INFO to Relay_log_info.
  Removing typedef RELAY_LOG_INFO.
sql/sql_repl.cc:
  Renaming RELAY_LOG_INFO to Relay_log_info.
2007-08-16 07:37:50 +02:00
unknown
926664fe2c Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  mysql.com:/home/my/mysql-5.1


client/client_priv.h:
  Auto merged
client/mysqldump.c:
  Auto merged
client/mysqlslap.c:
  Auto merged
mysql-test/mysql-test-run.pl:
  Auto merged
mysql-test/lib/mtr_report.pl:
  Auto merged
mysql-test/t/disabled.def:
  Auto merged
sql/event_data_objects.cc:
  Auto merged
sql/event_queue.cc:
  Auto merged
sql/ha_partition.cc:
  Auto merged
sql/lock.cc:
  Auto merged
sql/log.cc:
  Auto merged
sql/log.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/slave.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_plugin.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql-common/client.c:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
sql/sql_cache.cc:
  Manual merge
  Removed comment about bug in old code (not relevant)
2007-08-02 07:55:33 +03:00
unknown
b59217ebbb Slow query log to file now displays queries with microsecond precission
--long-query-time is now given in seconds with microseconds as decimals
--min_examined_row_limit added for slow query log
long_query_time user variable is now double with 6 decimals
Added functions to get time in microseconds
Added faster time() functions for system that has gethrtime()  (Solaris)
We now do less time() calls.
Added field->in_read_set() and field->in_write_set() for easier field manipulation by handlers
set_var.cc and my_getopt() can now handle DOUBLE variables.
All time() calls changed to my_time()
my_time() now does retry's if time() call fails.
Added debug function for stopping in mysql_admin_table() when tables are locked
Some trivial function and struct variable renames to avoid merge errors.
Fixed compiler warnings
Initialization of some time variables on windows moved to my_init() 


include/my_getopt.h:
  Added support for double arguments
include/my_sys.h:
  Fixed wrong type to packfrm()
  Added new my_time functions
include/mysql/plugin.h:
  Added support for DOUBLE
libmysql/CMakeLists.txt:
  Added new time functions
libmysql/Makefile.shared:
  Added new time functions
mysql-test/r/variables.result:
  Testing of long_query_time
mysql-test/t/variables.test:
  Testing of long_query_time
mysys/charset.c:
  Fixed compiler warnings
mysys/default_modify.c:
  Fixed compiler warnings
mysys/hash.c:
  Fixed compiler warnings
mysys/mf_getdate.c:
  Use my_time()
mysys/mf_iocache2.c:
  Fixed compiler warnings
mysys/mf_pack.c:
  Fixed compiler warnings
mysys/mf_path.c:
  Fixed compiler warnings
mysys/my_append.c:
  Fixed compiler warnings
mysys/my_compress.c:
  Fixed compiler warnings
mysys/my_copy.c:
  Fixed compiler warnings
mysys/my_gethwaddr.c:
  Fixed compiler warnings
mysys/my_getopt.c:
  Added support for double arguments
mysys/my_getsystime.c:
  Added functions to get time in microseconds.
  Added faster time() functions for system that has gethrtime()  (Solaris)
  Moved windows initialization code to my_init()
mysys/my_init.c:
  Added initializing of variables needed for windows time functions
mysys/my_static.c:
  Added variables needed for windows time functions
mysys/my_static.h:
  Added variables needed for windows time functions
mysys/my_thr_init.c:
  Added THR_LOCK_time, used for faster my_time()
mysys/mysys_priv.h:
  Added THR_LOCK_time, used for faster my_time()
mysys/thr_alarm.c:
  time() -> my_time()
sql/event_data_objects.cc:
  end_time() -> set_current_time()
sql/event_queue.cc:
  end_time() -> set_current_time()
sql/event_scheduler.cc:
  Fixed compiler warnings
sql/field.h:
  Added field->in_read_set() and field->in_write_set() for easier field manipulation by handlers
sql/item.h:
  Added decimal to Item_float(double)
sql/item_cmpfunc.h:
  Added decimal to Item_float(double)
sql/item_timefunc.cc:
  time() -> my_time()
sql/item_xmlfunc.cc:
  Fixed compiler warning
sql/lock.cc:
  lock_time() -> set_time_after_lock()
sql/log.cc:
  Timing in slow query log to file is now done in microseconds
  Changed some while() loops to for() loops.
  Fixed indentation
  time() -> my_time()
sql/log.h:
  Slow query logging is now done based on microseconds
sql/log_event.cc:
  time() -> my_time()
  Fixed arguments to new Item_float()
sql/mysql_priv.h:
  Fixed compiler warnings
  Added opt_log_slow_slave_statements
sql/mysqld.cc:
  Added --log_slow_slave_statements and --min_examined_row_limit
  --long-query-time now takes a double argument with microsecond resolution
  Don't write shutdown message when using --help
  Removed not needed \n
  Thread create time and connect time is now done in microseconds
  time() -> my_time()
  Avoid some time() calls
sql/net_serv.cc:
  Fixed compiler warnings
sql/parse_file.cc:
  time() -> my_time()
sql/set_var.cc:
  Added support for DOUBLE variables
  Added support for variables that are given in seconds with microsecond resolution
sql/set_var.h:
  Added support for variables that are given in seconds with microsecond resolution
sql/slave.cc:
  Allow logging of slave queries to slow query log if 'opt_log_slow_slave_statements' is given
  time() -> my_time()
sql/sql_cache.h:
  Fixed compiler warning()
sql/sql_class.cc:
  Initialize new THD variables
sql/sql_class.h:
  long_query_time is now in microseconds
  Added min_examined_row_limit
  Reordered some THD elements for higher efficency
  Added timers in microseconds (connect_utime, thr_create_utime, start_utime and utime_after_lock)
  Start of query is now recorded both in seconds and in microseconds.
  Following renames was made for more clarity and avoid merge problems from earlier versions:
  connect_time -> connect_utime
  thr_create_time -> thr_create_utime
  end_time()  -> set_current_time()
  lock_time() -> set_time_after_lock()
  
  Added THD::start_utime, which is start of query in microseconds from some arbitary time
  Added function THD::current_utime()
  
  Removed safe_time() as retry's are handled in my_time()
sql/sql_connect.cc:
  User resources are now using microsecond resolution
sql/sql_insert.cc:
  end_time() -> set_current_time()
sql-common/client.c:
  time() -> my_time()
sql/sql_parse.cc:
  Testing if we should print to slow_query_log() is now done with microsecond precission.
  If min_examined_row_limit is given, only log queries to slow query log that has examined more rows than this.
sql/sql_select.cc:
  Simplify code now that Item_float() takes decimals as argument
sql/sql_show.cc:
  time() -> my_time()
  Added support for SYS_DOUBLE
sql/sql_table.cc:
  Added debug function for stopping in mysql_admin_table() when tables are locked
sql/structs.h:
  intime -> reset_utime
2007-07-30 11:33:50 +03:00
unknown
cc5b374566 Code review changes 2007-07-27 12:19:36 -06:00
unknown
4462578a1c WL#3984 (Revise locking of mysql.general_log and mysql.slow_log)
Bug#25422 (Hang with log tables)
Bug 17876 (Truncating mysql.slow_log in a SP after using cursor locks the
          thread)
Bug 23044 (Warnings on flush of a log table)
Bug 29129 (Resetting general_log while the GLOBAL READ LOCK is set causes
           a deadlock)

Prior to this fix, the server would hang when performing concurrent
ALTER TABLE or TRUNCATE TABLE statements against the LOG TABLES,
which are mysql.general_log and mysql.slow_log.

The root cause traces to the following code:
in sql_base.cc, open_table()
  if (table->in_use != thd)
  {
    /* wait_for_condition will unlock LOCK_open for us */
    wait_for_condition(thd, &LOCK_open, &COND_refresh);
  }
The problem with this code is that the current implementation of the
LOGGER creates 'fake' THD objects, like
- Log_to_csv_event_handler::general_log_thd
- Log_to_csv_event_handler::slow_log_thd
which are not associated to a real thread running in the server,
so that waiting for these non-existing threads to release table locks
cause the dead lock.

In general, the design of Log_to_csv_event_handler does not fit into the
general architecture of the server, so that the concept of general_log_thd
and slow_log_thd has to be abandoned:
- this implementation does not work with table locking
- it will not work with commands like SHOW PROCESSLIST
- having the log tables always opened does not integrate well with DDL
operations / FLUSH TABLES / SET GLOBAL READ_ONLY

With this patch, the fundamental design of the LOGGER has been changed to:
- always open and close a log table when writing a log
- remove totally the usage of fake THD objects
- clarify how locking of log tables is implemented in general.

See WL#3984 for details related to the new locking design.

Additional changes (misc bugs exposed and fixed):

1)

mysqldump which would ignore some tables in dump_all_tables_in_db(),
 but forget to ignore the same in dump_all_views_in_db().

2)

mysqldump would also issue an empty "LOCK TABLE" command when all the tables
to lock are to be ignored (numrows == 0), instead of not issuing the query.

3)

Internal errors handlers could intercept errors but not warnings
(see sql_error.cc).

4)

Implementing a nested call to open tables, for the performance schema tables,
exposed an existing bug in remove_table_from_cache(), which would perform:
  in_use->some_tables_deleted=1;
against another thread, without any consideration about thread locking.
This call inside remove_table_from_cache() was not required anyway,
since calling mysql_lock_abort() takes care of aborting -- cleanly -- threads
that might hold a lock on a table.
This line (in_use->some_tables_deleted=1) has been removed.


sql/handler.cc:
  Moved logic for system / log tables in the SQL layer.
sql/handler.h:
  Moved logic for system / log tables in the SQL layer.
sql/lock.cc:
  Revised locking of log tables
sql/log.cc:
  Major cleanup: changed how log tables are locked / written to.
sql/log.h:
  Major cleanup: changed how log tables are locked / written to.
sql/mysql_priv.h:
  performance schema helpers
sql/slave.cc:
  open_ltable() lock flags
sql/sp.cc:
  open_ltable() lock flags
sql/sql_acl.cc:
  open_ltable() lock flags
sql/sql_class.h:
  performance schema helpers
sql/sql_delete.cc:
  log tables cleanup in TRUNCATE
sql/sql_error.cc:
  Internal handlers can also intercept warnings
sql/sql_insert.cc:
  open_ltable() lock flags
sql/sql_parse.cc:
  performance schema helpers
sql/sql_plugin.cc:
  open_ltable() lock flags
sql/sql_rename.cc:
  log tables cleanup in RENAME
sql/sql_servers.cc:
  open_ltable() lock flags
sql/sql_show.cc:
  Move INFORMATION_SCHEMA_NAME to table.cc
sql/sql_table.cc:
  log tables cleanup (admin operations, ALTER TABLE)
sql/sql_udf.cc:
  open_ltable() lock flags
sql/table.cc:
  Implemented TABLE_CATEGORY.
sql/share/errmsg.txt:
  Changed the wording and name of ER_CANT_READ_LOCK_LOG_TABLE
sql/table.h:
  Implemented TABLE_CATEGORY.
storage/csv/ha_tina.cc:
  Moved logic for system / log tables in the SQL layer.
storage/csv/ha_tina.h:
  Moved logic for system / log tables in the SQL layer.
storage/myisam/ha_myisam.cc:
  Moved logic for system / log tables in the SQL layer.
storage/myisam/ha_myisam.h:
  Moved logic for system / log tables in the SQL layer.
client/mysqldump.c:
  Don't lock tables in the ignore list.
  Don't issue empty LOCK TABLES queries.
sql/sql_base.cc:
  log tables cleanup
  performance schema helpers
mysql-test/r/ps.result:
  Adjust test results
mysql-test/r/show_check.result:
  Adjust test results
mysql-test/r/status.result:
  Adjust test results
mysql-test/t/log_state.test:
  Added tests for Bug#29129
mysql-test/t/ps.test:
  Make the test output deterministic
mysql-test/t/show_check.test:
  Make the test output deterministic
mysql-test/r/log_state.result:
  Changed the default location of the log output to LOG_FILE,
  for backward compatibility with MySQL 5.0
  ---
  Adjust test results
mysql-test/r/log_tables.result:
  cleanup for -ps-protocol
mysql-test/t/log_tables.test:
  cleanup for -ps-protocol
sql/set_var.cc:
  Changed the default location of the log output to LOG_FILE,
  for backward compatibility with MySQL 5.0
  ---
  log tables cleanup
2007-07-27 00:31:06 -06:00
unknown
fbfa18daf0 Fix for bug #26380: LOCK TABLES + FLUSH LOGS causes deadlock
The log tables are by nature PERFORMANCE_SCHEMA tables,
which should not be affected by SET GLOBAL READ_ONLY or FLUSH TABLES
WITH READ LOCK.

The implementation of FLUSH TABLES WITH READ LOCK already ignored log tables.
Now with this patch, the implementation of LOCK TABLE also ignore a
global read lock for log tables, which was the missing symmetry.


mysql-test/r/flush.result:
  Fix for bug #26380: LOCK TABLES + FLUSH LOGS causes deadlock
    - test result.
mysql-test/t/flush.test:
  Fix for bug #26380: LOCK TABLES + FLUSH LOGS causes deadlock
    - test case.
sql/lock.cc:
  Fix for bug #26380: LOCK TABLES + FLUSH LOGS causes deadlock
    - logger.is_privileged_thread() used.
sql/log.h:
  Fix for bug #26380: LOCK TABLES + FLUSH LOGS causes deadlock
    - LOGGER::is_privileged_thread() introduced that returns TRUE if a given thread 
      is either a general_log or a slow_log or a privileged thread.
sql/sql_base.cc:
  Fix for bug #26380: LOCK TABLES + FLUSH LOGS causes deadlock
    - pass MYSQL_LOCK_IGNORE_GLOBAL_READ_LOCK to the mysql_lock_tables() in case of 
      call from a logger in order not to honor the GLOBAL READ LOCK 
      and to avoid possible deadlocks.
2007-06-17 09:56:33 +05:00
unknown
4cd780d22b mysql-test/mysql-test-run.pl
provide the writable datadir for mysqld --help (for lower_case test)
sql/log.h, sql/mysqld.cc
    make default binlog_format value to be 0 (for a hack of using
    GET_STR for enum to continue to work)


mysql-test/mysql-test-run.pl:
  provide the writable datadir for mysqld --help (for lower_case test)
sql/log.h:
  make default binlog_format value to be 0 (for a hack of using
  GET_STR for enum to continue to work)
sql/mysqld.cc:
  make default binlog_format value to be 0 (for a hack of using
  GET_STR for enum to continue to work)
2007-04-27 14:13:34 -07:00
unknown
0e0ca2a61c Bug #26079 max_binlog_size + innodb = not make new binlog and hang server
There was hanging at binlog_commit by a thread executing autocommit query.

The hang appeared to be due to an overly condtion for early return 
from binlog_commit introduced by bug#20265 fix.

Fixed with reverting the logic back to 5.0 version.


mysql-test/extra/binlog_tests/binlog.test:
  added a regression test
mysql-test/r/binlog_row_binlog.result:
  results changed
mysql-test/r/binlog_stm_binlog.result:
  results changed
sql/log.cc:
  Removing `all' conjuction arg from early return condition.
  There is nothing to execute by transaction if trx_data is empty.
  
  The work for rotate_and_purge is delayed till TC_LOG::unlog 
  (same as in 5.0 code)
sql/log.h:
  singed because there are assert on positiveness
2007-03-20 10:50:10 +02:00
unknown
f3377aa894 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


sql/item_func.cc:
  Auto merged
sql/log.cc:
  Auto merged
sql/log.h:
  Auto merged
sql/sp_head.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
2007-02-26 14:33:58 -05:00
unknown
9f957f1429 BUG#20141 "User-defined variables are not replicated properly for
SF/Triggers in SBR mode."
BUG#14914 "SP: Uses of session variables in routines are not always replicated"
BUG#25167 "Dupl. usage of user-variables in trigger/function is not replicated
          correctly"

User-defined variables used inside of stored functions/triggers in
statements which did not update tables directly were not replicated.
We also had problems with replication of user-defined variables which
were used in triggers (or stored functions called from table-updating
statements) more than once.

This patch addresses the first issue by enabling logging of all
references to user-defined variables in triggers/stored functions
and not only references from table-updating statements.

The second issue stemmed from the fact that for user-defined
variables used from triggers or stored functions called from
table-updating statements we were writing binlog events for each
reference instead of only one event for the first reference.
This problem is already solved for stored functions called from
non-updating statements with help of "event unioning" mechanism.
So the patch simply extends this mechanism to the case affected.
It also fixes small problem in this mechanism which caused wrong
logging of references to user-variables in cases when non-updating
statement called several stored functions which used the same
variable and some of these function calls were omitted from binlog
as they were not updating any tables.



mysql-test/r/rpl_user_variables.result:
  BUG#20141 - User-defined variables are not replicated properly for 
              SF/Triggers in SBR mode.
  This patch adds the correct results for execution of the added test 
  procedures to the rpl_user_variables test.
mysql-test/t/rpl_user_variables.test:
  BUG#20141 - User-defined variables are not replicated properly for 
              SF/Triggers in SBR mode.
  This patch adds additional tests to the rpl_user_variables test that test 
  many of the different ways user-defined variables can be required to be 
  replicated.
sql/item_func.cc:
  BUG#20141 - User-defined variables are not replicated properly for SF/Triggers
              in SBR mode.
  To properly log accesses to user-defined variables from stored 
  functions/triggers, the get_var_with_binlog() method needs to log references 
  to such variables even from non-table-updating statements within them.
sql/log.cc:
  BUG#20141 - User-defined variables are not replicated properly for SF/Triggers 
              in SBR mode.
  This patch modifies the start_union_events method to accept the query id from 
  a parameter. This allows callers to set the query_id to the id of the sub 
  statement such as a trigger or stored function. Which permits the code to 
  identify when a user defined variable has been used by the statement and this 
  already present in THD::user_var_event.
  
  Note:
  The changes to sql_class.cc, sp_head.cc, and log.cc are designed to allow the 
  proper replication of access to user-defined variables under a special test 
  case (the last case shown in rpl_user_variables.test).
sql/log.h:
  BUG#20141 - User-defined variables are not replicated properly for 
              SF/Triggers in SBR mode.
  This patch adds the query_id parameter to the calls to 
  mysql_bin_log.start_union_events().
sql/sp_head.cc:
  BUG#20141 - User-defined variables are not replicated properly for 
              SF/Triggers in SBR mode.
  This patch modifies the code to allow for cases where events for function calls
  have a separate union for each event and thus cannot use the query_id of the 
  caller as the start of the union. Thus, we use an artifically created query_id
  to set the start of the events.
  
  Note:
  The changes to sql_class.cc, sp_head.cc, and log.cc are designed to allow the 
  proper replication of access to user-defined variables under a special test 
  case (the last case shown in rpl_user_variables.test).
sql/sql_class.cc:
  BUG#20141 - User-defined variables are not replicated properly for 
              SF/Triggers in SBR mode.
  This patch adds the query_id parameter to the calls to 
  mysql_bin_log.start_union_events().
  
  Note:
  The changes to sql_class.cc, sp_head.cc, and log.cc are designed to allow 
  the proper replication of access to user-defined variables under a special 
  test case (the last case shown in rpl_user_variables.test).
2007-02-26 14:06:10 -05: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
bb48472601 Merge mysql.com:/nfsdisk1/lars/bkroot/mysql-5.1-new-rpl
into  mysql.com:/nfsdisk1/lars/MERGE/mysql-5.1-merge


client/mysqlbinlog.cc:
  Auto merged
client/mysqldump.c:
  Auto merged
configure.in:
  Auto merged
include/config-win.h:
  Auto merged
include/my_global.h:
  Auto merged
include/my_pthread.h:
  Auto merged
libmysqld/CMakeLists.txt:
  Auto merged
mysql-test/mysql-test-run.pl:
  Auto merged
mysql-test/r/rpl_row_tabledefs_2myisam.result:
  Auto merged
mysql-test/r/rpl_row_tabledefs_3innodb.result:
  Auto merged
mysql-test/r/rpl_sp.result:
  Auto merged
mysql-test/t/disabled.def:
  Auto merged
mysys/my_thr_init.c:
  Auto merged
sql/CMakeLists.txt:
  Auto merged
sql/field.cc:
  Auto merged
sql/field.h:
  Auto merged
sql/handler.cc:
  Auto merged
sql/item_create.cc:
  Auto merged
sql/item_timefunc.cc:
  Auto merged
sql/log.cc:
  Auto merged
sql/log.h:
  Auto merged
sql/log_event.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/rpl_injector.cc:
  Auto merged
sql/rpl_injector.h:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/set_var.h:
  Auto merged
sql/slave.cc:
  Auto merged
sql/sp_head.cc:
  Auto merged
sql/sp_head.h:
  Auto merged
sql/sql_acl.cc:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_lex.cc:
  Auto merged
sql/sql_lex.h:
  Auto merged
sql/sql_load.cc:
  Auto merged
sql/sql_locale.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_view.cc:
  Auto merged
sql/table.cc:
  Auto merged
unittest/mysys/my_atomic-t.c:
  Auto merged
sql/log_event.cc:
  Manual merge main->rpl
sql/mysqld.cc:
  Manual merge main->rpl
2007-01-12 12:31:44 +01: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
c3315ccca9 Merge romeo.(none):/home/bk/b22864-mysql-5.1-new-rpl
into  romeo.(none):/home/bk/merge-b22864-myql-5.1-new-rpl


sql/log.h:
  Auto merged
sql/log_event.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/log.cc:
  Merge with mysql-5.1-new-rpl
sql/slave.cc:
  Merge with mysql-5.1-new-rpl
sql/sql_insert.cc:
  Merge with mysql-5.1-new-rpl
2006-12-21 19:36:28 +01:00
unknown
3d68c135d0 BUG#22864 (Rollback following CREATE... SELECT discards 'CREATE TABLE'
from log):
When row-based logging is used, the CREATE-SELECT is written as two
parts: as a CREATE TABLE statement and as the rows for the table. For
both transactional and non-transactional tables, the CREATE TABLE
statement was written to the transaction cache, as were the rows, and
on statement end, the entire transaction cache was written to the binary
log if the table was non-transactional. For transactional tables, the
events were kept in the transaction cache until end of transaction (or
statement that were not part of a transaction).

For the case when AUTOCOMMIT=0 and we are creating a transactional table
using a create select, we would then keep the CREATE TABLE statement and
the rows for the CREATE-SELECT, while executing the following statements.
On a rollback, the transaction cache would then be cleared, which would
also remove the CREATE TABLE statement. Hence no table would be created
on the slave, while there is an empty table on the master.

This relates to BUG#22865 where the table being created exists on the
master, but not on the slave during insertion of rows into the newly
created table. This occurs since the CREATE TABLE statement were still
in the transaction cache until the statement finished executing, and
possibly longer if the table was transactional.

This patch changes the behaviour of the CREATE-SELECT statement by
adding an implicit commit at the end of the statement when creating
non-temporary tables. Hence, non-temporary tables will be written to the
binary log on completion, and in the even of AUTOCOMMIT=0, a new
transaction will be started. Temporary tables do not commit an ongoing
transaction: neither as a pre- not a post-commit.

The events for both transactional and non-transactional tables are
saved in the transaction cache, and written to the binary log at end
of the statement.


mysql-test/r/rpl_row_create_table.result:
  Result change
mysql-test/t/rpl_row_create_table.test:
  Requring InnoDB for slave as well.
  Adding test CREATE-SELECT that is rolled back explicitly.
  Changing binlog positions.
sql/log.cc:
  Adding helper class to handle lock/unlock of mutexes using RAII.
  Factoring out code into write_cache() function to transaction cache
    to binary log.
  Adding function THD::binlog_flush_transaction_cache() to flush the
    transaction cache to the binary log file.
  Factoring out code into binlog_set_stmt_begin() to set the beginning
    of statement savepoint.
  Clearing before statement point when transaction cache is truncated
   so that these points are out of range.
sql/log.h:
  Adding method MYSQL_BIN_LOG::write_cache()
sql/log_event.h:
  Replicating OPTION_NOT_AUTOCOMMIT flag (see changeset comment)
sql/mysql_priv.h:
  Although left-shifting signed integer values is well-defined,
  it has potential for strange errors. Using unsigned long long
  instead of signed long long since this is the type of the options
  flags.
sql/slave.cc:
  Adding printout of transaction-critical thread flags.
sql/sql_class.h:
  Adding function THD::binlog_flush_transaction_cache()
  Adding function THD::binlog_set_stmt_begin()
sql/sql_insert.cc:
  Adding code to cache events for a CREATE-SELECT statement.
  Disabling binlog for SBR (but not RBR) when sending error for select part
  of CREATE-SELECT statement.
  Adding implicit commit at end of statement for non-temporary tables.
mysql-test/t/rpl_row_create_table-slave.opt:
  New BitKeeper file ``mysql-test/t/rpl_row_create_table-slave.opt''
2006-12-21 09:29:02 +01:00
unknown
26b6dc4291 Merge mysql.com:/home/bkroot/mysql-5.1-new-rpl
into  mysql.com:/home/bk/MERGE/mysql-5.1-merge


client/mysqlbinlog.cc:
  Auto merged
client/mysqldump.c:
  Auto merged
config/ac-macros/ha_ndbcluster.m4:
  Auto merged
configure.in:
  Auto merged
include/my_global.h:
  Auto merged
mysql-test/r/mysqldump.result:
  Auto merged
mysql-test/r/rpl_timezone.result:
  Auto merged
mysql-test/t/disabled.def:
  Auto merged
sql/handler.cc:
  Auto merged
sql/item_create.cc:
  Auto merged
sql/item_timefunc.cc:
  Auto merged
sql/log.cc:
  Auto merged
sql/log.h:
  Auto merged
sql/log_event.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/rpl_injector.h:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/sp_head.cc:
  Auto merged
sql/sql_acl.cc:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_lex.cc:
  Auto merged
sql/sql_lex.h:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_view.cc:
  Auto merged
sql/table.cc:
  Auto merged
mysql-test/t/mysqldump.test:
  Manual merge
sql/log_event.cc:
  manual merge
2006-12-08 23:41:29 +01:00
unknown
85a8f7c7a9 WL#3618 - Remove HAVE_ROW_BASED_REPLICATION from source code.
Please see worklog for details on files changed.


BitKeeper/deleted/.del-have_row_based.require:
  Delete: mysql-test/r/have_row_based.require
BitKeeper/deleted/.del-not_row_based.require:
  Delete: mysql-test/r/not_row_based.require
BitKeeper/deleted/.del-have_row_based.inc:
  Delete: mysql-test/include/have_row_based.inc
BitKeeper/deleted/.del-not_row_based.inc:
  Delete: mysql-test/include/not_row_based.inc
BitKeeper/deleted/.del-replication.m4:
  Delete: config/ac-macros/replication.m4
2006-12-07 09:18:35 -05:00
unknown
02818a0020 Merge ts3-168.ts.cn.tlan:/home/ngb/mysql/mysql-5.1/mysql-5.1-new-ndb-bj
into  ts3-168.ts.cn.tlan:/home/ngb/mysql/mysql-5.1/mysql-5.1-new-ndb


sql/ha_ndbcluster.cc:
  Auto merged
sql/log.cc:
  Auto merged
sql/log.h:
  Auto merged
sql/sql_repl.cc:
  Auto merged
sql/table.cc:
  Auto merged
storage/ndb/include/mgmapi/mgmapi.h:
  Auto merged
storage/ndb/src/common/transporter/TCP_Transporter.cpp:
  Auto merged
BitKeeper/deleted/.del-OSE_Receiver.cpp:
  Auto merged
storage/ndb/src/common/transporter/TransporterRegistry.cpp:
  Auto merged
storage/ndb/src/common/util/File.cpp:
  Auto merged
storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp:
  Auto merged
storage/ndb/src/kernel/blocks/dbacc/DbaccInit.cpp:
  Auto merged
storage/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp:
  Auto merged
storage/ndb/src/kernel/vm/SimulatedBlock.cpp:
  Auto merged
storage/ndb/src/mgmsrv/ConfigInfo.cpp:
  Auto merged
storage/ndb/tools/restore/consumer_restore.cpp:
  Auto merged
storage/ndb/tools/restore/restore_main.cpp:
  Auto merged
sql/share/errmsg.txt:
  Auto merged
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
  Auto merged
storage/ndb/src/mgmsrv/Services.cpp:
  Auto merged
2006-12-01 11:35:05 +08:00
unknown
5aa81b561e Merge pchardin@bk-internal.mysql.com:/home/bk/mysql-5.1-runtime
into  mysql.com:/home/cps/mysql/devel/5.1-rename-bug


mysql-test/r/log_tables.result:
  Auto merged
mysql-test/t/log_tables.test:
  Auto merged
sql/handler.cc:
  Auto merged
sql/handler.h:
  Auto merged
sql/log.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/sql_delete.cc:
  Auto merged
sql/sql_rename.cc:
  Auto merged
sql/table.cc:
  Auto merged
storage/csv/ha_tina.cc:
  Auto merged
storage/myisam/ha_myisam.cc:
  Auto merged
sql/log.cc:
  manual merge
sql/share/errmsg.txt:
  manual merge
sql/sql_table.cc:
  manual merge
2006-10-24 17:00:23 +04:00
unknown
9438b98519 Fix for Bug #17544 "Cannot do atomic log rotate",
Bug #21785 "Server crashes after rename of the log table" and
Bug #21966 "Strange warnings on create like/repair of the log
            tables"

According to the patch, from now on, one should use RENAME to
perform a log table rotation (this should also be reflected in
the manual).

Here is a sample:

use mysql;
CREATE TABLE IF NOT EXISTS general_log2 LIKE general_log;
RENAME TABLE general_log TO general_log_backup, general_log2 TO general_log;

The rules for Rename of the log tables are following:
      IF   1. Log tables are enabled
      AND  2. Rename operates on the log table and nothing is being
              renamed to the log table.
      DO   3. Throw an error message.
      ELSE 4. Perform rename.
 
The very RENAME query will go the the old (backup) table. This is
consistent with the behavoiur we have with binlog ROTATE LOGS
statement.

Other problems, which are solved by the patch are:

1) Now REPAIR of the log table is exclusive operation (as it should be), this
   also eliminates lock-related warnings. and
2) CREATE LIKE TABLE now usese usual read lock on the source table rather
   then name lock, which is too restrictive. This way we get rid of another
   log table-related warning, which occured because of the above fact
   (as a side-effect, name lock resulted in a warning).


mysql-test/r/log_tables.result:
  update result file
mysql-test/t/log_tables.test:
  Add tests for the bugs
sql/handler.cc:
  update comment
sql/handler.h:
  update function to reflect changes in log tables
  locking logic.
sql/lock.cc:
  Now we allow locking of the log tables for "privileged" threads
  Privileged thread must explicitly close and lock log tables. This
  is required for admin operations such as REPAIR.
sql/log.cc:
  Changes to the file:
  1) Add checks for table schema. It's more important now,
     as we allow rename of the log tables. Since we should
     check for schema when writing to a log table.
     E.g. if one created a table with one-only comlumn and
     renamed it to general_log, the server should cope with
     it.
  2) refactor LOGGER::flush(), so that we can now use the same
     machinery as we use in FLUSH LOGS in other statements:
     whenever we have to perform  a serious operation on the log
     tables, we have to
     (a) lock logger, which blocks other concurrent statements (such 
     as selects) (b) close logs. Then perform an
     exclusive operation, c) reenable logs and d) unlock logger.
  3) Add a function to check if a given table is a log table.
  4) Add support for "privileged" thread
  5) merge is_[general/slow]_log_table_enabled() into one function.
  6) Add new function: reopen _log_tables, which reopens the tables,
     which were enabled (after temporary close, required for admin
     operation)
sql/log.h:
  1) add a new call close_n_lock_tables(). Now we use it instead of
     LOGGER::flush() in FLUSH LOGS implementation.
  2) add a prototype for the function to check if a given
     table is a log table;
  3) add privileged table flag to table logger
  4) merge is_[general/slow]_log_table_enabled()
     into one function.
sql/mysql_priv.h:
  move log table defines to log.h
sql/sql_delete.cc:
  use new function check_if_log_table() instead of direct strcmp
sql/sql_rename.cc:
  Traverse the list of tables in mysql_rename_tables
  to make sure that log tables are processed correctly
  (that is, according to the rules specified in the
  main CS comment)
sql/sql_table.cc:
  1) mysql_admin_table() should disable logs if it performs
     exclusive admin operation on a log table. This way we
     also eliminate warning on REPAIR of the log table.
  2) mysql_create_like_table should read-lock the source table
     instead getting name lock on it. Name lock is too restrictive
     in this case.
sql/share/errmsg.txt:
  Add a new error message for rename of the log tables
sql/table.cc:
  use new function instead of direct strcmp.
  change my_strcasecmp() -> strcmp(), when
  comparing system db and table names
storage/csv/ha_tina.cc:
  update function to reflect changes in log tables
  locking logic.
storage/myisam/ha_myisam.cc:
  update function to reflect changes in log tables
  locking logic.
2006-10-13 17:26:46 +04:00
unknown
3def506b9d ndb - fixed for BUG#15021, binlog_index table become inconsistent if errors during purge of binlogs.
if EMFILE error occured while purging binary logs, stop purging logs and report error message to user.


mysys/my_open.c:
  report EMFILE error when opening file failed.
sql/log.cc:
  report EMFILE error when purging logs, and stop purging logs when EMFILE error occured.
sql/log.h:
  added LOG_INFO_EMFILE error number.
sql/share/errmsg.txt:
  added EMFILE error message for purging binary logs.
sql/sql_repl.cc:
  added EMFILE error message.
sql/table.cc:
  report EMFILE error.
2006-10-13 12:48:05 +08:00
unknown
1e6415028b after merge fix 2006-09-28 18:00:44 +05:00
unknown
3f2f1c2bfd Post-merge fixes:
- Remove extra EXTRA_DIST from several Makefile.ams
- Add dummy primary key to test table in loaddata_autocom.inc


client/Makefile.am:
  Post-merge fix
mysql-test/include/loaddata_autocom.inc:
  Add dummy primary key to test table, because NDB doesn't like BLOB w/ no PK
mysql-test/r/loaddata_autocom_innodb.result:
  Adapt test results to modified loaddata_autocom.inc
mysql-test/r/loaddata_autocom_ndb.result:
  Adapt test results to modified loaddata_autocom.inc
server-tools/instance-manager/Makefile.am:
  Post-merge fix
sql/log.h:
  Post-merge fix
storage/innobase/Makefile.am:
  Post-merge fix
2006-09-13 15:37:35 -06:00
unknown
6a81fa6df5 bug#21965
merge to 5.1


sql/log.h:
  merge to 5.1
2006-09-04 14:19:39 +02:00
unknown
157c42de97 Fix Bug #18559 "log tables cannot change engine, and
gets deadlocked when dropping w/ log on"

Log tables rely on concurrent insert machinery to add data.
This means that log tables are always opened and locked by
special (artificial) logger threads. Because of this, the thread
which tries to drop a log table starts to wait for the table
to be unlocked. Which will happen only if the log table is disabled.
Alike situation happens if one tries to alter a log table.
However in addition to the problem above, alter table calls
check_if_locking_is_allowed() routine for the engine. The
routine does not allow alter for the log tables. So, alter
doesn't start waiting forever for logs to be disabled, but 
returns with an error.
Another problem is that not all engines could be used for
the log tables. That's because they need concurrent insert.

In this patch we:
(1) Explicitly disallow to drop/alter a log table if it
    is currently used by the logger.
(2) Update MyISAM to support log tables
(3) Allow to drop log tables/alter log tables if log is
    disabled
At the same time we (4) Disallow to alter log tables to
unsupported engine (after this patch CSV and MyISAM are 
alowed)
Recommit with review fixes.


mysql-test/r/log_tables.result:
  Update result file.
  Note: there are warnings in result file. This is because of CSV
  bug (Bug #21328). They should go away after it is fixed.
mysql-test/t/log_tables.test:
  Add a test for the bug
sql/ha_myisam.cc:
  Add log table handling to myisam: as log tables
  use concurrent insert, they are typically
  locked with TL_CONCURRERENT_INSERT lock. So,
  disallow other threads to attempt locking of
  the log tables in incompatible modes. Because
  otherwise the threads will wait for the tables
  to be unlocked forever.
sql/handler.cc:
  Add a function to check if a table we're going to lock
  is a log table and if the lock mode we want allowed
sql/handler.h:
  Add a new function to check compatibility of the locking
sql/log.cc:
  we shouldn't close the log table if and only
  if this particular table is already closed
sql/log.h:
  add new functions to check if a log is enabled
sql/share/errmsg.txt:
  add new error messages
sql/sql_table.cc:
  DROP and ALTER TABLE should not work on log
  tables if the log tables are enabled
storage/csv/ha_tina.cc:
  move function to check if the locking for the log
  tables allowed to handler class, so that we can
  reuse it in other engines.
storage/myisam/mi_extra.c:
  add new ::extra() flag processing to myisam
storage/myisam/mi_open.c:
  init log table flag
storage/myisam/mi_write.c:
  update status after each write if it's a log table
storage/myisam/myisamdef.h:
  Add new log table flag to myisam share.
  We need it to distinguish between usual
  and log tables, as for the log tables we
  should provide concurrent insert in a
  different way than for usual tables: we
  want new rows to be immediately visible
  to other threads.
2006-08-03 21:28:15 +04:00
unknown
f4e2516a1a after merge fixes
mysql-test/r/partition_error.result:
  result fix
sql/log.cc:
  use open_slow_log() instead of open_query_log() for slow query log
sql/log.h:
  after merge fix
sql/set_var.cc:
  after merge fix
  use open_slow_log() instead of open_query_log() for slow query log
2006-06-21 14:53:40 +05:00
unknown
84c4f5af32 Merge bk-internal.mysql.com:/data0/bk/mysql-5.1
into  bk-internal.mysql.com:/data0/bk/mysql-5.1-kt


mysql-test/r/join.result:
  Auto merged
mysql-test/t/join.test:
  Auto merged
sql/log.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/sql_lex.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
2006-06-19 17:50:11 +02:00
unknown
0c4e184bde WL#3015: Logging Improvements - No Restarts(ver N4)
Added slow_query_log & general_log global upadatable variables.
Added slow-query-log & general-log startup options.
Added log_output, general_log_file, slow_query_log_file global updatable variables.


mysql-test/r/show_check.result:
  WL#3015: Logging Improvements - No Restarts
  result fix
sql/log.cc:
  WL#3015: Logging Improvements - No Restarts
  added methods to LOGGER class
  void deactivate_log_handlers(THD* thd, uint log_type);
  bool activate_log_handlers(THD* thd, uint log_type);
  added methods to Log_to_file_event_handler:
  TABLE_LIST *get_mysql_slow_log()
  TABLE_LIST *get_mysql_log()
sql/log.h:
  WL#3015: Logging Improvements - No Restarts
  added methods to LOGGER class
  void deactivate_log_handlers(THD* thd, uint log_type);
  bool activate_log_handlers(THD* thd, uint log_type);
  added methods to Log_to_file_event_handler:
  TABLE_LIST *get_mysql_slow_log()
  TABLE_LIST *get_mysql_log()
sql/mysql_priv.h:
  WL#3015: Logging Improvements - No Restarts
sql/mysqld.cc:
  WL#3015: Logging Improvements - No Restarts
  added 'slow-query-log' & 'general-log' options
sql/set_var.cc:
  WL#3015: Logging Improvements - No Restarts
  added 'slow_query_log' & 'general_log' updatable variables
  added 'log_output', 'general_log_file', 'slow_query_log_file' updatable variables
sql/set_var.h:
  WL#3015: Logging Improvements - No Restarts
  new class sys_var_log_state
  new class sys_var_log_output
sql/share/errmsg.txt:
  WL#3015: Logging Improvements - No Restarts
  added error message
sql/sql_delete.cc:
  WL#3015: Logging Improvements - No Restarts
  'truncate table slow_log|general', keep status of logs
2006-06-19 18:30:55 +05:00
unknown
b092d16c88 WL #3153 "Split logs" post-review fixes (after andrei's review)
sql/log.cc:
  post-review fixes:
  * split log_type to log_state and log_type
  * rename log_type to log_table_type where appropriate (to avoid confusion)
  * merge MYSQL_SLOW_LOG and MYSQL_GENERAL_LOG to MYSQL_QUERY_LOG
sql/log.h:
  post-review fixes:
  * move last_time and reopen_file() to MYSQL_QUERY_LOG from the base class
2006-06-05 05:34:34 +04:00
unknown
51e0c5187b WL#3153 "Split logs". Recommit with post-review fixes
sql/ha_ndbcluster_binlog.cc:
  use MYSQL_BIN_LOG instead of MYSQL_LOG
sql/log.cc:
   Split MYSQL_LOG into base MYSQL_LOG and
   MYSQL_GENERAL_LOG, MYSQL_SLOW_LOG, MYSQL_BIN_LOG
sql/log.h:
  Split MYSQL_LOG into base MYSQL_LOG and
  MYSQL_GENERAL_LOG, MYSQL_SLOW_LOG, MYSQL_BIN_LOG
sql/log_event.h:
  use MYSQL_BIN_LOG instead of MYSQL_LOG
sql/mysql_priv.h:
  use MYSQL_BIN_LOG instead of MYSQL_LOG
sql/mysqld.cc:
  fix appropriate comments: use MYSQL_BIN_LOG instead of MYSQL_LOG
sql/rpl_injector.cc:
  use MYSQL_BIN_LOG instead of MYSQL_LOG
sql/rpl_injector.h:
  use MYSQL_BIN_LOG instead of MYSQL_LOG
sql/rpl_rli.h:
  use MYSQL_BIN_LOG instead of MYSQL_LOG
sql/slave.cc:
  Fix appropriate comments: use MYSQL_BIN_LOG instead of MYSQL_LOG.
  Fix usage of new_file(): now we don't need to pass locking-related
  info to the function.
sql/slave.h:
  Use MYSQL_BIN_LOG instead of MYSQL_LOG in appropriate comments
2006-05-05 10:45:58 +04:00
unknown
59eaf292de Fixed compiler and valgrind warnings
Added missing DBUG_xxx_RETURN statements
Fixed some usage of not initialized variables (as found by valgrind)
Ensure that we don't remove locked tables used as name locks from open table cache until unlock_table_names() are called.
This was fixed by having drop_locked_name() returning any table used as a name lock so that we can free it in unlock_table_names()
This will allow Tomas to continue with his work to use namelocks to syncronize things.

Note: valgrind still produces a lot of warnings about using not initialized code and shows memory loss errors when running the ndb tests


BitKeeper/etc/ignore:
  added mysql-test/r/*.log
client/mysqltest.c:
  Change type of variables to get rid of compiler warnings
  More debugging
  Fix memory leak
mysql-test/mysql-test-run.sh:
  Collect warnings about missing DBUG_RETURN statements
mysql-test/r/lock_multi.result:
  Add test of new code
mysql-test/r/ndb_condition_pushdown.result:
  Drop used tables before test
mysql-test/t/lock_multi.test:
  Add test of new code
mysql-test/t/ndb_condition_pushdown.test:
  Drop used tables before test
mysql-test/valgrind.supp:
  Ignore 'safe' warnings from libz (when used with archive)
sql/event.cc:
  More comments
  Simplify code
  Fixed memory leak found by valgrind
sql/ha_archive.cc:
  Remove compiler warnings (Wrong handlerton structure and signed/unsigned comparison)
sql/ha_berkeley.cc:
  Fixed compiler warning
sql/ha_blackhole.cc:
  Fixed compiler warning
sql/ha_federated.cc:
  Fixed compiler warning
sql/ha_heap.cc:
  Fixed compiler warning
sql/ha_myisam.cc:
  Fixed compiler warning
sql/ha_myisammrg.cc:
  Fixed compiler warning
sql/ha_ndbcluster.cc:
  Fixed compiler warnings
sql/ha_partition.cc:
  Fixed compiler warning
  Fixed error noticed by valgrind in ha_partition::rnd_init()
sql/handler.cc:
  Fixed compiler warning
sql/handler.h:
  Fixed compiler warning
sql/item.cc:
  Fixed compiler warning
sql/item_xmlfunc.cc:
  Fixed warning from valgrind when calling memcpy with wrong address
sql/lock.cc:
  More debugging
sql/log.cc:
  Fixed compiler warning
  Indentation fixes
sql/log.h:
  Fixed compiler warning
sql/mysql_priv.h:
  Changed prototype for 'drop_locked_tables'
sql/opt_range.cc:
  Indentation fix
sql/password.c:
  Removed compiler warnings
sql/set_var.cc:
  Fixed compiler warning
sql/slave.cc:
  Fixed compiler warning
sql/sp_head.cc:
  Fixed compiler warning
sql/sql_acl.cc:
  Fixed compiler warning
sql/sql_analyse.cc:
  Added missing DBUG_RETURN statements
sql/sql_base.cc:
  Removed de-reference of not initialized pointer
  More comments
  drop_locked_tables() changed to not delete tables used for name locking
  Fixed compiler warnings
sql/sql_delete.cc:
  Fixed usage of not initialized variable
  (deleted could be referenced in some not common error conditions)
sql/sql_parse.cc:
  Added missing DBUG_VOID_RETURN
  Simplify code
sql/sql_partition.cc:
  Fixed usage of wrong variable (noticed by valgrind)
sql/sql_plugin.cc:
  Removed compiler warning
sql/sql_show.cc:
  Removed compiler warning
sql/sql_table.cc:
  Ensure that we don't remove locked tables used as name locks from open table cache until unlock_table_names() are called.
  This was fixed by having drop_locked_name() returning any table used as a name lock so that we can free it in unlock_table_names()
  This will allow Tomas to continue with his work to use namelocks to syncronize things.
  
  Fixed wrong test of 'table_type' (path_length could otherwise be accessed uninitialized)
  
  Remove compile warnings about not initialized variables.
sql/sql_yacc.yy:
  Ensure that no_write_to_binlog is properly initialized
  (Was accessed uninitialized by partition code)
sql/table.cc:
  Removed valgrind warnings (not fatal)
  Removed compiler warnings
sql/tztime.cc:
  Removed valgrind warning
storage/ndb/include/ndbapi/NdbIndexStat.hpp:
  Removed compiler warning
2006-03-29 14:27:36 +03:00
unknown
4e31551b92 Merge mysql.com:/home/bkroot/mysql-5.1-new
into  mysql.com:/home/bk/w3023-mysql-5.1-new


configure.in:
  Auto merged
BitKeeper/deleted/.del-sp_notembedded.test:
  Auto merged
mysql-test/extra/binlog_tests/binlog.test:
  Auto merged
mysql-test/extra/binlog_tests/blackhole.test:
  Auto merged
mysql-test/r/binlog_stm_ctype_cp932.result:
  Auto merged
mysql-test/t/sp.test:
  Auto merged
scripts/mysql_fix_privilege_tables.sql:
  Auto merged
sql/ha_ndbcluster_binlog.cc:
  Auto merged
sql/handler.cc:
  Auto merged
sql/handler.h:
  Auto merged
sql/log.h:
  Auto merged
sql/log_event.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/opt_range.cc:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
sql/sql_update.cc:
  Auto merged
sql/table.h:
  Auto merged
2006-02-28 10:06:58 +01:00
unknown
7cac0ddfd0 WL#2977 and WL#2712 global and session-level variable to set the binlog format (row/statement),
and new binlog format called "mixed" (which is statement-based except if only row-based is correct,
in this cset it means if UDF or UUID is used; more cases could be added in later 5.1 release):
SET GLOBAL|SESSION BINLOG_FORMAT=row|statement|mixed|default;
the global default is statement unless cluster is enabled (then it's row) as in 5.1-alpha.
It's not possible to use SET on this variable if a session is currently in row-based mode and has open temporary tables (because CREATE
TEMPORARY TABLE was not binlogged so temp table is not known on slave),  or if NDB is enabled (because
NDB does not support such change on-the-fly, though it will later), of if in a stored function (see below).
The added tests test the possibility or impossibility to SET, their effects, and the mixed mode,
including in prepared statements and in stored procedures and functions.
Caveats:
a) The mixed mode will not work for stored functions: in mixed mode, a stored function will
always be binlogged as one call and in a statement-based way (e.g. INSERT VALUES(myfunc()) or SELECT myfunc()).
b) for the same reason, changing the thread's binlog format inside a stored function is
refused with an error message.
c) the same problems apply to triggers; implementing b) for triggers will be done later (will ask
Dmitri).
Additionally, as the binlog format is now changeable by each user for his session, I remove the implication
which was done at startup, where row-based automatically set log-bin-trust-routine-creators to 1
(not possible anymore as a user can now switch to stmt-based and do nasty things again), and automatically
set --innodb-locks-unsafe-for-binlog to 1 (was anyway theoretically incorrect as it disabled
phantom protection).
Plus fixes for compiler warnings.


mysql-test/r/rpl_row_4_bytes.result:
  update
mysql-test/t/rpl_row_4_bytes.test:
  don't influence next tests
sql/ha_archive.cc:
  please pay attention to this structure when you change it...
sql/ha_berkeley.cc:
  please pay attention to this structure when you change it...
sql/ha_blackhole.cc:
  please pay attention to this structure when you change it...
sql/ha_federated.cc:
  please pay attention to this structure when you change it...
sql/ha_heap.cc:
  please pay attention to this structure when you change it...
sql/ha_innodb.cc:
  please pay attention to this structure when you change it...
sql/ha_myisam.cc:
  please pay attention to this structure when you change it...
sql/ha_myisammrg.cc:
  please pay attention to this structure when you change it...
sql/ha_ndbcluster_binlog.cc:
  no more global 'binlog_row_based'
sql/ha_partition.cc:
  please pay attention to this structure when you change it...
sql/handler.cc:
  please pay attention to this structure when you change it...
sql/handler.h:
  it's good to initialize statically (to get no compiler warning) even if to a null value.
sql/item_func.cc:
  UDFs require row-based if this is the "mixed" binlog format.
sql/item_strfunc.cc:
  UUID() requires row-based binlogging if this is the "mixed" binlog format
sql/log.cc:
  binlog_row_based -> thd->current_stmt_binlog_row_based
sql/log.h:
  the enum enum_binlog_format moves to log.h from mysqld.cc as we need it in several places.
sql/log_event.cc:
  binlog_row_based -> thd->current_stmt_binlog_row_based
sql/log_event.h:
  this global variable not used anymore
sql/mysql_priv.h:
  these global variables not used anymore
sql/mysqld.cc:
  simplification in the handling of --binlog-format (but with no user-visible change), thanks to
  the new global system variable.
  RBR does not anymore turn on --log-bin-trust-function-creators and --innodb-locks-unsafe-for-binlog
  as these are global options and RBR is now settable per session.
sql/partition_info.cc:
  compiler warnings
sql/set_var.cc:
  new class of thread's variable, to handle the binlog_format (like sys_var_thd_enum except
  that is_readonly() is overriden for more checks before update).
  compiler warnings (ok'd by Serg)
sql/set_var.h:
  new class for the thread's binlog_format (see set_var.cc)
sql/share/errmsg.txt:
  some messages for when one can't toggle from one binlog format to another
sql/sp_head.cc:
  binlog_row_based -> thd->current_stmt_binlog_row_based
sql/sql_base.cc:
  binlog_row_based -> thd->current_stmt_binlog_row_based
sql/sql_class.cc:
  When a THD is initialized, we set its current_stmt_binlog_row_based
sql/sql_class.h:
  new THD::variables.binlog_format (the value of the session variable set by SET
  or inherited from the global value), and THD::current_stmt_binlog_row_based which tells if the
  current statement does row-based or statement-based binlogging. Both members are needed
  as the 2nd one cannot be derived only from the first one (the statement's type plays a role too),
  and the 1st one is needed to reset the 2nd one.
sql/sql_delete.cc:
  binlog_row_based -> thd->current_stmt_binlog_row_based
sql/sql_insert.cc:
  binlog_row_based -> thd->current_stmt_binlog_row_based
sql/sql_load.cc:
  binlog_row_based -> thd->current_stmt_binlog_row_based.
sql/sql_parse.cc:
  when we are done with a statement, we reset the current_stmt_binlog_row_based to the value
  derived from THD::variables.binlog_format.
sql/sql_partition.cc:
  compiler warning
sql/sql_show.cc:
  compiler warning
sql/sql_table.cc:
  binlog_row_based -> thd->current_stmt_binlog_row_based
tests/mysql_client_test.c:
  compiler warning
mysql-test/r/ndb_binlog_basic2.result:
  new result
mysql-test/r/rpl_switch_stm_row_mixed.result:
  new result
mysql-test/t/ndb_binlog_basic2.test:
  new test to verify that if cluster is enabled, can't change binlog format on the fly.
mysql-test/t/rpl_switch_stm_row_mixed.test:
  test to see if one can switch between SBR, RBR, and "mixed" mode, and when one cannot,
  and test to see if the switching, and the mixed mode, work properly (using UUID() to test,
  as using UDFs is not possible in the testsuite for portability reasons).
2006-02-25 22:21:03 +01:00
unknown
738a1ca08d Merge mysql.com:/home/bkroot/mysql-5.1-new
into  mysql.com:/home/bk/w3023-mysql-5.1-new


mysql-test/extra/binlog_tests/ctype_cp932.test:
  Auto merged
mysql-test/r/binlog_row_blackhole.result:
  Auto merged
mysql-test/r/binlog_stm_ctype_cp932.result:
  Auto merged
sql/handler.cc:
  Auto merged
sql/handler.h:
  Auto merged
sql/lock.cc:
  Auto merged
sql/log.cc:
  Auto merged
sql/log.h:
  Auto merged
sql/log_event.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/opt_range.cc:
  Auto merged
sql/parse_file.cc:
  Auto merged
sql/slave.cc:
  Auto merged
sql/sql_acl.cc:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_load.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
sql/sql_update.cc:
  Auto merged
sql/table.h:
  Auto merged
sql/log_event.cc:
  Merge with mysql-5.1-new
2006-02-16 08:46:45 +01:00
unknown
41f7d13853 WL#3023 (Use locks in a statement-like manner):
Table maps are now written on aquiring locks to tables and released
  at the end of each logical statement.


mysql-test/extra/binlog_tests/ctype_cp932.test:
  Disabling cleanup code
mysql-test/r/binlog_row_blackhole.result:
  Result change
mysql-test/r/binlog_row_mix_innodb_myisam.result:
  Result change
mysql-test/r/binlog_stm_ctype_cp932.result:
  Result change
mysql-test/r/rpl_row_charset.result:
  Result change
mysql-test/r/rpl_row_create_table.result:
  Result change
mysql-test/t/rpl_row_create_table.test:
  Binlog position change
sql/handler.cc:
  Writing table map after external_lock()
sql/handler.h:
  Adding class for table operation hooks.
sql/log.cc:
  Adding binlog_write_table_map() to THD.
  Removing write_table_map() from MYSQL_LOG.
sql/log.h:
  Minor interface changes to move table map writing.
sql/log_event.cc:
  Removing pre-allocation of memory for buffers.
  Allowing ULONG_MAX as table id denoting an event to ignore (only used to transfer flags).
  Adding code to collect tables while seeing table maps and lock collected tables
  when seeing a binrow event.
  Debriding code as a result of the above changes.
sql/log_event.h:
  Minor interface changes.
sql/mysql_priv.h:
  Adding hooks argument to create_table_from_items().
sql/parse_file.cc:
  Minor fix to avoid crash in debug printout.
sql/rpl_rli.h:
  Adding list of tables to lock to RLI structure.
sql/slave.cc:
  Using list of tables to lock from RLI structure.
sql/sql_acl.cc:
  Removing redundant pending events flush.
sql/sql_base.cc:
  Moving pending event flush.
  Using flag to guard to clear statement transaction only if this is the original
  open tables state.
sql/sql_class.cc:
  Adding flag for open tables state.
  Removing redundant pending events flushes.
  Write a dummy event to indicate that the tables to lock should be emptied
  on the slave.
sql/sql_class.h:
  Adding open tables state flags.
  Adding binlog_write_table_map() function to THD.
  Changes to select_create() to support new locking scheme.
sql/sql_insert.cc:
  Adding rollback of statement transaction on error. It can now contain
  events after locking tables.
sql/sql_load.cc:
  Removing redundant pending event flush.
sql/sql_table.cc:
  Adding hooks argument to create_table_from_items().
  Calling prelock hook before starting to lock tables.
sql/sql_update.cc:
  Removing a compiler warning.
sql/table.h:
  Minor changes.
2006-02-16 08:30:53 +01:00
unknown
4ffb392628 Merge
include/config-netware.h:
  Auto merged
mysql-test/mysql-test-run.pl:
  Auto merged
netware/BUILD/compile-AUTOTOOLS:
  Auto merged
netware/Makefile.am:
  Auto merged
netware/my_manage.h:
  Auto merged
netware/mysql_test_run.c:
  Auto merged
netware/BUILD/compile-linux-tools:
  Auto merged
netware/BUILD/compile-netware-END:
  Auto merged
netware/BUILD/mwenv:
  Auto merged
netware/BUILD/nwbootstrap:
  Auto merged
server-tools/instance-manager/Makefile.am:
  Auto merged
sql/log.cc:
  Auto merged
sql/log.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
storage/innobase/include/univ.i:
  Auto merged
storage/innobase/os/os0thread.c:
  Auto merged
storage/myisam/mi_locking.c:
  Auto merged
storage/ndb/src/kernel/blocks/Makefile.am:
  Auto merged
storage/ndb/src/kernel/blocks/dbtup/Makefile.am:
  Auto merged
storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp:
  Auto merged
2006-02-12 20:45:03 +01:00
unknown
387e56aa82 Merge mysqldev@production.mysql.com:my/mysql-5.1-release
into  mysql.com:/home/cps/mysql/trees/5.1/5.1-virgin-no-debug


mysql-test/mysql-test-run.pl:
  Auto merged
sql/log.cc:
  Auto merged
sql/log.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
2006-02-06 17:35:10 +03:00