Commit graph

497 commits

Author SHA1 Message Date
unknown
0d821fafe9 BUG#45516 SQL thread does not use database charset properly
Replication SQL thread does not set database default charset to 
thd->variables.collation_database properly, when executing LOAD DATA binlog.
This bug can be repeated by using "LOAD DATA" command in STATEMENT mode.
        
This patch adds code to find the default character set of the current database 
then assign it to thd->db_charset when slave server begins to execute a relay log.
The test of this bug is added into rpl_loaddata_charset.test
2009-08-12 11:54:05 +08:00
Gleb Shchepa
dc0a87fdc2 Bug #38816: kill + flush tables with read lock + stored
procedures causes crashes!

The problem of that bugreport was mostly fixed by the
patch for bug 38691.
However, attached test case focused on another crash or
valgrind warning problem: SHOW PROCESSLIST query accesses
freed memory of SP instruction that run in a parallel
connection.

Changes of thd->query/thd->query_length in dangerous
places have been guarded with the per-thread
LOCK_thd_data mutex (the THD::LOCK_delete mutex has been
renamed to THD::LOCK_thd_data).


sql/ha_myisam.cc:
  Bug #38816: kill + flush tables with read lock + stored
              procedures causes crashes!
  
  Modification of THD::query/query_length has been guarded
  with the a THD::set_query() method call/LOCK_thd_data
  mutex.
  Unnecessary locking with the global LOCK_thread_count
  mutex has been removed.
sql/log_event.cc:
  Bug #38816: kill + flush tables with read lock + stored
              procedures causes crashes!
  
  Modification of THD::query/query_length has been guarded
  with the THD::set_query()) method call/LOCK_thd_data
  mutex.
sql/slave.cc:
  Bug #38816: kill + flush tables with read lock + stored
              procedures causes crashes!
  
  Modification of THD::query/query_length has been guarded
  with the THD::set_query() method call/LOCK_thd_data mutex.
  
  The THD::LOCK_delete mutex has been renamed to
  THD::LOCK_thd_data.
sql/sp_head.cc:
  Bug #38816: kill + flush tables with read lock + stored
              procedures causes crashes!
  
  Modification of THD::query/query_length has been guarded
  with the a THD::set_query() method call/LOCK_thd_data
  mutex.
sql/sql_class.cc:
  Bug #38816: kill + flush tables with read lock + stored
              procedures causes crashes!
  
  The new THD::LOCK_thd_data mutex and THD::set_query()
  method has been added to guard modifications of THD::query/
  THD::query_length fields, also the Statement::set_statement()
  method has been overloaded in the THD class.
  
  The THD::LOCK_delete mutex has been renamed to
  THD::LOCK_thd_data.
sql/sql_class.h:
  Bug #38816: kill + flush tables with read lock + stored
              procedures causes crashes!
  
  The new THD::LOCK_thd_data mutex and THD::set_query()
  method has been added to guard modifications of THD::query/
  THD::query_length fields, also the Statement::set_statement()
  method has been overloaded in the THD class.
  
  The THD::LOCK_delete mutex has been renamed to
  THD::LOCK_thd_data.
sql/sql_insert.cc:
  Bug #38816: kill + flush tables with read lock + stored
              procedures causes crashes!
  
  Modification of THD::query/query_length has been guarded
  with the a THD::set_query() method call/LOCK_thd_data
  mutex.
sql/sql_parse.cc:
  Bug #38816: kill + flush tables with read lock + stored
              procedures causes crashes!
  
  Modification of THD::query/query_length has been guarded
  with the a THD::set_query() method call/LOCK_thd_data mutex.
sql/sql_repl.cc:
  Bug #38816: kill + flush tables with read lock + stored
              procedures causes crashes!
  
  The THD::LOCK_delete mutex has been renamed to
  THD::LOCK_thd_data.
sql/sql_show.cc:
  Bug #38816: kill + flush tables with read lock + stored
              procedures causes crashes!
  
  Inter-thread read of THD::query/query_length field has
  been protected with a new per-thread LOCK_thd_data
  mutex in the mysqld_list_processes function.
2009-07-24 20:58:58 +05:00
Staale Smedseng
6777150883 Merge from 5.0-bt 2009-06-29 15:17:01 +02:00
Alfranio Correia
dd59815f59 BUG#34687 Error in bin-log after shutdown restart binlog was not closed properly
While reading a binary log that is being used by a master or was not properly
closed, most likely due to a crash, the following warning message is being
printed out: "Warning: this binlog was not closed properly. Most probably mysqld
crashed writing it.". This was scaring our users as the message was not taking
into account the possibility of the file is being just used by the master.

To avoid unnecessarily scaring our users, we replace the original message by the
following one: Warning: "this binlog is either is use or was not closed properly.".
2009-06-11 02:08:40 +01:00
Staale Smedseng
a073ee45c2 Bug #43414 Parenthesis (and other) warnings compiling MySQL
with gcc 4.3.2
      
Compiling MySQL with gcc 4.3.2 and later produces a number of 
warnings, many of which are new with the recent compiler
versions.
      
This bug will be resolved in more than one patch to limit the
size of changesets. This is the first patch, fixing a number 
of the warnings, predominantly "suggest using parentheses 
around && in ||", and empty for and while bodies.
2009-06-09 18:11:21 +02:00
He Zhenxing
5dd1abae7d BUG#43263 BEGIN skipped in some replicate-do-db cases
BEGIN/COMMIT/ROLLBACK was subject to replication db rules, and
caused the boundary of a transaction not recognized correctly 
when these queries were ignored by the rules.

Fixed the problem by skipping replication db rules for these
statements.


sql/log_event.cc:
  Skip checking replication db rules for BEGIN/COMMIT/ROLLBACK statements
2009-05-31 11:26:58 +08:00
Chad MILLER
767501a9b1 Merge community up to enterprise, thus ending the community-server
adventure.
2009-05-06 09:06:32 -04:00
Chad MILLER
14f923c028 Merge 5.0.80 release and 5.0 community. Version left at 5.0.80. 2009-04-14 13:20:13 -04:00
He Zhenxing
51a9116638 BUG#37145 Killing a statement doing DDL may log binlog event with error code 1053
When the thread executing a DDL was killed after finished its
execution but before writing the binlog event, the error code in
the binlog event could be set wrongly to ER_SERVER_SHUTDOWN or
ER_QUERY_INTERRUPTED.

This patch fixed the problem by ignoring the kill status when
constructing the event for DDL statements.

This patch also included the following changes in order to
provide the test case.

 1) modified mysqltest to support variable for connection command

 2) modified mysql-test-run.pl, add new variable MYSQL_SLAVE to
    run mysql client against the slave mysqld.
2009-03-27 13:19:50 +08:00
Ignacio Galarza
675c3ce2bb auto-merge 2009-03-19 09:44:58 -04:00
He Zhenxing
b4fdb8aec1 BUG#37051 Replication rules not evaluated correctly
Backporting patch to 5.0.
2009-03-05 18:10:44 +08:00
Andrei Elkin
d091deaf89 fixing compilation warning and adding flush logs to test of bug#37313 2009-02-24 16:17:34 +02:00
Andrei Elkin
4712e6b9b8 Bug #37313 BINLOG Contains Incorrect server id
Signed integer format specifier forced to print the binlog header with server_id
negative if the unsigned value sets the sign-bit ON.
  
Fixed with correcting the specifier to correspond to typeof(server_id) == ulong.

mysql-test/r/mysqlbinlog.result:
  results changed.
mysql-test/t/mysqlbinlog.test:
  displaying the expected unsignedly formatted server_id value, bug#37313.
sql/log_event.cc:
  Format specifier is corrected to correspond to typeof(server_id).
2009-02-20 13:55:43 +02:00
Ignacio Galarza
54fbbf9591 Bug#29125 Windows Server X64: so many compiler warnings
- Remove bothersome warning messages.  This change focuses on the warnings 
that are covered by the ignore file: support-files/compiler_warnings.supp.
- Strings are guaranteed to be max uint in length
2009-02-10 17:47:54 -05:00
Jonathan Perkin
a07bb6c47a Merge from mysql-5.0.66-release 2008-07-17 17:35:05 +02:00
Chad MILLER
c425bf421d Merge chunk from trunk. 2008-07-10 14:50:07 -04:00
Chad MILLER
6a6e77eeff Merge chunk from trunk. 2008-07-10 14:47:53 -04:00
Mats Kindahl
914cae3a2d Bug #37150 Risk for crash in User_var_log_event::exec_event()
On certain kinds of errors (e.g., out of stack), a call to Item_func_
set_user_var::fix_fields() might fail.  Since the return value of this
call was not checked inside User_var_log_event::exec_event(), continuing
execution after this will cause a crash inside Item_func_set_user_var::
update_hash().

The bug is fixed by aborting execution of the event with an error if
fix_fields() fails, since it is not possible to continue execution anyway.


sql/log_event.cc:
  Aborting execution of event if fix_fields() fails since execution
  of update_hash() might cause a crash.
2008-07-07 09:58:27 +02:00
unknown
7343db297a Make gcov happy. 2008-03-18 16:38:12 +04:00
unknown
fea2a5d83d BUG#13861 - START SLAVE UNTIL may stop 1 evnt too late if
log-slave-updates and circul repl

Slave SQL thread may execute one extra event when there are events
skipped by slave I/O thread (e.g. originated by the same server).
Whereas it was requested not to do so by the UNTIL condition.

This happens because we compare with the end position of previously
executed event. This is fine when there are no skipped by slave I/O
thread events, as end position of previous event equals to start
position of to be executed event. Otherwise this position equals to
start position of skipped event.

This is fixed by:
- reading the event to be executed before checking if the until condition
  is satisfied.
- comparing the start position of the event to be executed. Since we do
  not have the start position available, we compute it by subtracting
  event length from end position (which is available).
- if there are no events on the event queue at the slave sql starting
  time, that meet until condition, we stop immediately, as in this
  case we do not want to wait for next event.


mysql-test/r/rpl_dual_pos_advance.result:
  A test case for BUG#13861.
mysql-test/t/rpl_dual_pos_advance.test:
  A test case for BUG#13861.
sql/log_event.cc:
  Store length of event. This is needed for further calculation of
  the beginning of event.
sql/slave.cc:
  Slave SQL thread may execute one extra event when there are events
  skipped by slave I/O thread (e.g. originated by the same server).
  Whereas it was requested not to do so by the UNTIL condition.
  
  This happens because we compare with the end position of previously
  executed event. This is fine when there are no skipped by slave I/O
  thread events, as end position of previous event equals to start
  position of to be executed event. Otherwise this position equals to
  start position of skipped event.
  
  This is fixed by:
  - reading the event to be executed before checking if the until condition
    is satisfied.
  - comparing the start position of the event to be executed. Since we do
    not have the start position available, we compute it by subtracting
    event length from end position (which is available).
  - if there are no events on the event queue at the slave sql starting
    time, that meet until condition, we stop immediately, as in this
    case we do not want to wait for next event.
sql/slave.h:
  Added master_log_pos parametr to is_until_satisfied().
mysql-test/t/rpl_dual_pos_advance-slave.opt:
  New BitKeeper file ``mysql-test/t/rpl_dual_pos_advance-slave.opt''
2008-02-22 19:07:07 +04:00
unknown
b5d95f021f BUG#26395: if crash during autocommit update to transactional table on master, slave fails
Now, every transaction (including autocommit transactions) start with
a BEGIN and end with a COMMIT/ROLLBACK in the binlog.
Added a test case, and updated lots of test case result files.


mysql-test/t/rpl_transaction-master.opt:
  BitKeeper file /home/sven/bk/b26395-autocommit-xa/5.0-rpl/mysql-test/t/rpl_transaction-master.opt
mysql-test/t/rpl_transaction-slave.opt:
  BitKeeper file /home/sven/bk/b26395-autocommit-xa/5.0-rpl/mysql-test/t/rpl_transaction-slave.opt
mysql-test/r/mix_innodb_myisam_binlog.result:
  Updated result file
mysql-test/r/multi_update.result:
  Updated result file
mysql-test/r/rpl_transaction.result:
  New result file for new test case.
mysql-test/r/sp_trans_log.result:
  Updated result file
mysql-test/r/variables-big.result:
  Updated result file
mysql-test/t/rpl_transaction.test:
  New test case.
sql/log.cc:
   - Always write BEGIN and COMMIT around statements, even in autocommit
     mode.
   - Added comments for binlog_commit and binlog_rollback.
sql/log_event.cc:
  Added debug trigger to avoid writing xid events to the binlog.
2007-12-21 20:30:23 +01:00
unknown
590350633c BUG#32205 Replaying statements from mysqlbinlog fails with a syntax error, replicates fine
The reason of this bug is that when mysqlbinlog dumps a query, the query is written to
output with a delimeter appended right after it, if the query string ends with a '--'
comment, then the delimeter would be considered as part of the comment, if there are any
statements after this query, then it will cause a syntax error.

Start a newline before appending delimiter after a query string


mysql-test/r/ctype_ucs_binlog.result:
  Update test result for BUG#32205
mysql-test/r/mix_innodb_myisam_binlog.result:
  Update test result for BUG#32205
mysql-test/r/mysqlbinlog.result:
  Update test result for BUG#32205
mysql-test/r/rpl_charset.result:
  Update test result for BUG#32205
mysql-test/r/rpl_timezone.result:
  Update test result for BUG#32205
mysql-test/r/user_var-binlog.result:
  Update test result for BUG#32205
mysql-test/t/mix_innodb_myisam_binlog.test:
  Fixed for BUG#32205
sql/log_event.cc:
  Start a newline before appending delimiter after a query string
mysql-test/r/binlog_start_comment.result:
  Add test for BUG#32205
mysql-test/t/binlog_start_comment.test:
  Add test for BUG#32205
2007-12-15 19:50:23 +08:00
unknown
b536aa6756 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community


CMakeLists.txt:
  Auto merged
include/config-win.h:
  Auto merged
include/my_sys.h:
  Auto merged
libmysql/CMakeLists.txt:
  Auto merged
myisam/mi_open.c:
  Auto merged
mysql-test/r/information_schema.result:
  Auto merged
mysql-test/r/information_schema_db.result:
  Auto merged
mysql-test/r/symlink.result:
  Auto merged
mysql-test/t/information_schema.test:
  Auto merged
mysql-test/t/symlink.test:
  Auto merged
mysys/my_symlink2.c:
  Auto merged
sql/ha_myisam.cc:
  Auto merged
sql/ha_ndbcluster.cc:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/item_func.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/set_var.h:
  Auto merged
sql/slave.cc:
  Auto merged
sql/sp_head.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.h:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
sql/sql_repl.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
sql/sql_view.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
sql/structs.h:
  Auto merged
sql/table.h:
  Auto merged
support-files/mysql.spec.sh:
  Auto merged
win/configure.js:
  Auto merged
Makefile.am:
  Manual merge.
client/mysqlcheck.c:
  Manual merge.
configure.in:
  Manual merge.
mysql-test/r/mysqlcheck.result:
  Manual merge.
mysql-test/t/mysqlcheck.test:
  Manual merge.
sql/sql_delete.cc:
  Manual merge.
sql/sql_update.cc:
  Manual merge.
2007-12-10 15:28:17 -05:00
unknown
c1b3466f79 Elimination of warning for unused function code_name() in non-debug mode. 2007-11-13 09:43:29 +01:00
unknown
8cc379ebab Fixes to eliminate warnings. 2007-11-13 09:01:42 +01:00
unknown
b3c4bc6e7d BUG#31793 (log event corruption causes crash):
Corrections to get_str_len_and_pointer().


sql/log_event.cc:
  Adding missing return at end of get_str_len_and_pointer()
  and correcting computation of missing bytes.
2007-11-12 22:02:12 +01:00
unknown
9eb28b96dd Merge capulet.net:/home/bk/mysql-5.0-rpl
into  capulet.net:/home/mats/devel/b31793-mysql-5.0-rpl


sql/log_event.cc:
  Auto merged
2007-11-09 13:45:10 +01:00
unknown
dc91bc74c7 BUG#31793 (log event corruption causes crash):
When running mysqlbinlog on a 64-bit machine with a corrupt relay log,
it causes mysqlbinlog to crash. In this case, the crash is caused
because a request for 18446744073709534806U bytes is issued, which
apparantly can be served on a 64-bit machine (speculatively, I assume)
but this causes the memcpy() issued later to copy the data to segfault.

The request for the number of bytes is caused by a computation
of data_len - server_vars_len where server_vars_len is corrupt in such
a sense that it is > data_len. This causes a wrap-around, with the
the data_len given above.

This patch adds a check that if server_vars_len is greater than
data_len before the substraction, and aborts reading the event in
that case marking the event as invalid. It also adds checks to see
that reading the server variables does not go outside the bounds
of the available space, giving a limited amount of integrity check.


mysql-test/r/mysqlbinlog.result:
  Result change.
mysql-test/t/mysqlbinlog.test:
  Adding test that it fails gracefully for a corrupt relay log.
sql/log_event.cc:
  Adding check that status var length does not cause wrap-around
  when performing subtraction. Extending get_str_len_and_pointer() to
  check that the string can actually be read without reading outside
  bounds. Adding checks when reading server variables from the Query-
  log_event so that the variable can really be read. Abort reading
  and mark the event as invalid otherwise.
mysql-test/std_data/corrupt-relay-bin.000624:
  BitKeeper file /home/mats/devel/b31793-mysql-5.0-rpl/mysql-test/std_data/corrupt-relay-bin.000624
2007-11-09 13:43:09 +01:00
unknown
95f3db7be1 Bug #27571 asynchronousity in setting mysql_query::error and
Query_log_event::error_code

A query can perform completely having the local var error of mysql_$query
zero, where $query in insert, update, delete, load,
and be  binlogged with error_code e.g KILLED_QUERY while there is no
reason do to so.
That can happen because Query_log_event consults thd->killed flag to
evaluate error_code.

Fixed with implementing a scheme suggested and partly implemented at
time of bug@22725 work-on. error_status is cached immediatly after the
control leaves the main rows-loop and that instance always corresponds
to `error' the local of mysql_$query functions. The cached value
is passed to Query_log_event constructor, not the default thd->killed
which can be changed in between of the caching and the constructing.


mysql-test/r/binlog_killed.result:
  results changed
mysql-test/t/binlog_killed.test:
  Demonstrating that effective killing during rows-loop execution leads to the speficied actions:
  binlogging with the error for a query modified a not-transactional table or
  rolling back effects for transactional table;
  
  fixing possible non-determinism with ID when query_log_enabled;
  
  leave commented out tests for multi-update,delete due to another bug;
  
  removing an obsolete tests template;
  
  changing system rm to --remove_file.
sql/log_event.cc:
  adding killed status arg
sql/log_event.h:
  added killed status arg
sql/sql_delete.cc:
  deploying the update part patch for delete, multi-delete
sql/sql_insert.cc:
  deploying the update-part patch for insert..select
sql/sql_load.cc:
  deploying the update-part patch for load data.
  simulation added.
sql/sql_update.cc:
  Impementing the fix as described in the comments left by bug@22725.
  Also simulation of killing after the loop that would affect binlogging in the old code.
mysql-test/t/binlog_killed_bug27571-master.opt:
  post rows-loop killing simulation's options
mysql-test/t/binlog_killed_bug27571.test:
  Checking that if killing happens inbetween of the end of rows loop and
  recording into binlog that will not lead to recording any error incl
  the killed error.
mysql-test/t/binlog_killed_simulate-master.opt:
  simulation options
mysql-test/t/binlog_killed_simulate.test:
  tests for 
  a query (update is choosen) being killed after the row-loop;
  load data killed within the loop - effective killed error in the event is gained.
2007-10-29 15:20:59 +02:00
unknown
bf8a85aa56 Bug #29309 Incorrect "Seconds_Behind_Master" value in SHOW SLAVE STATUS after FLUSH LOGS
Report claims that Seconds_behind_master behaves unexpectedly. 

Code analysis shows that there is an evident flaw in that treating of FormatDescription event is wrong
so  that after FLUSH LOGS on slave the Seconds_behind_master's calculation slips and incorrect
value can be reported to SHOW SLAVE STATUS. 
Even worse is that the gap between the correct and incorrect deltas grows with time.

Fixed with prohibiting changes to rpl->last_master_timestamp by artifical events (any kind of).
suggestion as comments is added how to fight with lack of info on the slave side by means of
new heartbeat feature coming.

The test can not be done ealily fully determistic.


sql/log_event.cc:
  changing timestamp is affirmed only by non-artificial events. Artifical FD won't change it anymore.
  The simulation code is off unless server is started with the args from the opt-file.
  The simulation code assumes that it will execute specific schedule generated by rpl_replication_delay.test.
sql/slave.cc:
  Comments are changed to announce a new possibility to cope with
  Seconds_behind_master jumping due to EOF special treatment (reset of the timestamp)
mysql-test/suite/manual/r/rpl_replication_delay.result:
  result are not deterministic though there are comments saying the most probable expected
  value for Seconds_behind_master
mysql-test/suite/manual/t/rpl_replication_delay-slave.opt:
  bug emulation
mysql-test/suite/manual/t/rpl_replication_delay.test:
  specic test for bug#29309. It's hard to make it reliable as it deals with timestamps.
  (a way to automate the test like this is to have I_S table for show slave status' fields)
  
  A possible way to check results is to run
  grep -i 'show\|seconds' < suite/manual/r/rpl_replication_delay.reject and to get the lines like these:
  
  show slave status /* Second_behind reports 0 */;;
  Seconds_Behind_Master   0
  show slave status /* bug emulated: reports slave threads starting time about 3*3 not 3 secs */;;
  Seconds_Behind_Master   9
  show slave status /* reports the correct diff with master query time about 3+3 secs */;;
  Seconds_Behind_Master   6
  
  Due to time discreteness of time the reported numbers may slightly vary. That's why the test is not reliable.
2007-10-04 18:46:31 +03:00
unknown
b86904731f Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community


BitKeeper/triggers/post-commit:
  Auto merged
CMakeLists.txt:
  Auto merged
VC++Files/sql/mysqld.vcproj:
  Auto merged
client/CMakeLists.txt:
  Auto merged
extra/CMakeLists.txt:
  Auto merged
libmysql/CMakeLists.txt:
  Auto merged
myisam/CMakeLists.txt:
  Auto merged
myisam/mi_open.c:
  Auto merged
mysql-test/r/information_schema.result:
  Auto merged
mysql-test/r/information_schema_db.result:
  Auto merged
mysql-test/t/information_schema.test:
  Auto merged
ndb/src/common/util/File.cpp:
  Auto merged
server-tools/instance-manager/CMakeLists.txt:
  Auto merged
sql/CMakeLists.txt:
  Auto merged
sql/Makefile.am:
  Auto merged
sql/ha_archive.cc:
  Auto merged
sql/ha_berkeley.cc:
  Auto merged
sql/ha_myisam.cc:
  Auto merged
sql/ha_myisammrg.cc:
  Auto merged
sql/ha_ndbcluster.cc:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/lock.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/slave.cc:
  Auto merged
sql/sp_head.cc:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_cache.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_lex.cc:
  Auto merged
sql/sql_lex.h:
  Auto merged
sql/sql_prepare.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/sql_view.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
sql/table.h:
  Auto merged
win/README:
  Auto merged
win/configure.js:
  Auto merged
configure.in:
  manual merge.  version update.
sql/sql_parse.cc:
  manual merge
2007-09-10 08:06:27 -04:00
unknown
f87acb594a Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect
restores from mysqlbinlog out

Problem: using "mysqlbinlog | mysql" for recoveries the connection_id() 
result may differ from what was used when issuing the statement.

Fix: if there is a connection_id() in a statement, write to binlog
SET pseudo_thread_id= XXX; before it and use the value later on.


mysql-test/r/mysqlbinlog.result:
  Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect 
  restores from mysqlbinlog out
    - test result.
mysql-test/t/mysqlbinlog.test:
  Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect 
  restores from mysqlbinlog out
    - test case.
sql/item_create.cc:
  Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect 
  restores from mysqlbinlog out
    - set thread_specific_used flag for the connection_id() function.
sql/item_func.cc:
  Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect 
  restores from mysqlbinlog out
    - always return thd->variables.pseudo_thread_id as a connection_id() 
  result, as it contains a proper value for both master and slave.
sql/log_event.cc:
  Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect 
  restores from mysqlbinlog out
    - set LOG_EVENT_THREAD_SPECIFIC_F event flag if thread_specific_used
  is set.
sql/sql_class.cc:
  Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect 
  restores from mysqlbinlog out
    - thd->thread_specific_used introduced, which is set if thread specific 
  value(s) used in a statement.
sql/sql_class.h:
  Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect 
  restores from mysqlbinlog out
    - thd->thread_specific_used introduced, which is set if thread specific 
  value(s) used in a statement.
2007-08-01 15:27:03 +05:00
unknown
9c1671267a Merge mysqldev@production.mysql.com:my/mysql-5.0-release
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community


BitKeeper/triggers/post-commit:
  Auto merged
client/CMakeLists.txt:
  Auto merged
extra/CMakeLists.txt:
  Auto merged
libmysql/CMakeLists.txt:
  Auto merged
libmysqld/Makefile.am:
  Auto merged
myisam/CMakeLists.txt:
  Auto merged
mysql-test/r/func_in.result:
  Auto merged
mysql-test/r/information_schema_db.result:
  Auto merged
mysql-test/t/func_in.test:
  Auto merged
mysql-test/t/information_schema.test:
  Auto merged
server-tools/instance-manager/CMakeLists.txt:
  Auto merged
sql/Makefile.am:
  Auto merged
sql/ha_archive.cc:
  Auto merged
sql/ha_myisam.cc:
  Auto merged
sql/ha_ndbcluster.cc:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/lock.cc:
  Auto merged
sql/log_event.cc:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/slave.cc:
  Auto merged
sql/sp_head.cc:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_cache.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_lex.cc:
  Auto merged
sql/sql_lex.h:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
sql/sql_repl.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
sql/sql_update.cc:
  Auto merged
sql/sql_view.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
sql/structs.h:
  Auto merged
sql/table.h:
  Auto merged
support-files/mysql.spec.sh:
  Auto merged
win/Makefile.am:
  Auto merged
win/README:
  Auto merged
win/configure.js:
  Auto merged
CMakeLists.txt:
  manual merge.
configure.in:
  manual merge.
mysql-test/r/information_schema.result:
  manual merge.
sql/CMakeLists.txt:
  manual merge.
sql/set_var.cc:
  manual merge.
sql/sql_parse.cc:
  manual merge.
sql/sql_select.cc:
  manual merge.
2007-07-02 10:46:46 -04:00
unknown
fec835f1eb Merge gleb.loc:/home/uchum/work/bk/5.0
into  gleb.loc:/home/uchum/work/bk/5.0-opt


sql/log_event.cc:
  Auto merged
2007-06-24 12:58:45 +05:00
unknown
8c353de957 Merge bk@192.168.21.1:mysql-5.0-opt
into  mysql.com:/home/hf/work/28839/my50-28839


sql/log_event.cc:
  Auto merged
2007-06-21 12:04:13 +05:00
unknown
b5eb3fcb82 Fixed bug #28293.
Occasionally mysqlbinlog --hexdump failed with error:
  ERROR 1064 (42000) at line ...: You have an error in your
  SQL syntax; check the manual that corresponds to your MySQL
  server version for the right syntax to use near
  'Query thread_id=... exec_time=... error_code=...

When the length of hexadecimal dump of binlog header was
divisible by 16, commentary sign '#' after header was lost.
The Log_event::print_header function has been modified to always
finish hexadecimal binlog header with "\n# ".


sql/log_event.cc:
  Fixed bug #28293.
  The Log_event::print_header function has been modified to always
  finish hexadecimal binlog header with "\n# ".
mysql-test/r/mysqlbinlog.result:
  Updated test case for bug #28293.
mysql-test/t/mysqlbinlog.test:
  Updated test case for bug #28293.
2007-06-21 02:11:28 +05:00
unknown
c8bdab1137 Bug #27583 slave sql fails to read from iocache when slave got stopped at pos==4
forgotten merge with 5.0. There can be some bugs waiting for this fix in 5.0 like Bug@29232


sql/log_event.cc:
  file name is changed in step with the position.
2007-06-20 13:21:16 +03:00
unknown
d5cc204e58 Bug #28839 Errors in strict mode silently stop SQL thread if --slave-skip-errors exists.
slave_sql thread calls thd->clear_error() to force error to be ignored,
though this method didn't clear thd->killed state, what causes
slave_sql thread to stop.

clear thd->killed state if we ignore an error


mysql-test/r/rpl_skip_error.result:
  Bug #28839 Errors in strict mode silently stop SQL thread if --slave-skip-errors exists.
  
  test result
mysql-test/t/rpl_skip_error.test:
  Bug #28839 Errors in strict mode silently stop SQL thread if --slave-skip-errors exists.
  
  test case
sql/log_event.cc:
  Bug #28839 Errors in strict mode silently stop SQL thread if --slave-skip-errors exists.
  
  clear thd->killed state if we ignore the error
2007-06-20 14:05:49 +05:00
unknown
f27bf2b463 Bug#22725 Replication outages from ER_SERVER_SHUTDOWN (1053) set in replication events
The reason for the bug was that replaying of a query on slave could not be possible since its event
was recorded with the killed error. Due to the specific of handling INSERT, which per-row-while-loop is 
unbreakable to killing, the query on transactional table should have not appeared in binlog unless
there was  a call to a stored routine that got interrupted with killing (and then there must be an error
returned out of the loop).
   
The offered solution added the following rule for binlogging of INSERT that accounts the above
specifics:
For INSERT on transactional-table if the error was not set the only raised flag
is harmless and is ignored via masking out on time of creation of binlog event.
   
For both table types the combination of raised error and KILLED flag indicates that there
was potentially partial execution on master and consistency is under the question.
In that case the code continues to binlog an event with an appropriate killed error.
 
The fix relies on the specified behaviour of stored routine that must propagate the error 
to the top level query handling if the thd->killed flag was raised in the routine execution.
   
The patch adds an arg with the default killed-status-unset value to Query_log_event::Query_log_event.


sql/log_event.cc:
  killed_status as the value of thd->killed can be passed as an arg to the constructor.
  if the value is different from the default the arg is set to the current thd->killed value.
  A caller might need to masquerade thd->killed with THD::NOT_KILLED.
  So far only mysql_insert() uses such explicit way to tell the constructor about killing status.
sql/log_event.h:
  default arg to the constructor with meaning of killed status of the query. 
  if the arg is not explicitly provided the status of thd->killed will be snapshot 
  inside of the constuctor, which is potentially incorrect (see bug#27571)
sql/sql_class.h:
  extending killed_state with no-state member.
sql/sql_insert.cc:
  ignore the KILLED flag incl KILL_BAD_DATA when the INSERT query event 
  is created without an `error';
sql/sql_update.cc:
  Suggestion how to fix bug#27571 as comments.
mysql-test/r/binlog_killed.result:
  new result file
mysql-test/t/binlog_killed.test:
  regression tests also apply for bug27563, BUG#27565
2007-05-28 22:20:22 +03:00
unknown
808beaa51d Merge mysqldev@production.mysql.com:my/mysql-5.0-release
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community


include/config-win.h:
  Auto merged
myisam/mi_open.c:
  Auto merged
mysql-test/r/func_in.result:
  Auto merged
mysql-test/r/information_schema.result:
  Auto merged
mysql-test/t/func_in.test:
  Auto merged
ndb/src/ndbapi/DictCache.cpp:
  Auto merged
sql/ha_archive.cc:
  Auto merged
sql/ha_myisam.cc:
  Auto merged
sql/ha_ndbcluster.cc:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/lex.h:
  Auto merged
sql/lock.cc:
  Auto merged
sql/log_event.cc:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/slave.cc:
  Auto merged
sql/sp_head.cc:
  Auto merged
sql/sql_base.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_lex.cc:
  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_update.cc:
  Auto merged
sql/sql_view.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
sql/table.h:
  Auto merged
configure.in:
  Version increment.
support-files/mysql.spec.sh:
  Include enterprise advert.
2007-04-26 11:51:37 -04:00
unknown
3eff7d4dd5 Bug#25411 (trigger code truncated), PART I
The issue found with bug 25411 is due to the function skip_rear_comments()
which damages the source code while implementing a work around.
The root cause of the problem is in the lexical analyser, which does not
process special comments properly.
For special comments like :
[1] aaa /*!50000 bbb */ ccc
since 5.0 is a version older that the current code, the parser is in lining
the content of the special comment, so that the query to process is
[2] aaa bbb ccc
However, the text of the query captured when processing a stored procedure,
stored function or trigger (or event in 5.1), can be after rebuilding it:
[3] aaa bbb */ ccc
which is wrong.

To fix bug 25411 properly, the lexical analyser needs to return [2] when
in lining special comments.
In order to implement this, some preliminary cleanup is required in the code,
which is implemented by this patch.

Before this change, the structure named LEX (or st_lex) contains attributes
that belong to lexical analysis, as well as attributes that represents the
abstract syntax tree (AST) of a statement.
Creating a new LEX structure for each statements (which makes sense for the
AST part) also re-initialized the lexical analysis phase each time, which
is conceptually wrong.

With this patch, the previous st_lex structure has been split in two:
- st_lex represents the Abstract Syntax Tree for a statement. The name "lex"
has not been changed to avoid a bigger impact in the code base.
- class lex_input_stream represents the internal state of the lexical
  analyser, which by definition should *not* be reinitialized when parsing
  multiple statements from the same input stream.

This change is a pre-requisite for bug 25411, since the implementation of
lex_input_stream will later improve to deal properly with special comments,
and this processing can not be done with the current implementation of
sp_head::reset_lex and sp_head::restore_lex, which interfere with the lexer.

This change set alone does not fix bug 25411.


sql/item_func.cc:
  Refactoring, separate lex_input_stream from st_lex.
sql/log_event.cc:
  Refactoring, separate lex_input_stream from st_lex.
sql/mysql_priv.h:
  Refactoring, separate lex_input_stream from st_lex.
sql/slave.cc:
  Refactoring, separate lex_input_stream from st_lex.
sql/sp.cc:
  Refactoring, separate lex_input_stream from st_lex.
sql/sp_head.cc:
  Refactoring, separate lex_input_stream from st_lex.
sql/sp_head.h:
  Refactoring, separate lex_input_stream from st_lex.
sql/sql_class.cc:
  Refactoring, separate lex_input_stream from st_lex.
sql/sql_class.h:
  Refactoring, separate lex_input_stream from st_lex.
sql/sql_lex.cc:
  Refactoring, separate lex_input_stream from st_lex.
sql/sql_lex.h:
  Refactoring, separate lex_input_stream from st_lex.
sql/sql_parse.cc:
  Refactoring, separate lex_input_stream from st_lex.
sql/sql_prepare.cc:
  Refactoring, separate lex_input_stream from st_lex.
sql/sql_trigger.cc:
  Refactoring, separate lex_input_stream from st_lex.
sql/sql_view.cc:
  Refactoring, separate lex_input_stream from st_lex.
sql/sql_yacc.yy:
  Refactoring, separate lex_input_stream from st_lex.
2007-04-24 09:24:21 -06:00
unknown
da89f79c4d Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community


VC++Files/sql/mysqld.vcproj:
  Auto merged
include/config-win.h:
  Auto merged
myisam/mi_open.c:
  Auto merged
mysql-test/r/information_schema_db.result:
  Auto merged
ndb/src/common/util/File.cpp:
  Auto merged
sql/Makefile.am:
  Auto merged
sql/ha_archive.cc:
  Auto merged
sql/ha_berkeley.cc:
  Auto merged
sql/ha_myisam.cc:
  Auto merged
sql/ha_myisammrg.cc:
  Auto merged
sql/ha_ndbcluster.cc:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/lock.cc:
  Auto merged
sql/log_event.cc:
  Auto merged
sql/repl_failsafe.cc:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/set_var.h:
  Auto merged
sql/sp_head.cc:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_cache.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_lex.cc:
  Auto merged
sql/sql_lex.h:
  Auto merged
sql/sql_prepare.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/sql_view.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
sql/table.h:
  Auto merged
support-files/mysql.spec.sh:
  Auto merged
configure.in:
  Manual merge.
include/my_dbug.h:
  Manual merge.
sql/mysql_priv.h:
  Manual merge.
sql/mysqld.cc:
  Manual merge.
sql/slave.cc:
  Manual merge.
sql/sql_parse.cc:
  Manual merge.
2007-04-03 09:20:22 -04:00
unknown
24ce495a51 Bug#26837 Return value ignored for packet->append() call within Log_event::read_log_event
- Improve error handling for "out of memory" problems when master is
   sending logs to slave. If memory allocation fails the log should
   now  report error "memory allocation failed reading log event"  


sql/log_event.cc:
  Return LOG_READ_MEM from "Log_event::read_log_event" if memory
  allocation  fails.
2007-03-23 19:00:34 +01:00
unknown
a0521cd749 Polishing: use constants instead of magic numbers.
include/my_global.h:
  Introduce constants to be used instead of magic numbers.
sql/field.cc:
  Polishing: use contants instead of magic numbers.
sql/ha_innodb.cc:
  Polishing: use contants instead of magic numbers.
sql/handler.cc:
  Polishing: use contants instead of magic numbers.
sql/item.cc:
  Polishing: use contants instead of magic numbers.
sql/item.h:
  Polishing: use contants instead of magic numbers.
sql/item_func.cc:
  Polishing: use contants instead of magic numbers.
sql/item_subselect.cc:
  Polishing: use contants instead of magic numbers.
sql/log_event.cc:
  Polishing: use contants instead of magic numbers.
sql/sql_base.cc:
  Polishing: use contants instead of magic numbers.
sql/sql_select.cc:
  Polishing: use contants instead of magic numbers.
sql/sql_show.cc:
  Polishing: use contants instead of magic numbers.
sql/sql_table.cc:
  Polishing: use contants instead of magic numbers.
2007-03-09 08:05:08 +03:00
unknown
053c6c01d6 A fix for Bug#26750 "valgrind leak in sp_head" (and post-review
fixes).

The legend: on a replication slave, in case a trigger creation
was filtered out because of application of replicate-do-table/
replicate-ignore-table rule, the parsed definition of a trigger was not 
cleaned up properly. LEX::sphead member was left around and leaked 
memory. Until the actual implementation of support of 
replicate-ignore-table rules for triggers by the patch for Bug 24478 it 
was never the case that "case SQLCOM_CREATE_TRIGGER"
was not executed once a trigger was parsed,
so the deletion of lex->sphead there worked and the memory did not leak.

The fix: 

The real cause of the bug is that there is no 1 or 2 places where
we can clean up the main LEX after parse. And the reason we 
can not have just one or two places where we clean up the LEX is
asymmetric behaviour of MYSQLparse in case of success or error. 

One of the root causes of this behaviour is the code in Item::Item()
constructor. There, a newly created item adds itself to THD::free_list
- a single-linked list of Items used in a statement. Yuck. This code
is unaware that we may have more than one statement active at a time,
and always assumes that the free_list of the current statement is
located in THD::free_list. One day we need to be able to explicitly
allocate an item in a given Query_arena.
Thus, when parsing a definition of a stored procedure, like
CREATE PROCEDURE p1() BEGIN SELECT a FROM t1; SELECT b FROM t1; END;
we actually need to reset THD::mem_root, THD::free_list and THD::lex
to parse the nested procedure statement (SELECT *).
The actual reset and restore is implemented in semantic actions
attached to sp_proc_stmt grammar rule.
The problem is that in case of a parsing error inside a nested statement
Bison generated parser would abort immediately, without executing the
restore part of the semantic action. This would leave THD in an 
in-the-middle-of-parsing state.
This is why we couldn't have had a single place where we clean up the LEX
after MYSQLparse - in case of an error we needed to do a clean up
immediately, in case of success a clean up could have been delayed.
This left the door open for a memory leak.

One of the following possibilities were considered when working on a fix:
- patch the replication logic to do the clean up. Rejected
as breaks module borders, replication code should not need to know the
gory details of clean up procedure after CREATE TRIGGER.
- wrap MYSQLparse with a function that would do a clean up.
Rejected as ideally we should fix the problem when it happens, not
adjust for it outside of the problematic code.
- make sure MYSQLparse cleans up after itself by invoking the clean up
functionality in the appropriate places before return. Implemented in 
this patch.
- use %destructor rule for sp_proc_stmt to restore THD - cleaner
than the prevoius approach, but rejected
because needs a careful analysis of the side effects, and this patch is 
for 5.0, and long term we need to use the next alternative anyway
- make sure that sp_proc_stmt doesn't juggle with THD - this is a 
large work that will affect many modules.

Cleanup: move main_lex and main_mem_root from Statement to its
only two descendants Prepared_statement and THD. This ensures that
when a Statement instance was created for purposes of statement backup,
we do not involve LEX constructor/destructor, which is fairly expensive.
In order to track that the transformation produces equivalent 
functionality please check the respective constructors and destructors
of Statement, Prepared_statement and THD - these members were
used only there.
This cleanup is unrelated to the patch.


sql/log_event.cc:
  THD::main_lex is private and should not be used.
sql/mysqld.cc:
  Move MYSQLerror to sql_yacc.yy as it depends on LEX headers now.
sql/sql_class.cc:
  Cleanup: move main_lex and main_mem_root to THD and Prepared_statement
sql/sql_class.h:
  Cleanup: move main_lex and main_mem_root to THD and Prepared_statement
sql/sql_lex.cc:
  Implement st_lex::restore_lex()
sql/sql_lex.h:
  Declare st_lex::restore_lex().
sql/sql_parse.cc:
  Consolidate the calls to unit.cleanup() and deletion of lex->sphead
  in mysql_parse (COM_QUERY handler)
sql/sql_prepare.cc:
  No need to delete lex->sphead to restore memory roots now in case of a 
  parse error - this is done automatically inside MYSQLparse
sql/sql_trigger.cc:
  This code could lead to double deletion apparently, as in case
  of an error lex.sphead was never reset.
sql/sql_yacc.yy:
  Trap all returns from the parser to ensure that MySQL-specific cleanup
  is invoked: we need to restore the global state of THD and LEX in 
  case of a parsing error. In case of a parsing success this happens as 
  part of normal grammar reduction process.
2007-03-07 12:24:46 +03:00
unknown
de61d5b0d5 Merge abarkov@bk-internal.mysql.com:/home/bk/mysql-5.0-rpl
into  mysql.com:/home/bar/mysql-5.0.b15126


sql/log_event.cc:
  Auto merged
sql/log_event.h:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_load.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
mysql-test/r/mysqlbinlog.result:
  After merge fix
mysql-test/t/mysqlbinlog.test:
  After merge fix
2007-02-28 17:17:06 +04:00
unknown
c3a3aff54f Bug#15126 character_set_database is not replicated (LOAD DATA INFILE need it)
This patch fixes problem that LOAD DATA could use different
character sets when loading files on master and on slave sides:
- Adding replication of thd->variables.collation_database
- Adding optional character set clause into LOAD DATA

Note, the second way, with explicit CHARACTER SET clause
should be the recommended way to load data using an alternative
character set.
The old way, using "SET @@character_set_database=xxx" should be
gradually depricated.


mysql-test/r/mysqlbinlog.result:
  Adding test case
mysql-test/t/mysqlbinlog.test:
  Adding test case
sql/log_event.cc:
  Adding logging of thd->variables.collation_database
sql/log_event.h:
  Adding declarations
sql/sql_class.cc:
  Exchange character set is null by default
sql/sql_class.h:
  Adding character set into sql_exchange
sql/sql_load.cc:
  - Using exchange character set (if it was specified in LOAD DATA syntax)
  - Using thd->variables.collation_database by default
sql/sql_yacc.yy:
  Adding optional character set clause into LOAD DATA syntax
mysql-test/r/rpl_loaddata2.result:
  New BitKeeper file ``mysql-test/r/rpl_loaddata2.result''
mysql-test/std_data/loaddata6.dat:
  New BitKeeper file ``mysql-test/std_data/loaddata6.dat''
mysql-test/t/rpl_loaddata2.test:
  New BitKeeper file ``mysql-test/t/rpl_loaddata2.test''
2007-02-28 17:06:57 +04:00
unknown
5454146123 Merge mysqldev@production.mysql.com:my/build-200702201448-5.0.36/mysql-5.0-release/
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community


BitKeeper/etc/collapsed:
  auto-union
include/config-win.h:
  Auto merged
myisam/mi_open.c:
  Auto merged
sql/Makefile.am:
  Auto merged
sql/ha_myisam.cc:
  Auto merged
sql/ha_myisammrg.cc:
  Auto merged
sql/ha_ndbcluster.cc:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/lock.cc:
  Auto merged
sql/log_event.cc:
  Auto merged
sql/repl_failsafe.cc:
  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/sql_base.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_lex.cc:
  Auto merged
sql/sql_lex.h:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
sql/sql_repl.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
sql/sql_update.cc:
  Auto merged
sql/sql_view.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
sql/table.h:
  Auto merged
configure.in:
  Manual merge.  Verified "5.0.37".
mysql-test/r/information_schema.result:
  Manual merge.
mysql-test/t/information_schema.test:
  Manual merge.
sql/mysql_priv.h:
  Manual merge.
sql/mysqld.cc:
  Manual merge.
sql/sql_select.cc:
  Manual merge.
2007-02-27 17:07:08 -05:00
unknown
33dbda5eae Merge mysql.com:/nfsdisk1/lars/bkroot/mysql-5.0-rpl
into  mysql.com:/nfsdisk1/lars/MERGE/mysql-5.0-merge


sql/field.cc:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/log.cc:
  Auto merged
sql/log_event.cc:
  Auto merged
sql/log_event.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/slave.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
2007-02-25 00:10:51 +01:00
unknown
607c224969 Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE

Profiling is only partially functional on some architectures.  Where 
there is no getrusage() system call, presently Null values are 
returned where it would be required.  Notably, Windows needs some love 
applied to make it as useful.

  Syntax this adds:
  
  SHOW PROFILES
  
  SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
   where "n" is an integer
   and "types" is zero or many (comma-separated) of
      "CPU"
      "MEMORY" (not presently supported)
      "BLOCK IO"
      "CONTEXT SWITCHES"
      "PAGE FAULTS"
      "IPC"
      "SWAPS"
      "SOURCE"
      "ALL"

It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by 
default.

This patch abstracts setting THDs' "proc_info" behind a macro that 
can be used as a hook into the profiling code when profiling 
support is compiled in.  All future code in this line should use
that mechanism for setting thd->proc_info.

---

Tests are now set to omit the statistics.

---

Adds an Information_schema table, "profiling" for access to 
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.  

Updated test results.
---
Include more thorough profiling tests.

Improve support for prepared statements.

Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.

Limit the size of captured query text.

No longer log queries that are zero length.


BitKeeper/deleted/.del-profile.result:
  Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
  Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
  Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
  Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
  Add a configure-time option to enable/disable query profiling.  The
  default is enabled.
include/my_dbug.h:
  
  
  DBUG_* statements should be syntactically equivalent to a single 
  statement.
myisam/mi_open.c:
  DBUG_* statements should be syntactically equivalent to a single 
  statement.
mysql-test/r/information_schema.result:
  Updated (re-recorded) tests that I missed somehow.  I verified these
  for correctness.
mysql-test/r/information_schema_db.result:
  Updated test results I missed.
mysql-test/r/mysqlshow.result:
  Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
  DBUG_* statements should be syntactically equivalent to a single 
  statement.
sql/ha_archive.cc:
  Abstract setting thread-info into a function or macro.
  ---
  Manual merge, undoing first patch.
sql/ha_berkeley.cc:
  Include patch backported to 5.0-global.
  
  THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
  Abstract setting thread-info into a function or macro.
  ---
  Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
  DBUG_* statements should be syntactically equivalent to a single 
  statement.
sql/ha_ndbcluster.cc:
  DBUG_* statements should be syntactically equivalent to a single 
  statement.
sql/item_cmpfunc.cc:
  DBUG_* statements should be syntactically equivalent to a single 
  statement.
sql/item_func.cc:
  Abstract setting thread-info into a function or macro.
  ---
  Manual merge, undoing first patch.
sql/lock.cc:
  Abstract setting thread-info into a function or macro.
  ---
  Manual merge, undoing first patch.
sql/log_event.cc:
  Abstract setting thread-info into a function or macro.
  ---
  Manual merge, undoing first patch.
sql/mysql_priv.h:
  Use 64-bit constants for the 64-bit bit field.
  
  Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
  Add semicolon to DBUG statement.
  
  Add a new system variable and set it.
  ---
  Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
  Abstract setting thread-info into a function or macro.
  ---
  Manual merge, undoing first patch.
sql/set_var.cc:
  Make a new system global variable and session variable, to determine
  behavior of profiling.	
  ---
  Include patch backported to 5.0-global.
  
  THD::options is a ulonglong, not ulong.
sql/set_var.h:
  The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
  Abstract setting thread-info into a function or macro.
  ---
  Manual merge, undoing first patch.
  ---
  Include patch backported to 5.0-global.
  
  THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
  Abstract setting thread-info into a function or macro.
  ---
  Manual merge, undoing first patch.
sql/sql_base.cc:
  Abstract setting thread-info into a function or macro.
  ---
  Manual merge, undoing first patch.
  ---
  Include patch backported to 5.0-global.
  
  THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
  DBUG_* statements should be syntactically equivalent to a single 
  statement.
  ---
  Fix merge problems.
sql/sql_class.cc:
  Insert a pointer to the current thread in the profiling code.
  ---
  Manual merge, undoing first patch.
  ---
  Fix merge problems.
sql/sql_class.h:
  Create a new system variable, profiling_history_size, and add a 
  member to THD to hold profiling information about this thread's 
  execution.
  ---
  Manual merge, undoing first patch.
sql/sql_delete.cc:
  Abstract setting thread-info into a function or macro.
  ---
  Manual merge, undoing first patch.
  ---
  Include patch backported to 5.0-global.
  
  THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
  Abstract setting thread-info into a function or macro.
  ---
  Manual merge, undoing first patch.
  ---
  Fix merge problems.
sql/sql_lex.cc:
  Initialize profiling options to empty.
  ---
  Manual merge, undoing first patch.
sql/sql_lex.h:
  Add info to the lexer object so that we can hold data that comes from
  parsing statements.
  
  Reuse memory addresses of uints that can't occur in the same state-
  ment.
  
  This is dangerous because it involves knowledge of what symbols are 
  never used together, which is information stored obliquely in another
  file.
  ---
  Manual merge, undoing first patch.
sql/sql_parse.cc:
  Add hooks to the parser to jump to profiling code.
  
  If profiling is not present, then return an error message upon being
  used.
  ---
  Manual merge, undoing first patch.
  ---
  Fix merge problems.
  ---
  Include patch backported to 5.0-global.
  
  THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
  From prepared statement execution, set the query source in the 
  profiler, as we can't get it from  thd .
  ---
  Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
  Abstract setting thread-info into a function or macro.
  ---
  Manual merge, undoing first patch.
sql/sql_select.cc:
  Abstract setting thread-info into a function or macro.
  ---
  Manual merge, undoing first patch.
  ---
  Fix merge problems.
sql/sql_show.cc:
  Abstract setting thread-info into a function or macro.
  
  Also, remove "static" qualification on schema_table_store_record()
  so that external functions may use it.
  ---
  Manual merge, undoing first patch.
sql/sql_table.cc:
  Abstract setting thread-info into a function or macro.
  ---
  Manual merge, undoing first patch.
sql/sql_update.cc:
  Abstract setting thread-info into a function or macro.
  ---
  Manual merge, undoing first patch.
sql/sql_view.cc:
  Abstract setting thread-info into a function or macro.
  ---
  Manual merge, undoing first patch.
sql/sql_yacc.yy:
  Add new lexer symbols and insert new grammatical rules necessary to 
  retreive profiling information.
  ---
  Manual merge, undoing first patch.
  ---
  Fix merge problems.
sql/table.h:
  Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
  New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
  New BitKeeper file ``mysql-test/r/profiling.result''
  ---
  Include more verbose that describes the queries so far.
  
  Include Giuseppe's tests.
  ---
  Selecting from I_S.profiling is no longer quashed in profiling, as
  requested by Giuseppe.
mysql-test/t/profiling.test:
  New BitKeeper file ``mysql-test/t/profiling.test''
  ---
  Include more verbose that describes the queries so far.
  
  Include Giuseppe's tests.
  ---
  Selecting from I_S.profiling is no longer quashed in profiling, as
  requested by Giuseppe.
sql/sql_profile.cc:
  New BitKeeper file ``sql/sql_profile.cc''
  ---
  If query_source is NULL, as can sometimes happen, then don't try
  to copy that memory.
  ---
  Make each new session use its own numbering of query_ids, and not
  show the global-pool numbers to the user.
  
  Provide a way for prepared statements to set the query_source.
  ---
  Selecting from I_S.profiling is no longer quashed in profiling, as
  requested by Giuseppe.
  
  Limit the size of captured query text.
  
  No longer log queries that are zero length.
sql/sql_profile.h:
  New BitKeeper file ``sql/sql_profile.h''
  ---
  Make each new session use its own numbering of query_ids, and not
  show the global-pool numbers to the user.
  
  Provide a way for prepared statements to set the query_source.
  ---
  Make it less expensive to limit the size of the queries.
2007-02-22 10:03:08 -05:00